RFR: JDK-8323684: TypeMirror.{getAnnotationsByType, getAnnotation} return uninformative results [v2]

Jonathan Gibbons jjg at openjdk.org
Thu Jan 18 00:13:25 UTC 2024


On Thu, 18 Jan 2024 00:09:47 GMT, Joe Darcy <darcy at openjdk.org> wrote:

>> Initial implementation to make TypeMirror.{getAnnotationsByType, getAnnotation} functional; tests to follow.
>
> Joe Darcy has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains four additional commits since the last revision:
> 
>  - Merge branch 'master' into JDK-8323684
>  - Appease jcheck.
>  - Add regression tests.
>  - JDK-8323684: TypeMirror.{getAnnotationsByType, getAnnotation} return uninformative results

test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java line 92:

> 90:     PrintWriter out;
> 91:     boolean verbose = true;
> 92:     static Map<String, Class<? extends Annotation>> nameToAnnotation;

this looks questionable ... a mutable static field

test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java line 115:

> 113:                           new NameToAnnotationEntry("BasicAnnoTests.TB",   BasicAnnoTests.TB.class),
> 114:                           new NameToAnnotationEntry("BasicAnnoTests.TC",   BasicAnnoTests.TC.class),
> 115:                           new NameToAnnotationEntry("BasicAnnoTests.TCs",  BasicAnnoTests.TCs.class));

You could maybe simplify this by obtaining the name from the class parameter.

test/langtools/tools/javac/processing/model/type/BasicAnnoTests.java line 318:

> 316:     /**
> 317:      * Verify that an annotation mirror returned by
> 318:      * getAnnotatinMirrors() has a matching annotation from

spelling typo: getAnnotatinMirrors

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

PR Review Comment: https://git.openjdk.org/jdk/pull/17410#discussion_r1456639799
PR Review Comment: https://git.openjdk.org/jdk/pull/17410#discussion_r1456644682
PR Review Comment: https://git.openjdk.org/jdk/pull/17410#discussion_r1456640756


More information about the compiler-dev mailing list