RFR: 8268788: Annotations with lambda expressions can still cause AnnotationFormatError [v4]

Sergei Ustimenko github.com+5709644+fdesu at openjdk.java.net
Wed Aug 25 18:00:27 UTC 2021


On Wed, 25 Aug 2021 17:53:52 GMT, Sergei Ustimenko <github.com+5709644+fdesu at openjdk.org> wrote:

>> Change #3294 helps to avoid `AnnotaionFormatException` in `sun.reflect.annotation.AnnotationInvocationHandler.validateAnnotationMethods`. While it fixes the case with e.g. `Runnable`  that generates the synthetic method without parameters, validation still fails on synthetic methods that have parameters e.g. `Function`, `BiFunction`, etc.
>> 
>> This change removes the restriction on parameters count to be zero i.e. lambdas with parameters
>> would be skipped from validation.
>
> Sergei Ustimenko has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains two commits:
> 
>  - 8268788: Filter out synthetic methods from the member methods computation
>  - 8268788: Annotations with lambda expressions can still cause AnnotationFormatError

Hi,
I've reworked code in few places a bit. As we skip `synthetic` methods in couple
of places in AnnotationInvocationHandler anyway: 
1. In `equalsImpl` while going method-by-method, comparing them
2. In `validateAnnotationMethods`

These two also work together to store methods in the `memberMethods` field.
Then I though it makes sense to skip adding synthetic methods to the field 
altogether.

What do you think, does it makes sense? Thanks for taking a look!

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

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


More information about the core-libs-dev mailing list