Details
-
Bug
-
Resolution: Fixed
-
P3
-
11, 12.0.1, 13
-
b05
-
generic
-
generic
Backports
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8281644 | 17.0.4-oracle | Vicente Arturo Romero Zaldivar | P3 | Resolved | Fixed | b01 |
JDK-8279890 | 17.0.3 | Liam Miller-Cushon | P3 | Resolved | Fixed | b01 |
JDK-8281394 | 11.0.16-oracle | Vicente Arturo Romero Zaldivar | P3 | Resolved | Fixed | b01 |
JDK-8280102 | 11.0.15 | Liam Miller-Cushon | P3 | Resolved | Fixed | b01 |
Description
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
- backported by
-
JDK-8279890 assertion error at TransTypes.visitApply
- Resolved
-
JDK-8280102 assertion error at TransTypes.visitApply
- Resolved
-
JDK-8281394 assertion error at TransTypes.visitApply
- Resolved
-
JDK-8281644 assertion error at TransTypes.visitApply
- Resolved
- duplicates
-
JDK-8278586 Anonymous class type inference crash with protected constructors
- Closed
-
JDK-8247604 AssertionError: Incorrect number of argument
- Closed
-
JDK-8273647 Compiling a SimpleTypeVisitor8 anonymous class inside a lambda crashes javac
- Closed
-
JDK-8265497 AssertionError when compiling java.base
- Resolved
-
JDK-8278586 Anonymous class type inference crash with protected constructors
- Closed
-
JDK-8279303 Can not use '<>' with anonymous class
- Closed
- relates to
-
JDK-8265497 AssertionError when compiling java.base
- Resolved
- links to
-
Commit openjdk/jdk11u-dev/e7b89f7d
-
Commit openjdk/jdk17u-dev/75f87528
-
Commit openjdk/jdk/de61328d
-
Review openjdk/jdk11u-dev/725
-
Review openjdk/jdk17u-dev/17
-
Review openjdk/jdk/4647