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

[local-methods] Finder crashes when encountering private method calls in field initializer

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: repo-amber
    • Fix Version/s: repo-amber
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • CPU:
      generic
    • OS:
      generic

      Description

      Given:

      public class X {
          int x = getInt();
          private int getInt() { return 0; }
      }

      Javac when invoked with -XDfind=local-methods crashes with:

      An exception has occurred in the compiler (14-internal). Please file a bug against the Java compiler via the Java bug reporting page (http://bugreport.java.com) after checking the Bug Database (http://bugs.java.com) for duplicates. Include your program, the following diagnostic, and the parameters passed to the Java compiler in your report. Thank you.
      java.lang.NullPointerException
      at java.base/java.util.Objects.requireNonNull(Objects.java:222)
      at java.base/java.util.Optional.of(Optional.java:111)
      at java.base/java.util.stream.FindOps$FindSink$OfRef.get(FindOps.java:194)
      at java.base/java.util.stream.FindOps$FindSink$OfRef.get(FindOps.java:191)
      at java.base/java.util.stream.FindOps$FindOp.evaluateSequential(FindOps.java:150)
      at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
      at java.base/java.util.stream.ReferencePipeline.findFirst(ReferencePipeline.java:543)
      at jdk.compiler/com.sun.tools.javac.comp.Analyzer$LocalMethodsAnalyzer.match(Analyzer.java:429)
      at jdk.compiler/com.sun.tools.javac.comp.Analyzer$LocalMethodsAnalyzer.match(Analyzer.java:343)
      at jdk.compiler/com.sun.tools.javac.comp.Analyzer$StatementScanner.scan(Analyzer.java:754)
      at jdk.compiler/com.sun.tools.javac.comp.Analyzer$StatementScanner.scan(Analyzer.java:744)
      at jdk.compiler/com.sun.tools.javac.comp.Analyzer.analyze(Analyzer.java:624)
      at jdk.compiler/com.sun.tools.javac.comp.Analyzer.analyzeIfNeeded(Analyzer.java:614)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClassBody(Attr.java:4899)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4753)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attribClass(Attr.java:4682)
      at jdk.compiler/com.sun.tools.javac.comp.Attr.attrib(Attr.java:4627)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.attribute(JavaCompiler.java:1347)
      at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:973)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:318)
      at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:176)
      at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
      at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
      at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      at java.base/java.lang.reflect.Method.invoke(Method.java:564)
      at com.intellij.rt.execution.application.AppMainV2.main(AppMainV2.java:131)
      printing javac parameters to: /home/srikanth/amber/amber/javac.20191126_155320.args

        Attachments

          Activity

            People

            Assignee:
            sadayapalam Srikanth Adayapalam
            Reporter:
            sadayapalam Srikanth Adayapalam
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: