-
Bug
-
Resolution: Fixed
-
P3
-
13, 21
-
b23
Issue | Fix Version | Assignee | Priority | Status | Resolution | Resolved In Build |
---|---|---|---|---|---|---|
JDK-8323370 | 21.0.3-oracle | Liam Miller-Cushon | P3 | Resolved | Fixed | b01 |
JDK-8319885 | 21.0.2 | Liam Miller-Cushon | P3 | Closed | Fixed | b07 |
JDK-8321934 | 17.0.11 | Liam Miller-Cushon | P3 | Resolved | Fixed | b01 |
JDK-8322203 | 11.0.23 | Liam Miller-Cushon | P3 | Resolved | Fixed | b01 |
=== ./test/B.java
abstract class B extends A {}
=== ./test/A.java
import java.lang.annotation.ElementType;
import java.util.List;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
@Target(ElementType.TYPE_USE)
@Retention(RetentionPolicy.RUNTIME)
@interface TypeAnnotation {}
abstract class A implements List<@TypeAnnotation String> {}
=== ./plugin/p/P.java
package p;
import com.sun.source.util.JavacTask;
import com.sun.source.util.Plugin;
import com.sun.source.util.TaskEvent;
import com.sun.source.util.TaskListener;
import javax.lang.model.element.TypeElement;
import javax.lang.model.type.DeclaredType;
import javax.lang.model.type.TypeMirror;
public class P implements Plugin {
@Override
public String getName() {
return "P";
}
@Override
public void init(JavacTask javacTask, String... strings) {
javacTask.addTaskListener(
new TaskListener() {
@Override
public void finished(TaskEvent e) {
if (e.getKind() != TaskEvent.Kind.ENTER) {
return;
}
TypeElement b = javacTask.getElements().getTypeElement("B");
for (TypeMirror i :
((TypeElement) ((DeclaredType) b.getSuperclass()).asElement()).getInterfaces()) {
System.err.printf("%s %s\n", i, i.getAnnotationMirrors());
}
}
});
}
}
=== ./plugin/module-info.java
module p {
requires transitive jdk.compiler;
provides com.sun.source.util.Plugin with p.P;
}
===
$ javac $(find plugin -name '*.java')
# when both compilation units are compiled from source, the type annotations are visible
$ javac --processor-module-path plugin -Xplugin:P test/A.java test/B.java
java.util.List<@TypeAnnotation java.lang.String>
java.util.List<@TypeAnnotation java.lang.String>
# when 'A' is loaded from the classpath, the type annotations on its supertype are not visible
$ javac --processor-module-path plugin -Xplugin:P -classpath test test/B.java
java.util.List<java.lang.String>
- backported by
-
JDK-8321934 type annotations are not visible to javac plugins across compilation boundaries
- Resolved
-
JDK-8322203 type annotations are not visible to javac plugins across compilation boundaries
- Resolved
-
JDK-8323370 type annotations are not visible to javac plugins across compilation boundaries
- Resolved
-
JDK-8319885 type annotations are not visible to javac plugins across compilation boundaries
- Closed
- csr for
-
JDK-8323093 type annotations are not visible to javac plugins across compilation boundaries
- Closed
- duplicates
-
JDK-8306815 Type argument annotations are not read from byte code by annotation processor
- Closed
- is cloned by
-
JDK-8341779 [REDO BACKPORT] type annotations are not visible to javac plugins across compilation boundaries
- Open
- relates to
-
JDK-8226216 parameter modifiers are not visible to javac plugins across compilation boundaries
- Resolved
-
JDK-8337998 CompletionFailure in getEnclosingType attaching type annotations
- Resolved
-
JDK-8320001 javac crashes while adding type annotations to the return type of a constructor
- Closed
-
JDK-8336942 Improve test coverage for class loading elements with annotations of different retentions
- Resolved
-
JDK-8322641 javac fails with "Unable to implement <class> method".
- Closed
-
JDK-8322883 [BACKOUT] 8225377: type annotations are not visible to javac plugins across compilation boundaries
- Closed
- links to
-
Commit openjdk/jdk11u-dev/bd5ef736
-
Commit openjdk/jdk17u-dev/3a2bf8e5
-
Commit openjdk/jdk21u/e00c9bb2
-
Commit openjdk/jdk/de6667cf
-
Review openjdk/jdk11u-dev/2272
-
Review openjdk/jdk17u-dev/1952
-
Review openjdk/jdk21u/329
-
Review openjdk/jdk/16407