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

NPE in Flow$FlowAnalyzer.visitApply: Cannot invoke getThrownTypes because tree.meth.type is null

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Open
    • Priority: P3
    • Resolution: Unresolved
    • Affects Version/s: 16
    • Fix Version/s: 17
    • Component/s: tools
    • Labels:
      None

      Description

      There have been a handful of other bugs involving NPEs in Flow$FlowAnalyzer.visitApply, but this appears to be a distinct issue that still reproduces with the latest JDK 16 EA:

      ```
      import static java.util.Map.Entry.comparingByKey;

      import java.util.List;
      import java.util.Map;
      import java.util.stream.Stream;

      public class T {

        void f(Stream<Map.Entry<Long, List<String>>> stream) {
          stream
              .sorted(
                  comparingByKey()
                      .thenComparing((Map.Entry<Long, List<String>> e) -> e.getValue().hashCode()))
              .count();
        }
      }
      ```

      ```
      javac -fullversion T.java
      javac full version "16-ea+34-2216"
      An exception has occurred in the compiler (16-ea). 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: Cannot invoke "com.sun.tools.javac.code.Type.getThrownTypes()" because "tree.meth.type" is null
              at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1383)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1745)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:440)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitSelect(TreeScanner.java:316)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCFieldAccess.accept(JCTree.java:2273)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:440)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1381)
              at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1745)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:49)
              at jdk.compiler/com.sun.tools.javac.comp.Flow$BaseAnalyzer.scan(Flow.java:440)
              at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.visitExec(TreeScanner.java:219)
      ```

        Attachments

          Activity

            People

            Assignee:
            vromero Vicente Arturo Romero Zaldivar
            Reporter:
            cushon Liam Miller-Cushon
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Dates

              Created:
              Updated: