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

The compiler does not recompile dependent classes properly

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Not an Issue
    • Icon: P5 P5
    • None
    • 1.1.7, 1.2.0, 1.2.1, 1.2.2, 1.3.0_02
    • tools
    • generic, x86, sparc
    • generic, solaris_7, windows_95, windows_98, windows_nt



      Name: igT44549 Date: 03/01/99


      A simple example. At first, I have the following consistent
      class hierarchy:

      public class C {
        int i;
        public C(int i) {
          this.i = i;
        }
      }

      public class C1 extends C {
        public C1(int i) {
          super(i);
        }
      }

      public class C2 extends C1 {
        public C2(int i) {
          super(i);
        }
        public static void main(String args[]) {
          C2 c = new C2(1);
          System.out.println("OK");
        }
      }


      Then by mistake I modify class C, so that it becomes incompatible
      with C1:

      public class C {
        int i,j;
        public C(int i, int j) {
          this.i = i;
          this.j = j;
        }
      }

      And invoke javac on C2.java. The output is below:

      lombok{misha}: javac -verbose C2.java
      [parsed C2.java in 6473 ms]
      [loaded ./C1.class in 45 ms]
      [parsed ./C.java in 5 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/lang/Object.class) in 6 ms]
      [checking class C2]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/lang/String.class) in 24 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/io/Serializable.class) in 1 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/lang/Comparable.class) in 251 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/lang/System.class) in 133 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/io/PrintStream.class) in 8 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/io/FilterOutputStream.class) in 2 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/io/OutputStream.class) in 2 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/io/IOException.class) in 1 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/lang/Exception.class) in 1 ms]
      [loaded /local/java/jdk1.2/jre/lib/rt.jar(java/lang/Throwable.class) in 4 ms]
      [wrote C2.class]
      [checking class C]
      [wrote ./C.class]
      [done in 13114 ms]

      The compiler checks and recompiles class C, but does not recompile
      class C1, though it depends on C and is now older than C! As a
      result there is runtime problem:

      lombok{misha}: java C2
      Exception in thread "main" java.lang.NoSuchMethodError: C: method <init>(I)V not found
              at C2.main(Compiled Code)

      Compiling C2.java with "-Xdepend" option does not eliminate this
      problem.

      Environment: CLASSPATH unset.
      lombok{misha}: java -fullversion
      java full version "JDK-1.2-V"

      As far as I know, there is no spec on what the javac compiler is
      supposed to do in such situation. But I believe that it is
      natural to handle it.
      (Review ID: 54900)
      ======================================================================

      Name: skT88420 Date: 05/19/99


      The following is the javac command line parameters and the exception
      that is throw during the compile:

      C:\eis\source\com\redroof\eis\main>javac -J-mx96m -Xdepend -target 1.2 -deprecation -sourcepat
      h c:\eis\source -classpath c:\eis\lib;c:\eis\lib\ViewPoint333\ViewPoint333-12JFC.jar;c:\eis\lib\Spa
      tialX1.3\lib\ofx.spatialx.jar -d c:\eis\lib EISApplication.java
      java.lang.NullPointerException
              at sun.tools.java.Package.getSourceFile(Package.java:126)
              at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java:849)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:127)
              at sun.tools.java.Environment.getQualifiedClassDefinition(Environment.java:399)
              at sun.tools.java.Environment.resolve(Environment.java:226)
              at sun.tools.javac.SourceMember.check(SourceMember.java:446)
              at sun.tools.javac.SourceClass.checkMembers(SourceClass.java:976)
              at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:612)
              at sun.tools.javac.SourceClass.check(SourceClass.java:511)
              at sun.tools.javac.Main.compile(Main.java:550)
              at sun.tools.javac.Main.main(Main.java:733)

      The exception goes away if I don't use the -Xdepend option.

      Unfortunately, the project has lots of propeitary source code
      that I can't supply to you to reproduce the exception.
      (Review ID: 83253)
      ======================================================================

      Name: skT88420 Date: 05/20/99


      1. javac -bootclasspath "foobar" -classpath "foobar" -g:none -Xdepend -deprecation
      2. Happened with various source files

      Compiling TstHandler.java
      java.lang.NullPointerException
              at sun.tools.java.Package.getSourceFile(Package.java:126)
              at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java
      :849)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.j
      ava:127)
              at sun.tools.javac.SourceClass.checkSupers(SourceClass.java:698)
              at sun.tools.javac.SourceClass.resolveTypeStructure(SourceClass.java:122
      9)
              at sun.tools.javac.SourceClass.basicCheck(SourceClass.java:1082)
              at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.j
      ava:137)
              at sun.tools.javac.Main.compile(Main.java:504)
              at sun.tools.javac.Main.main(Main.java:733)
      error: An exception has occurred in the compiler; please file a bug report (http
      ://java.sun.com/cgi-bin/bugreport.cgi).

      4. No trace info
      5, 6.

      C:\>java -version
      java version "1.2.1"
      HotSpot VM (1.0fcs, mixed mode, build E)

      C:\>java -fullversion
      java full version "JDK-1.2.1-A"

      Error also occurs with classic VM
      (Review ID: 83325)
      ======================================================================

      Name: skT88420 Date: 05/26/99


      While compiling couple of modules, which are integrated through a sever
      file, an out of memory error is encountered while comilation.

      The server file is compiled using -depend flag of the java compiler
      which inturn compiles each individual modules.


      Exact text message of error is : java.lang.OutOfMemeoryError
      (Review ID: 83513)
      ======================================================================

      Name: skT88420 Date: 10/01/99


      More and more often when I compile most of my sourcefiles
      (under h:/src in the example)
      I also import compiled classes (under u:/ in the example too, which i don't have/want to recompile)
      The compiler crashes. I don't have a clue what happens:
      but here's the commandline for you:
      cd h:/src/se/posten/logistik/applications/xplod/gui/
      g:/java/jdk1.2.1/bin/javac -J-verbose:class -Xdepend -target 1.2 -sourcepath h:/src; -classpath h:/classes;u:/classes; -d h:/classes AtInleveransLogic.java
      java.lang.NullPointerException

      at sun.tools.java.Package.getSourceFile(Package.java:126)

      at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java:849)

      at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:127)

      at sun.tools.java.BinaryClass.initInnerClasses(BinaryClass.java:351)

      at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:228)

      at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:210)

      at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java:815)

      at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.java:127)

      at sun.tools.java.BinaryClass.initInnerClasses(BinaryClass.java:360)

      at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:228)

      at sun.tools.java.BinaryClass.loadNested(BinaryClass.java:210)

      at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java:815)

      at sun.tools.javac.Main.compile(Main.java:532)

      at sun.tools.javac.Main.main(Main.java:733)

      error: An exception has occurred in the compiler; please file a bug report (http://java.sun.com/cgi-bin/bugreport.cgi).

      1 error


      Compilation exited abnormally with code 4 at Fri Oct 01 19:28:33
      (Review ID: 96035)
      ======================================================================

      Name: skT88420 Date: 11/16/99


      C:\jdk1.2.2\bin>java -version
      java version "1.2.2"
      HotSpot VM (1.0.1, mixed mode, build g)

      C:\jdk1.2.2\bin>

      D:\source>c:\jdk1.2.2\bin\javac -d D:\classes\Client -verbose -Xdepend d:
      \source\com\moneygram\columbus\client\desktop\ColumbusDesktop.java
      [parsed d:\source\com\moneygram\columbus\client\desktop\ColumbusDesktop.java in
      1652 ms]
      [loaded D:\Classes\Client\com\moneygram\columbus\client\AuthorizedClient.class
      in 40 ms]
      [loaded D:
      \Classes\Client\com\moneygram\columbus\client\AuthenticatedClient.class in 20
      ms]
      [loaded D:\Jars\GS_Jars\gsjclientbase.jar
      (com/gemstone/security/AuthenticationManager.class) in 90 ms]
      [loaded D:
      \Classes\Client\com\moneygram\columbus\common\InfrastructureErrorMessageConstant
      s.class in 10 ms]
      [loaded c:\jdk1.2.2\jre\lib\rt.jar(java/lang/Object.class) in 0 ms]
      [loaded D:
      \Classes\Client\com\moneygram\columbus\server\infrastructure\InfrastructureExcep
      tion.class in 0 ms]
      [loaded c:\jdk1.2.2\jre\lib\rt.jar(java/lang/String.class) in 20 ms]
      [loaded c:\jdk1.2.2\jre\lib\rt.jar(java/lang/StringBuffer.class) in 0 ms]
      [loaded c:\jdk1.2.2\jre\lib\rt.jar(java/rmi/RemoteException.class) in 0 ms]
      [loaded D:
      \Classes\Client\com\moneygram\columbus\server\infrastructure\util\BeanLocator.cl
      ass in 10 ms]
      [loaded D:\Jars\GS_Jars\gsjclientbase.jar(com/gemstone/naming/Defaults.class)
      in 0 ms]
      java.lang.NullPointerException
      at sun.tools.java.Package.getSourceFile(Package.java:126)
      at sun.tools.javac.BatchEnvironment.loadDefinition
      (BatchEnvironment.java:849)
      at sun.tools.java.Environment.loadDefinition(Environment.java:174)
      at sun.tools.java.Environment.loadDefinition(Environment.java:174)
      at sun.tools.java.Environment.loadDefinition(Environment.java:174)
      at sun.tools.java.ClassDeclaration.getClassDefinitionNoCheck
      (ClassDeclaration.java:168)
      at sun.tools.java.Imports.resolve(Imports.java:212)
      at sun.tools.javac.SourceClass.basicCheck(SourceClass.java:1079)
      at sun.tools.java.ClassDeclaration.getClassDefinition
      (ClassDeclaration.java:137)
      at sun.tools.javac.Main.compile(Main.java:504)
      at sun.tools.javac.Main.main(Main.java:733)
      error: An exception has occurred in the compiler; please file a bug report
      (http://java.sun.com/cgi-bin/bugreport.cgi).
      1 error
      [done in 2494 ms]
      (Review ID: 97927)
      ======================================================================

      Name: tb29552 Date: 12/29/99


      java version "1.2.2"
      Classic VM (build JDK-1.2.2-001, native threads, symcjit)


      C:\My Documents\Java>javac -g:none -O -Xdepend philip\ks\ProjectGUI.java
      java.lang.NullPointerException:
              at sun.tools.java.Package.getSourceFile(Package.java:126)
              at sun.tools.javac.BatchEnvironment.loadDefinition(BatchEnvironment.java
      :849)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.Environment.loadDefinition(Environment.java:174)
              at sun.tools.java.ClassDeclaration.getClassDefinition(ClassDeclaration.j
      ava:127)
              at sun.tools.java.Environment.getQualifiedClassDefinition(Environment.ja
      va:399)
              at sun.tools.java.Environment.resolve(Environment.java:226)
              at sun.tools.javac.SourceMember.check(SourceMember.java:446)
              at sun.tools.javac.SourceClass.checkMembers(SourceClass.java:978)
              at sun.tools.javac.SourceClass.checkInternal(SourceClass.java:612)
              at sun.tools.javac.SourceClass.check(SourceClass.java:511)
              at sun.tools.javac.Main.compile(Main.java:550)
              at sun.tools.javac.Main.main(Main.java:733)
      error: An exception has occurred in the compiler; please file a bug report (http
      ://java.sun.com/cgi-bin/bugreport.cgi).
      1 error

      Source files are rather large, I will email them if you wish (please contact me)
      (Review ID: 99427)
      ======================================================================

            gafter Neal Gafter (Inactive)
            iris Iris Clark
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: