Skip to content

8334756: javac crashed on call to non-existent generic method with explicit annotated type arg #1859

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -1018,7 +1018,11 @@ private Attribute.TypeCompound toTypeCompound(Attribute.Compound a, TypeAnnotati
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 + "}");
Expand Down
Original file line number Diff line number Diff line change
@@ -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);
}
}
Original file line number Diff line number Diff line change
@@ -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