RFR[9]: 8158510: Add test cases to validate Annotation

Paul Sandoz paul.sandoz at oracle.com
Fri Jul 1 09:42:33 UTC 2016

Hi Shilpi,

There is more going on here than just the test since you have modified the annotation processing to throw an ISE for an annotation type that contains one or more methods that do not define elements. That behaviour might be too restrictive.

This is a grey area and implementation specific but i would tend to be cautious and avoid changing the current behaviour. Note that the original issue was due to javac adding a synthetic de-sugared method for a lambda. We don’t know if other byte code generators might do something different.

So my recommendation is to limit the testing to the current set of possible failures.


> On 1 Jul 2016, at 10:15, shilpi.rastogi at oracle.com wrote:
> Hi All,
> Please review https://bugs.openjdk.java.net/browse/JDK-8158510 <https://bugs.openjdk.java.net/browse/JDK-8158510>
> Problem: How to validate annotation, as javac does not allow us to write wrong annotation so how should we test valid annotation at runtime?
> http://cr.openjdk.java.net/~srastogi/8158510/webrev.00/ <http://cr.openjdk.java.net/~srastogi/8158510/webrev.00/>
> Solution: To test this i used ASM tool and modified the classfile with wrong annotation (not allowed at javac level) and wrote test cases.
> Thanks,
> Shilpi

More information about the core-libs-dev mailing list