mirror of
https://github.com/openjdk/jdk.git
synced 2026-01-28 12:09:14 +00:00
8334756: javac crashed on call to non-existent generic method with explicit annotated type arg
Reviewed-by: abimpoudis
This commit is contained in:
parent
2ddaa46054
commit
abcd23f4d6
@ -1018,7 +1018,11 @@ public class TypeAnnotations {
|
||||
if (!invocation.typeargs.contains(tree)) {
|
||||
return TypeAnnotationPosition.unknown;
|
||||
}
|
||||
MethodSymbol exsym = (MethodSymbol) TreeInfo.symbol(invocation.getMethodSelect());
|
||||
Symbol exsym = TreeInfo.symbol(invocation.getMethodSelect());
|
||||
if (exsym.type.isErroneous()) {
|
||||
// bail out, don't deal with erroneous types which would be reported anyways
|
||||
return TypeAnnotationPosition.unknown;
|
||||
}
|
||||
final int type_index = invocation.typeargs.indexOf(tree);
|
||||
if (exsym == null) {
|
||||
throw new AssertionError("could not determine symbol for {" + invocation + "}");
|
||||
|
||||
@ -0,0 +1,22 @@
|
||||
/*
|
||||
* @test /nodynamiccopyright/
|
||||
* @bug 8334756
|
||||
* @summary javac crashes on call to non-existent generic method with explicit annotated type arg
|
||||
* @compile/fail/ref=CrashOnNonExistingMethodTest.out -XDrawDiagnostics -XDdev CrashOnNonExistingMethodTest.java
|
||||
*/
|
||||
|
||||
import static java.lang.annotation.ElementType.TYPE_USE;
|
||||
import java.lang.annotation.Target;
|
||||
|
||||
class CrashOnNonExistingMethodTest {
|
||||
@Target(TYPE_USE)
|
||||
@interface Nullable {}
|
||||
|
||||
static <T extends @Nullable Object> T identity(T t) {
|
||||
return t;
|
||||
}
|
||||
|
||||
static void test() {
|
||||
CrashOnNonExistingMethodTest.<@Nullable Object>nonNullIdentity(null);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,2 @@
|
||||
CrashOnNonExistingMethodTest.java:20:37: compiler.err.cant.resolve.location.args.params: kindname.method, nonNullIdentity, java.lang.Object, compiler.misc.type.null, (compiler.misc.location: kindname.class, CrashOnNonExistingMethodTest, null)
|
||||
1 error
|
||||
Loading…
x
Reference in New Issue
Block a user