API Updates: 8191116: [Nestmates] Update core reflection, MethodHandle and varhandle APIs to allow for nestmate access
Paul Sandoz
paul.sandoz at oracle.com
Tue Feb 13 16:53:22 UTC 2018
> On Feb 12, 2018, at 6:51 PM, David Holmes <david.holmes at oracle.com> wrote:
>>> But I, for one, prefer a "user pays" scheme over an "everyone pays" scheme (which is what disallowing duplicates would also be).
>> It’s an awkward situation, experience suggests this type of thing bites back later on, so my inclination is to take the hit in the JDK and not return dups. The implementation might be able to cache information on the internal ReflectionData class.
>
> Please see John's response on this:
>
> http://mail.openjdk.java.net/pipermail/valhalla-spec-experts/2017-December/000465.html
>
Thanks for the context. You may be surprised to learn that i still don’t agree :-) so i will just state my objection more concisely and move on:
I don’t think as specified the method serves developers very well for the common use-case of iterating over the nest mates and performing actions with side-effects. A developer will have to write defensive code or, more likely, write buggy code that will blow up in the rare case a classfile contain duplicates e.g. generated by something other than javac. That rare case may be hard to track down and expensive to fix.
Paul.
More information about the valhalla-spec-observers
mailing list