RFR: 8169629: Annotations with lambda expressions cause AnnotationFormatErrorr

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

RFR: 8169629: Annotations with lambda expressions cause AnnotationFormatErrorr

Joe Darcy-2
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.

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

Commit messages:
 - 8169629: Annotations with lambda expressions cause AnnotationFormatErro

Changes: https://git.openjdk.java.net/jdk/pull/3294/files
 Webrev: https://webrevs.openjdk.java.net/?repo=jdk&pr=3294&range=00
  Issue: https://bugs.openjdk.java.net/browse/JDK-8169629
  Stats: 29 lines in 2 files changed: 25 ins; 0 del; 4 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3294.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3294/head:pull/3294

PR: https://git.openjdk.java.net/jdk/pull/3294
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8169629: Annotations with lambda expressions cause AnnotationFormatError

Joel Borggrén-Franck-3
On Wed, 31 Mar 2021 21:32:35 GMT, Joe Darcy <[hidden email]> 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
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8169629: Annotations with lambda expressions cause AnnotationFormatError [v2]

Joe Darcy-2
In reply to this post by Joe Darcy-2
> 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.

Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:

  Respond to review feedback.

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

Changes:
  - all: https://git.openjdk.java.net/jdk/pull/3294/files
  - new: https://git.openjdk.java.net/jdk/pull/3294/files/818df21d..db79e3c8

Webrevs:
 - full: https://webrevs.openjdk.java.net/?repo=jdk&pr=3294&range=01
 - incr: https://webrevs.openjdk.java.net/?repo=jdk&pr=3294&range=00-01

  Stats: 2 lines in 1 file changed: 0 ins; 2 del; 0 mod
  Patch: https://git.openjdk.java.net/jdk/pull/3294.diff
  Fetch: git fetch https://git.openjdk.java.net/jdk pull/3294/head:pull/3294

PR: https://git.openjdk.java.net/jdk/pull/3294
Reply | Threaded
Open this post in threaded view
|

Re: RFR: 8169629: Annotations with lambda expressions cause AnnotationFormatError [v2]

Joe Darcy-2
In reply to this post by Joel Borggrén-Franck-3
On Thu, 1 Apr 2021 12:36:56 GMT, Joel Borggrén-Franck <[hidden email]> wrote:

>> Joe Darcy has updated the pull request incrementally with one additional commit since the last revision:
>>
>>   Respond to review feedback.
>
> 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?

Remnant of a second fix I pulled out for separate handling; I'll remove before pushing. Thanks.

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

PR: https://git.openjdk.java.net/jdk/pull/3294
Reply | Threaded
Open this post in threaded view
|

Integrated: 8169629: Annotations with lambda expressions cause AnnotationFormatError

Joe Darcy-2
In reply to this post by Joe Darcy-2
On Wed, 31 Mar 2021 21:32:35 GMT, Joe Darcy <[hidden email]> 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.

This pull request has now been integrated.

Changeset: 328e9514
Author:    Joe Darcy <[hidden email]>
URL:       https://git.openjdk.java.net/jdk/commit/328e9514
Stats:     27 lines in 2 files changed: 23 ins; 0 del; 4 mod

8169629: Annotations with lambda expressions cause AnnotationFormatError

Reviewed-by: jfranck

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

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