RFR: 8169629: Annotations with lambda expressions cause AnnotationFormatError

Joel Borggrén-Franck jfranck at openjdk.java.net
Thu Apr 1 12:59:16 UTC 2021


On Wed, 31 Mar 2021 21:32:35 GMT, Joe Darcy <darcy at openjdk.org> wrote:

> The stricter checks added by
>     8035781: Improve equality for annotations
> in creating the proxy objects used to implement annotations has an unintended by-catch of rejecting annotation's whose type has, say, a field initialized with a lambda expression. While uncommon, it is legal code to have a field in an annotation type.
> 
> The updated checks skip over the sort of synthetic method used for the initialization.
> 
> Some different compilation tactics were used before and after nest mates, so the test includes compilation and testing under both situations.

Other than the potentially unused var, looks good to me.

src/java.base/share/classes/sun/reflect/annotation/AnnotationInvocationHandler.java line 497:

> 495:         Method currentMethod = null;
> 496:         for(Method method : memberMethods) {
> 497:             currentMethod = method;

I can't see any use of currentMethod, am I missing something?

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

Marked as reviewed by jfranck (Reviewer).

PR: https://git.openjdk.java.net/jdk/pull/3294


More information about the core-libs-dev mailing list