JDK-4417544 : Compiler reuses wrong file name on class file output
  • Type: Bug
  • Component: tools
  • Sub-Component: javac
  • Affected Version: 1.3.0
  • Priority: P4
  • Status: Closed
  • Resolution: Duplicate
  • OS: windows_2000
  • CPU: x86
  • Submitted: 2001-02-21
  • Updated: 2001-03-06
  • Resolved: 2001-03-06
Related Reports
Duplicate :  
Description

Name: yyT116575			Date: 02/21/2001


java version "1.3.0"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.3.0-C)
Java HotSpot(TM) Client VM (build 1.3.0-C, mixed mode)

The following is completely reproducible on my Windows 2000 machine. I found
this on an inner class first, but was able to show it on any old class after I
figured it out.

Let's say you have inadvertently (I don't even know how it happened on my
machine, perhaps in a script I'd written) renamed a class output file to
contain some lowercase letters where it had uppercase letters before. For
example, given a directory with the following contents:

  Foo.class
  Foo.java

...you could rename Foo.class to foo.class. Now recompile Foo.java. Guess what?
The output file from the new compile (the timestamp WILL BE changed) will be
foo.class, not Foo.class (in other words, the compiler is not deleting and
recreating the file from scratch, but reusing the old output class file). This
WILL run if you then enter:

  java Foo

(It will NOT run if you enter "java foo", obviously).

So, then, if you have something like a jar file (I found this while attempting
to make the class a bean), the BeanBox won't like it, because the manifest says
something like:

  name: Foo

...but the BeanBox then recognizes that the file name case is different from
the manifest contents, and won't load it.
(Review ID: 117420) 
======================================================================

Comments
WORK AROUND Name: yyT116575 Date: 02/21/2001 Make sure that you don't rename class files inadvertently or intentionally! This is hard to catch, and happened on an NTFS file system, not a FAT file system (i.e., it isn't just a "FAT thing"). ======================================================================
11-06-2004

PUBLIC COMMENTS .
10-06-2004

EVALUATION We are missing a specification of a unique mapping from class name to file name. neal.gafter@Eng 2001-03-06
06-03-2001