RFR: 8325433: Type annotations on primitive types are not linked

Guoxiong Li gli at openjdk.org
Mon Mar 11 06:44:53 UTC 2024


On Sun, 10 Mar 2024 20:19:44 GMT, Chen Liang <liach at openjdk.org> wrote:

> Please review this patch that fixes the issue where type annotations on primitive types are not linked.
> 
> Tested with file https://cr.openjdk.org/~liach/8325433-arrayanno/ArrayAnno.java
> 
> import java.lang.annotation.*;
> 
> public class ArrayAnno {
> 	@Retention(RetentionPolicy.RUNTIME)
> 	@Target(ElementType.TYPE_USE)
> 	@Documented
> 	public @interface Anno { int value(); }
> 
> 	public void method(@Anno(1) int @Anno(2) [] @Anno(3) [] arg) {}
> 	public void method(@Anno(1) String @Anno(2) [] @Anno(3) [] arg) {}
> }
> 
> JDK 21: https://cr.openjdk.org/~liach/8325433-arrayanno/old/ArrayAnno.html
> This patch: https://cr.openjdk.org/~liach/8325433-arrayanno/new/ArrayAnno.html
> 
> Note that a bug within javac causes the annotations to become `@Anno(1) String @Anno(3) [] @Anno(2) []` in the output files; this bug also affects output class files so I assume this is a bug within javac's tree building. (Intersting, the buggy javadoc output was copied wholesale in the original `TestTypeAnnotations` output for `array2Deep` cases, but no one paid attention to it)

Changes requested by gli (Committer).

test/langtools/jdk/javadoc/doclet/testTypeAnnotations/typeannos/Fields.java line 72:

> 70: 
> 71:     public final @FldA int primitive = 0;
> 72:     public final @FldA int @FldB [] primitiveArray1Deep = null;

These two fields have not been verified?

test/langtools/jdk/javadoc/doclet/testTypeAnnotations/typeannos/MethodReturnType.java line 54:

> 52: 
> 53:     @MRtnA int primitive() { return 0; }
> 54:     @MRtnA int @MRtnB [] primitiveArray1Deep() { return null; }

These two fields have not been verified?

-------------

PR Review: https://git.openjdk.org/jdk/pull/18179#pullrequestreview-1927016081
PR Review Comment: https://git.openjdk.org/jdk/pull/18179#discussion_r1519212039
PR Review Comment: https://git.openjdk.org/jdk/pull/18179#discussion_r1519212869


More information about the javadoc-dev mailing list