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

NullPointerException in com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer

    Details

    • Type: Bug
    • Status: Closed
    • Priority: P4
    • Resolution: Duplicate
    • Affects Version/s: 8u51
    • Fix Version/s: None
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      x86
    • OS:
      os_x

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_51"
      Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
      Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

      javac 1.8.0_51

      FULL OS VERSION :
      Darwin Kernel Version 14.4.0: Thu May 28 11:35:04 PDT 2015; root:xnu-2782.30.5~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      Compiling code that resembles the code in 'Testing.java' file here with the above Java compiler version:

      https://github.com/leothekim/javac-1.8.0_51-b16-NPE

      Results in the following error:

      java.lang.NullPointerException
              at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitIdent(Flow.java:2377)
              at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
              at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
              ..


      THE PROBLEM WAS REPRODUCIBLE WITH -Xint FLAG: Did not try

      THE PROBLEM WAS REPRODUCIBLE WITH -server FLAG: Did not try

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Compile the Testing.java file in the github repo above.

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      I would have expected a friendly compiler message saying that "Strings::new" is an invalid symbol, or something along those lines. The NPE is an incorrect failure mode for the compiler.
      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An exception has occurred in the compiler (1.8.0_51). 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$AbstractAssignAnalyzer.visitIdent(Flow.java:2377)
      at com.sun.tools.javac.tree.JCTree$JCIdent.accept(JCTree.java:2011)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.tree.TreeScanner.visitReference(TreeScanner.java:268)
      at com.sun.tools.javac.tree.JCTree$JCMemberReference.accept(JCTree.java:1973)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExpr(Flow.java:1624)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scanExprs(Flow.java:1636)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitApply(Flow.java:2233)
      at com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1465)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:175)
      at com.sun.tools.javac.tree.JCTree$JCExpressionStatement.accept(JCTree.java:1296)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitBlock(Flow.java:1843)
      at com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:909)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitMethodDef(Flow.java:1780)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitMethodDef(Flow.java:2546)
      at com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:778)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.visitClassDef(Flow.java:1733)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitClassDef(Flow.java:2525)
      at com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:693)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
      at com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:404)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.analyzeTree(Flow.java:2420)
      at com.sun.tools.javac.comp.Flow$AbstractAssignAnalyzer.analyzeTree(Flow.java:2403)
      at com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:211)
      at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1327)
      at com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1296)
      at com.sun.tools.javac.main.JavaCompiler.compile2(JavaCompiler.java:901)
      at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:860)
      at com.sun.tools.javac.main.Main.compile(Main.java:523)
      at com.sun.tools.javac.main.Main.compile(Main.java:381)
      at com.sun.tools.javac.main.Main.compile(Main.java:370)
      at com.sun.tools.javac.main.Main.compile(Main.java:361)
      at com.sun.tools.javac.Main.compile(Main.java:56)
      at com.sun.tools.javac.Main.main(Main.java:42)

      REPRODUCIBILITY :
      This bug can be reproduced always.

      ---------- BEGIN SOURCE ----------
      Source code found here:
      https://github.com/leothekim/javac-1.8.0_51-b16-NPE

      ---------- END SOURCE ----------

      CUSTOMER SUBMITTED WORKAROUND :
      The solution is to provide a valid method reference, e.g. "String::new" instead of "Strings::new".

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: