Request for review: 8004698: Implement Core Reflection for Type Annotations
peter.levart at gmail.com
Sat Jan 19 17:11:48 UTC 2013
I see, there is a dilema how to cache type annotations. To satisfy
single-annotation-returning methods and repeating annotation logic, a
HashMap would be a logical choice, but it has much bigger footprint than
simple arrays of annotations...
I experimented with an idea of using a special purpose immutable Map
This is just a preview. I still have to create some tests to see how it
compares to HashMap. Being an immutable wrapper for a single array of
annotations it has a nice feature that a reference to it can be passed to
other threads via a data race with no danger of data inconsistency, which
simplifies caching mechanisms and helps scalability.
Might even be a space-saving replacement for existing HashMaps of
annotations. Depending on performance, of course.
What do you think? Is it worth pursuing this further?
On Jan 17, 2013 5:24 PM, "Joel Borggrén-Franck" <joel.franck at oracle.com>
> Here is a webrev for core reflection support for type annotations:
> This code is based on the tl/jdk repository, but in order to run the tests
> you need a javac with type annotations support and also a recent copy of
> the VM that includes this change set:
> http://hg.openjdk.java.net/hsx/hotspot-main/hotspot/rev/35431a769282(This also means this code can't be pushed until all supporting pieces are
> in place.)
> Type annotations are still a bit of a moving target so there will be
> follow up work on this. There is no caching of annotations in this version
> and I am not sure how we want to do the space/time trade of for type
More information about the core-libs-dev