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
  • Loading branch information
cushon committed Jul 8, 2024
1 parent 3733fe3 commit babf6df
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

3 comments on commit babf6df

@cushon
Copy link
Contributor Author

@cushon cushon commented on babf6df Jul 8, 2024

Choose a reason for hiding this comment

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

/backport jdk:jdk23

@openjdk
Copy link

@openjdk openjdk bot commented on babf6df Jul 8, 2024

Choose a reason for hiding this comment

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

@cushon the backport was successfully created on the branch backport-cushon-babf6df7-jdk23 in my personal fork of openjdk/jdk. To create a pull request with this backport targeting openjdk/jdk:jdk23, just click the following link:

➡️ Create pull request

The title of the pull request is automatically filled in correctly and below you find a suggestion for the pull request body:

Hi all,

This pull request contains a backport of commit babf6df7 from the openjdk/jdk repository.

The commit being backported was authored by Liam Miller-Cushon on 8 Jul 2024 and was reviewed by Jan Lahoda and Vicente Romero.

Thanks!

If you need to update the source branch of the pull then run the following commands in a local clone of your personal fork of openjdk/jdk:

$ git fetch https://github.com/openjdk-bots/jdk.git backport-cushon-babf6df7-jdk23:backport-cushon-babf6df7-jdk23
$ git checkout backport-cushon-babf6df7-jdk23
# make changes
$ git add paths/to/changed/files
$ git commit --message 'Describe additional changes made'
$ git push https://github.com/openjdk-bots/jdk.git backport-cushon-babf6df7-jdk23

⚠️ @cushon You are not yet a collaborator in my fork openjdk-bots/jdk. An invite will be sent out and you need to accept it before you can proceed.

@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.