RFR 7183985: Class.getAnnotation() throws an ArrayStoreException when the annotation class not present

Joel Borggrén-Franck joel.borggren.franck at gmail.com
Thu Jan 28 19:50:07 UTC 2016


Thanks for the update. I think it makes sense to expand testing
slightly, testing all three parsing clauses that you fixed, and for
all three of them also checking that a "thing" after the broken item
is parsed correctly.

But, the reason we didn't fix this the last two times we looked at it
(that I am aware of) is the compatibility story. In order to fix his
you need to figure out two things:

- Is this is a spec change, that is, can we get away with throwing an
AnnotationFormatError where we would now do? Should we clarify the

- Since this is a behaviorally incompatible change, how big is the
impact? This is of course a hard question to answer, but if one could
do a corpus analysis over a large code base and look for catches of
ArrayStoreExceptions when reflecting over annotations, that could be
useful. If it turns out that "a lot" of users have adopted to this
bug, perhaps it isn't worth fixing? On the other hand I can imagine
that this is so uncommon that no one catches either type of error.

I can't help you with the internal processes at Oracle anymore, but if
you are interested in doing a compatibility analysis I can make sure
it reaches the right people.


On Thu, Jan 7, 2016 at 7:59 PM, Liam Miller-Cushon <cushon at google.com> wrote:
> Hi Joel -
> On Tue, Jan 5, 2016 at 1:16 PM, Joel Borggrén-Franck
> <joel.borggren.franck at gmail.com> wrote:
>> I think you need to do skipMemberValue the correct number of times so
>> that the cursor in buf is correct, or?
> Thanks for the catch. I added your test case, and the exception proxy is now
> stored and returned after the entire array is read.
>> Also, in MissingArrayElementTest, why not just rethrow t?
> Done.
> Thanks!

More information about the core-libs-dev mailing list