RFR: JDK-8054987: (reflect) Add sharing of annotations between instances of Executable

Joe Darcy joe.darcy at oracle.com
Thu Aug 14 01:05:02 UTC 2014

Hi Joel,

Does your changeset alter the support (or non-support) of redefining an 


On 08/13/2014 05:23 AM, Joel Borggren-Franck wrote:
> Hi all,
> Cleaning out the patch queue, I found this small patch that adds sharing
> of conceptually immutable annotation maps between instances of
> Executable representing the same executable.
> In short, Method/Constructor contain one bit of mutable state, if they
> have been set accessible or not. Core Reflection keeps a 'root' instance
> of an executable and copies it whenever you call
> get(Declared){Method|Constructor}. When using an Executable to look at annotations each copy
> you query for annotations, for exampel m1.getAnnotations(), gets its own
> LinkedHashMap containing the annotations. The map is then flattned and
> handed out to the client as a newly allocated array. This patch queries
> the root method for its map thus sharing annotation instances. It still
> hands out a unique array for each invocation but the Map and the
> instances are shared.
> Webrev: http://cr.openjdk.java.net/~jfranck/8054987/webrev.00/
> Bug: https://bugs.openjdk.java.net/browse/JDK-8054987
> cheers
> /Joel

More information about the core-libs-dev mailing list