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

Chen Liang liach at openjdk.org
Sun Mar 10 20:25:12 UTC 2024


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)

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

Commit messages:
 - 8325433: Type annotations on primitive types are not linked

Changes: https://git.openjdk.org/jdk/pull/18179/files
 Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=18179&range=00
  Issue: https://bugs.openjdk.org/browse/JDK-8325433
  Stats: 61 lines in 5 files changed: 52 ins; 0 del; 9 mod
  Patch: https://git.openjdk.org/jdk/pull/18179.diff
  Fetch: git fetch https://git.openjdk.org/jdk.git pull/18179/head:pull/18179

PR: https://git.openjdk.org/jdk/pull/18179


More information about the javadoc-dev mailing list