I've been looking into 1.5 support a bit lately, and I think there are
a number of changes we will need to make to the VM layer.  Some of
them look quite invasive :-(, but I thought I'd start with a
relatively simple one.

1.5 adds some new methods to the reflection classes, e.g.,
isVarArgs().  These simply test a bit in the modifiers of the member,
but these new modifier bits (AIUI) should not be returned by
getModifiers().

Right now getModifiers() is native in our VM layer, e.g. from Method:

  public native int getModifiers();

I propose changing the name of the native method to
getModifiersInternal(), making it private, and having it return all
the bits that are given in the class file.

Then we would rewrite getModifiers in Java.  It would call
getModifiersInternal and strip the appropriate bits.

Then new things such as isVarArgs or isSynthetic are also trivial to
write in terms of getModifiersInternal.

This is a breaking change so would require some buy-in from VM
developers.  Note however that as it is local to Method (and Field and
Constructor), and since VMs typically copy these in their entirety, it
probably would not result in actual breakage per se.  Instead it would
require an update of the code in the VMs in order to make the new
feature available.

Any comments?


FWIW I've got a patch to make this change, which implements the new
reflection predicates and also the new toGenericString methods.


We'll actually need more additions to the VM layer in the reflection
code, for annotations.  I think I will hold off on this for a while,
as I think it will require code that is only available on the generics
branch, and we wanted to keep the VM interface the same on both the
trunk and the branch.

Tom

Reply via email to