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

javac crash when detecting lambda candidates

    Details

    • Type: Bug
    • Status: Resolved
    • Priority: P4
    • Resolution: Fixed
    • Affects Version/s: 10
    • Fix Version/s: 10
    • Component/s: tools
    • Labels:
    • Subcomponent:
    • Resolved In Build:
      b34

      Description

      Consider this code:
      ---
      public class LambdaWithMethod {
          public static void run(Runnable r) {
              run(new Runnable() {
                  public void run() {
                      put(get());
                  }
              });
          }
          private static String get() { return null; }
          private static void put(String i) {}
      }
      ---

      When detecting lambda candidates, this crashes javac:
      ---
      $ javac -XDfind=lambda /tmp/LambdaWithMethod.java
      An exception has occurred in the compiler (10-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 and the following diagnostic in your report. Thank you.
      java.lang.AssertionError: Analyzer error when processing: run(new Runnable(){
          
          () {
              super();
          }
          
          public void run() {
              put(get());
          }
      });
              at jdk.compiler/com.sun.tools.javac.util.Assert.error(Assert.java:162)
              at jdk.compiler/com.sun.tools.javac.comp.Analyzer.doAnalysis(Analyzer.java:562)
              at jdk.compiler/com.sun.tools.javac.comp.Analyzer$2.flush(Analyzer.java:534)
              at jdk.compiler/com.sun.tools.javac.comp.Analyzer.flush(Analyzer.java:570)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1398)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1366)
              at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:964)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:306)
              at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:165)
              at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
              at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
      ---

        Attachments

          Activity

            People

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

              Dates

              • Created:
                Updated:
                Resolved: