Dealing with case insensitivity

Eric Blake ebb9@email.byu.edu
Fri Mar 15 14:08: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'd be interested to know how Jikes handles this.

The JLS forbids having a class named java/awt/image if there is a
subpackage by that name.  But you are right, on case-insensitive
systems, it is difficult to tell whether image.class or Image.class was
the correct file name, without actually reading the constant pool; and
it would be legal to have java/awt/Image.java.  As far as I know (I'm
not very up-to-date on how jikes does filename control on Windows),
jikes just flattens all filenames to all lowercase, then tries to warn
the user on any conflicts.  But it sometimes fails; there are several
open bugs in the jikes bug database regarding file handling in Windows.

When it comes to deciding between subpackages vs. inner classes, you can
once again use the rule that no class can have the same name as a
package to help make the decision.
-- 
This signature intentionally left boring.

Eric Blake             ebb9@email.byu.edu
  BYU student, free software programmer



More information about the Java mailing list