RFR(M): 8057043: Type annotations not retained during class redefine / retransform

Andreas Eriksson andreas.eriksson at oracle.com
Thu Oct 9 13:21:05 UTC 2014


Hi all,

Please review this patch to RedefineClasses to allow type annotations to 
be preserved.

Summary:
During redefine / retransform class the constant pool indexes can change.
Since annotations have indexes into the constant pool these indexes need 
to be rewritten.
This is already done for regular annotations, but not for type annotations.
This patch adds code to add this rewriting for the type annotations as well.
The patch also contains minor changes to ClassFileReconstituter, to make 
sure that type annotations are preserved during a redefine / retransform 
class operation.
It also has a test that uses asm to change constant pool indexes through 
a retransform, and then verifies that type annotations are preserved.

Detail:
A type annotation struct consists of some target information and a type 
path, followed by a regular annotation struct.
Constant pool indexes are only present in the regular annotation struct.
The added code skips over the type annotation specific parts, then calls 
previously existing code to rewrite constant pool indexes in the regular 
annotation struct.
Please see the Java SE 8 Ed. VM Spec. section 4.7.20 for more info about 
the type annotation struct.

JPRT with the new test passes without failures on all platforms.

Webrev:
http://cr.openjdk.java.net/~aeriksso/8057043/webrev.00/

Bug:
https://bugs.openjdk.java.net/browse/JDK-8057043

Regards
Andreas


More information about the hotspot-dev mailing list