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

NullPointerException from the compiler

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Duplicate
    • Icon: P3 P3
    • None
    • 1.3.0
    • tools
    • None
    • x86
    • other

      1.3.0 compiler sometimes fails with the following exception:
      (we suspect this happens when you have two classes with the same name - one being regular (outer) class and the other inner class (in different packages),
      both fully qualified)

      compile:
          [javac] Compiling 40 source files to C:\build\ant\src
          [javac] C:\build\ant\src\org\apache\tools\ant\module\AntExecutor.java:91: cannot access org.openide.util.Task
          [javac] file org\openide\util\Task.class not found
          [javac] private ExecutorTask t1, t2;
          [javac] ^
          [javac] C:\build\ant\src\org\apache\tools\ant\module\AntExecutor.java:73: operator == cannot be applied to org.openide.execution.ExecutorTask,<null>
          [javac] if (last == null) {
          [javac] ^
          [javac] An exception has occurred in the compiler (1.3.0). Please file a bug at the Java Developer Connection (http://java.sun.com/cgi-bin/bugreport.cgi). Include your program and the following diagnostic in your report. Thank you.
          [javac] java.lang.NullPointerException
          [javac] at com.sun.tools.javac.v8.comp.Attr.check(Attr.java:81)
          [javac] at com.sun.tools.javac.v8.comp.Attr.checkId(Attr.java:1274)
          [javac] at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:1141)
          [javac] at com.sun.tools.javac.v8.tree.Tree$Select.visit(Tree.java:963)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:234)
          [javac] at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:926)
          [javac] at com.sun.tools.javac.v8.tree.Tree$Assign.visit(Tree.java:848)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:234)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribExpr(Attr.java:262)
          [javac] at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:604)
          [javac] at com.sun.tools.javac.v8.tree.Tree$Exec.visit(Tree.java:699)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:234)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:276)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribStats(Attr.java:294)
          [javac] at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:428)
          [javac] at com.sun.tools.javac.v8.tree.Tree$Block.visit(Tree.java:492)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:234)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:276)
          [javac] at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:386)
          [javac] at com.sun.tools.javac.v8.tree.Tree$MethodDef.visit(Tree.java:441)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:234)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:276)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1415)
          [javac] at com.sun.tools.javac.v8.comp.Attr._case(Attr.java:347)
          [javac] at com.sun.tools.javac.v8.tree.Tree$ClassDef.visit(Tree.java:402)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribTree(Attr.java:234)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribStat(Attr.java:276)
          [javac] at com.sun.tools.javac.v8.comp.Attr.attribClass(Attr.java:1415)
          [javac] at com.sun.tools.javac.v8.JavaCompiler.compile(JavaCompiler.java:378)
          [javac] at com.sun.tools.javac.v8.Main.compile(Main.java:247)
          [javac] at com.sun.tools.javac.Main.compile(Main.java:26)
          [javac] at java.lang.reflect.Method.invoke(Native Method)
          [javac] at org.apache.tools.ant.taskdefs.Javac.doModernCompile(Javac.java:525)
          [javac] at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:334)
          [javac] at org.apache.tools.ant.Target.execute(Target.java:142)
          [javac] at org.apache.tools.ant.Project.runTarget(Project.java:818)
          [javac] at org.apache.tools.ant.Project.executeTarget(Project.java:532)
          [javac] at org.apache.tools.ant.taskdefs.Ant.execute(Ant.java:213)
          [javac] at org.apache.tools.ant.Target.execute(Target.java:142)
          [javac] at org.apache.tools.ant.Project.runTarget(Project.java:818)
          [javac] at org.apache.tools.ant.Project.executeTarget(Project.java:532)
          [javac] at org.netbeans.nbbuild.NbMerge.execute(NbMerge.java:135)
          [javac] at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:122)
          [javac] at org.apache.tools.ant.Target.execute(Target.java:142)
          [javac] at org.apache.tools.ant.Project.runTarget(Project.java:818)
          [javac] at org.apache.tools.ant.Project.executeTarget(Project.java:532)
          [javac] at org.apache.tools.ant.Project.executeTargets(Project.java:506)
          [javac] at org.apache.tools.ant.Main.runBuild(Main.java:420)
          [javac] at org.apache.tools.ant.Main.main(Main.java:149)

      I have observed it on Win2000 but I suppose this not being platform specific
      (was seen on other platforms as well).
      I am able to supply the whole source and env when this particular case happened
      (if required (50MB)).

      -------------------------------------------------------------
      Two files attached: ant1.2.zip and Build.zip. Steps to reproduce
      on MS-Win machine (didn't try unix, might work as well):
      1. unpack both files to c:2. add ant1.2\bin\ant.bat to your path (and edit it if necessary)
      3. cd c:\build\nbbuild
      4. ant

      ###@###.### 2001-02-14

      Demonstration using plain javac:

      1. unpack the attached build.zip (i am using e:\ on Win2000, with ant1.2 in c:\ant1.2)

      2. cd build\ant\src\org\apache\tools\ant\module
      3. javac -classpath e:\build\openide\netbeans\lib\openide.jar;e:\build\ant\release\modules\ext\ant.jar;e:\build\ant\release\modules\ext\xerces.jar;e:\build\core\release\lib\ext\jaxp.jar;e:\build\core\release\lib\ext\parser.jar;c:\ant1.2\lib\ant.jar;c:\ant1.2\lib\jaxp.jar;c:\ant1.2\lib\parser.jar -sourcepath ..\..\..\..\.. -verbose *.java

      You get the exception and nothing is compiled.

      ###@###.### 2001-03-21

      Please check the classpath - the openide.jar has to be on your classpath (as it is in my example on the first place). If you remove the -verbose the output will not be that long and the error will still be there.

      ###@###.### 2001-03-22

            gafter Neal Gafter (Inactive)
            dstrupl David Štrupl (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved:
              Imported:
              Indexed: