Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-4417544

Compiler reuses wrong file name on class file output

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P4 P4
    • None
    • 1.3.0
    • tools
    • x86
    • windows_2000



      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)
      ======================================================================

            gafter Neal Gafter (Inactive)
            yyoungsunw Yung-ching Young (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: