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

Compiler crashes when passing invalid method reference to super constructor

    Details

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

      Description

      FULL PRODUCT VERSION :
      java version "1.8.0_66"
      Java(TM) SE Runtime Environment (build 1.8.0_66-b17)
      Java HotSpot(TM) 64-Bit Server VM (build 25.66-b17, mixed mode)

      ADDITIONAL OS VERSION INFORMATION :
      Darwin Patrick-Mac 15.0.0 Darwin Kernel Version 15.0.0: Sat Sep 19 15:53:46 PDT 2015; root:xnu-3247.10.11~1/RELEASE_X86_64 x86_64

      A DESCRIPTION OF THE PROBLEM :
      The compiler crashes when calling the `super` constructor with a non-existing
      method reference.

      Note that the problem does not depend on the superclass. There doesn't need to be a constructor that accepts suitable parameters. In fact, this problem also occurs in classes that directly extend from Object.

      STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
      Place the enclosed source code in a file named "Test.java" and compile with "javac Test.java".

      EXPECTED VERSUS ACTUAL BEHAVIOR :
      EXPECTED -
      The compiler issues a compile error stating the method reference is invalid, along with the location of the method reference.
      ACTUAL -
      The compiler crashes with a NullPointerException. No further information about the origin or cause of the problem is given.

      ERROR MESSAGES/STACK TRACES THAT OCCUR :
      An exception has occurred in the compiler (1.8.0_66). Please file a bug at the Java Bug Database (http://bugreport.java.com/bugreport/) after checking the database for duplicates. Include your program and the following diagnostic in your report. Thank you.
      java.lang.NullPointerException
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitIdent(Flow.java:2403)
      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$AssignAnalyzer.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$AssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanExpr(Flow.java:1635)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.scanExprs(Flow.java:1647)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitApply(Flow.java:2259)
      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$AssignAnalyzer.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$AssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitBlock(Flow.java:1883)
      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$AssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitMethodDef(Flow.java:1811)
      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$AssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.visitClassDef(Flow.java:1749)
      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$AssignAnalyzer.scan(Flow.java:1382)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:2446)
      at com.sun.tools.javac.comp.Flow$AssignAnalyzer.analyzeTree(Flow.java:2429)
      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 ----------
      public class Test {
          public Test() {
              super(NonExistingClass::someMethod);
          }
      }

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

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                sadayapalam Srikanth Adayapalam
                Reporter:
                webbuggrp Webbug Group
              • Votes:
                0 Vote for this issue
                Watchers:
                4 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: