Skip to content

Commit

Permalink
8334757: AssertionError: Missing type variable in where clause
Browse files Browse the repository at this point in the history
Reviewed-by: jlahoda, vromero
Backport-of: babf6df
  • Loading branch information
cushon committed Jul 9, 2024
1 parent ae10055 commit ca37a48
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -184,6 +184,9 @@ protected void preprocessArgument(Object arg) {
if (arg instanceof Type type) {
preprocessType(type);
}
else if (arg instanceof JCDiagnostic.AnnotatedType type) {
preprocessType(type.type());
}
else if (arg instanceof Symbol symbol) {
preprocessSymbol(symbol);
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
/*
* @test /nodynamiccopyright/
* @bug 8334757
* @compile/fail/ref=CantAnnotateClassWithTypeVariable.out -XDrawDiagnostics CantAnnotateClassWithTypeVariable.java
*/

import java.lang.annotation.ElementType;
import java.lang.annotation.Target;

public class CantAnnotateClassWithTypeVariable {
@Target(ElementType.TYPE_USE)
@interface TA {}

static class A {
static class B<T> {}
}

<T> @TA A.B<T> f() {}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
CantAnnotateClassWithTypeVariable.java:18:14: compiler.err.type.annotation.inadmissible: (compiler.misc.type.annotation.1: @CantAnnotateClassWithTypeVariable.TA), CantAnnotateClassWithTypeVariable.A, @CantAnnotateClassWithTypeVariable.TA CantAnnotateClassWithTypeVariable.A.B<T>
1 error

1 comment on commit ca37a48

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.