Accessing Annotations

Sebastian Sickelmann sebastian.sickelmann at
Thu Nov 10 06:14:23 PST 2011


i actually explore how i could implement
"Removing public fields without breaking binary compatibility"[0][1][2] 
inside of the vm.

In [0] i made an early prototype with annotations and 
class-weaving(changing) at load-time.
Now i want to shift this prototype to an inside-the-vm implementation.

The first place i ran into is the verifier. Here i need to return true 
if there is are methods
annotated with the new AccessorMethod-Annotation (which i made part of 
java/lang in my
private openjdk clone). Just for completeness: the methods parameters 
and return value must
fit to the expected field (said in other words "one get and one set 

I tried to hack on Reflection::verify_field_access and added something 
like this[3] to access the
methods and their annotations. I tried it in various ways (and after 
some errors on my side) i
get an typeArrayOop/typeArrayKlass which i think i can access the 
annotations. Asking the
typeArrayKlass for its name/external-name/dimensions answers [B/[B/1 
which seems to be an
one-dimensional byte-array. Is this the structure of the 
RuntimeVisibleAnnotation described in

Must i access its byte content and parse it, or have i missed an 
"annotationKlass" impl?

If i first must implement such a annotationKlass-implementation. Is 
there a good starting for this?

Some hints to get me working on this again would be fine.

Kind regards



More information about the hotspot-compiler-dev mailing list