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

Javac throws a NullPointerException.

    Details

    • Subcomponent:
    • Introduced In Build:
      b73
    • Introduced In Version:
      6
    • Resolved In Build:
      b91
    • CPU:
      x86
    • OS:
      linux
    • Verification:
      Verified

      Description

      Please download the attached example and unpack it. Then go to directory "flowtest" and run:
      javac -cp FlowTest2.jar flowtest3/Main.java

      The following exception is reported for me:
      An exception has occurred in the compiler (1.6.0-rc). Please file a bug at the Java Developer Connection (http://java.sun.com/webapps/bugreport) after checking the Bug Parade for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.NullPointerException
              at com.sun.tools.javac.comp.Flow.visitApply(Flow.java:1117)
              at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1209)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:35)
              at com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:157)
              at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1073)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:35)
              at com.sun.tools.javac.comp.Flow.scanStat(Flow.java:484)
              at com.sun.tools.javac.comp.Flow.scanStats(Flow.java:492)
              at com.sun.tools.javac.comp.Flow.visitBlock(Flow.java:747)
              at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:738)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:35)
              at com.sun.tools.javac.comp.Flow.scanStat(Flow.java:484)
              at com.sun.tools.javac.comp.Flow.visitTry(Flow.java:948)
              at com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:966)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:35)
              at com.sun.tools.javac.comp.Flow.scanStat(Flow.java:484)
              at com.sun.tools.javac.comp.Flow.scanStats(Flow.java:492)
              at com.sun.tools.javac.comp.Flow.visitBlock(Flow.java:747)
              at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:738)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:35)
              at com.sun.tools.javac.comp.Flow.scanStat(Flow.java:484)
              at com.sun.tools.javac.comp.Flow.visitMethodDef(Flow.java:693)
              at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:638)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:35)
              at com.sun.tools.javac.comp.Flow.visitClassDef(Flow.java:627)
              at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:574)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:35)
              at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:1255)
              at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1014)
              at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:988)
              at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:697)
              at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:662)
              at com.sun.tools.javac.main.Main.compile(Main.java:327)
              at com.sun.tools.javac.main.Main.compile(Main.java:253)
              at com.sun.tools.javac.main.Main.compile(Main.java:244)
              at com.sun.tools.javac.Main.compile(Main.java:69)
              at com.sun.tools.javac.Main.main(Main.java:54)

      Occurs on:
      $ java -version
      java version "1.6.0-rc"
      Java(TM) SE Runtime Environment (build 1.6.0-rc-b87)
      Java HotSpot(TM) Client VM (build 1.6.0-rc-b87, mixed mode, sharing)

      The exceptions is not thrown on:
      $ java -version
      java version "1.5.0_06"
      Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_06-b05)
      Java HotSpot(TM) Client VM (build 1.5.0_06-b05, mixed mode, sharing)

      the following compilation error is reported on the java version "1.5.0_06", which is correct, as package flowtest1 and its content is not on the classpath:
      flowtest3/Main.java:29: package flowtest1.Main does not exist
                  flowtest1.Main.X x = null;
                                ^
      1 error

        Attachments

          Activity

            People

            • Assignee:
              ahe Peter Ahe
              Reporter:
              jlahoda Jan Lahoda
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:
                Imported:
                Indexed: