RFR: 8268788: Annotations with lambda expressions can still cause AnnotationFormatError

Sergei Ustimenko github.com+5709644+fdesu at openjdk.java.net
Tue Jul 6 08:22:52 UTC 2021


On Wed, 30 Jun 2021 20:08:27 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.

Hi, I would appreciate if anyone could take a look and let me know their opinion. Removing the `parameters count  == 0` condition from the sun.reflect.annotation.AnnotationInvocationHandler:507 fixes the problem, though I'm not entirely sure if it brings some risks with it.

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

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


More information about the core-libs-dev mailing list