RFR JDK-8011940 : java.lang.Class.getAnnotations() always enters synchronized method

Peter Levart peter.levart at gmail.com
Mon Aug 12 15:34:06 UTC 2013

On 08/12/2013 03:19 PM, Paul Sandoz wrote:
>> >- inherited annotations. They are combined with declared annotations in a Map that is cached in the AnnotationData. If superclass is redefined, the inherited annotations are not invalidated. Unless the VM increments classRedefinedCount for the redefined class and all currently loaded subclasses. I don't know if this is the case.
> Same here. There is a comment which implies it does get updated:
> 2389     // Incremented by the VM on each call to JVM TI RedefineClasses()
> 2390     // that redefines this class or a superclass.
> 2391     private volatile transient int classRedefinedCount = 0;

Oh, I missed that. Thanks for pointing it out. There's no problem for 
inherited annotations then. But if a default in the annotation 
declaration changes, then it only affects annotations that are 
constructed after that...

Regards, Peter

More information about the core-libs-dev mailing list