This is similar to https://bugs.openjdk.java.net/browse/JDK-8203195, but that crash no longer occurs for the latest JDK 11u builds; this repro still crashes JDK 11 through JDK 14 with a similar stack trace:
=== T.java
import foo.B;
abstract class T {
void f(String m) {}
abstract String g(B<?> c);
void h() {
f(g(new B<>(Deprecated.class) {}));
}
}
=== foo/B.java
package foo;
import java.lang.annotation.Annotation;
public class B<T> {
protected B(Class<? extends Annotation> annotationType) {}
protected B(Annotation annotation) {}
}
===
```
$ javac -fullversion T.java foo/B.java
javac full version "11.0.13+8"
An exception has occurred in the compiler (11.0.13). 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:1235)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
```
It also crashes JDK 15 through 17 with a different stack trace:
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)
It doesn't crash JDK 18, and the crash in [15, 17] looks like https://bugs.openjdk.java.net/browse/JDK-8262095, which was fixed in 18.
=== T.java
import foo.B;
abstract class T {
void f(String m) {}
abstract String g(B<?> c);
void h() {
f(g(new B<>(Deprecated.class) {}));
}
}
=== foo/B.java
package foo;
import java.lang.annotation.Annotation;
public class B<T> {
protected B(Class<? extends Annotation> annotationType) {}
protected B(Annotation annotation) {}
}
===
```
$ javac -fullversion T.java foo/B.java
javac full version "11.0.13+8"
An exception has occurred in the compiler (11.0.13). 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:1235)
at jdk.compiler/com.sun.tools.javac.tree.JCTree$JCMethodInvocation.accept(JCTree.java:1634)
```
It also crashes JDK 15 through 17 with a different stack trace:
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)
It doesn't crash JDK 18, and the crash in [15, 17] looks like https://bugs.openjdk.java.net/browse/JDK-8262095, which was fixed in 18.
- duplicates
-
JDK-8225559 assertion error at TransTypes.visitApply
-
- Resolved
-
-
JDK-8225559 assertion error at TransTypes.visitApply
-
- Resolved
-
- relates to
-
JDK-8203195 Anonymous class type inference results in NPE
-
- Closed
-