Dealing with case insensitivity

Per Bothner per@bothner.com
Fri Mar 15 14:27:00 GMT 2002


Bryce McKinlay wrote:
> The underlying issue is that it doesn't know whether its looking for a 
> class or a package when it sees something like "new 
> java.awt.image.Foo()" - afaik there is no way to know there isn't a 
> java.awt.image class defined in java/awt/image.java with an inner class 
> Foo?

I think basically we need to be able to read and parse a .java or .class 
file and continue searching it it does contain the class we need.
On other words: the read_class function (in jcf-parse.c) needs to be
able to interleave the logic of find_class with calls to either
parse_source_file_1 or jcf_parse:

read_class (name)
{
   for (each DIR in the path)
     {
       if (exists DIR/NAME.java)
         {
           parse_source_file_1 ();
           if (class NAME found)
             {
               parse_source_file_2 ();
               return;
             }
           else if (no class matching name, ignoring case)
             error();
         }
       else if (exists DIR/NAME.class)
         similar logic;
     }
}

When we see java.awt.image.Foo, I assume we first look for
a java/awt/image/Foo.java and java/awt/image/Foo.class *before*
we look for java/awt/image.java or java/awt/image$Foo.class?
If not, we should.
-- 
	--Per Bothner
per@bothner.com   http://www.bothner.com/per/



More information about the Java mailing list