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

assertion error at TransTypes.visitApply

    XMLWordPrintable

Details

    • b05
    • generic
    • generic

    Backports

      Description

        ADDITIONAL SYSTEM INFORMATION :
        macOS 10.14.5, javac / openjdk 12.0.1 2019-04-16

        A DESCRIPTION OF THE PROBLEM :
        When I compile the test case with the current java compiler (openjdk 12.0.1 2019-04-16) an NPE occurs.



        STEPS TO FOLLOW TO REPRODUCE THE PROBLEM :
        Please checkout the test case on GitHub:
        https://github.com/gitsnaf/javac-npe

        EXPECTED VERSUS ACTUAL BEHAVIOR :
        EXPECTED -
        code compiles
        ACTUAL -
        An exception has occurred in the compiler (12.0.1). 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.NullPointerException
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1304)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1709)
        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:394)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitLambda(Flow.java:1353)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCLambda.accept(JCTree.java:1886)
        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:394)
        at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitApply(Flow.java:1303)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1709)
        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:394)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitVarDef(Flow.java:1052)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCVariableDecl.accept(JCTree.java:962)
        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:394)
        at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitBlock(Flow.java:1060)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
        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:394)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitTry(Flow.java:1178)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCTry.accept(JCTree.java:1381)
        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:394)
        at jdk.compiler/com.sun.tools.javac.tree.TreeScanner.scan(TreeScanner.java:57)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitBlock(Flow.java:1060)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCBlock.accept(JCTree.java:1026)
        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:394)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitMethodDef(Flow.java:1027)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodDecl.accept(JCTree.java:872)
        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:394)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.visitClassDef(Flow.java:990)
        at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCClassDecl.accept(JCTree.java:780)
        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:394)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1396)
        at jdk.compiler/com.sun.tools.javac.comp.Flow$FlowAnalyzer.analyzeTree(Flow.java:1386)
        at jdk.compiler/com.sun.tools.javac.comp.Flow.analyzeTree(Flow.java:217)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1401)
        at jdk.compiler/com.sun.tools.javac.main.JavaCompiler.flow(JavaCompiler.java:1375)
        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:311)
        at jdk.compiler/com.sun.tools.javac.main.Main.compile(Main.java:170)
        at jdk.compiler/com.sun.tools.javac.Main.compile(Main.java:57)
        at jdk.compiler/com.sun.tools.javac.Main.main(Main.java:43)
        error: compilation failed

        ---------- BEGIN SOURCE ----------
        Please use the testcase on GitHub. I also uploaded the latest Guava-Jar used in this test case:

        import com.google.common.reflect.TypeToken;

        import java.util.List;
        import java.util.concurrent.CompletableFuture;
        import java.util.concurrent.ExecutorService;
        import java.util.function.Supplier;

        import static java.util.concurrent.CompletableFuture.supplyAsync;
        import static java.util.concurrent.Executors.newFixedThreadPool;
        import static java.util.concurrent.TimeUnit.MINUTES;

        public class TestCase {

          private final ExecutorService executorService = newFixedThreadPool(4);

          public void updateData() {
            try {
              final CompletableFuture<List<String>> completableFuture = supplyAsync(() -> asyncSupplier(() -> new MyRepository().getData(), new TypeToken<>() {}), executorService);

              CompletableFuture.allOf(completableFuture).get(3, MINUTES);
            }
            catch (Exception e) {
            }
          }

          private <T> List<T> asyncSupplier(final Supplier<List<T>> supplier, final TypeToken<T> typeToken) {
            final long start = System.currentTimeMillis();
            final List<T> ts = supplier.get();
            final long stop = System.currentTimeMillis();
            System.out.println("Took: " + (stop - start) + "ms for " + typeToken.getType().getTypeName());

            return ts;
          }

          private static final class MyRepository {

            public List<String> getData() {
              return List.of("");
            }
          }
        }

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

        CUSTOMER SUBMITTED WORKAROUND :
        none found

        FREQUENCY : always


        Attachments

          Issue Links

            Activity

              People

                vromero Vicente Arturo Romero Zaldivar
                webbuggrp Webbug Group
                Votes:
                0 Vote for this issue
                Watchers:
                8 Start watching this issue

                Dates

                  Created:
                  Updated:
                  Resolved: