SafeVarargs classfile encoding (original) (raw)

Joe Darcy joe.darcy at oracle.com
Fri Jan 21 11:34:45 PST 2011


Rémi Forax wrote:

On 01/21/2011 07:50 PM, Joe Darcy wrote:

Hi Rémi.

A few comments, in the entirety of the "jdk" repository, there were a total of five methods where it was appropriate to add this annotation, which is not a very high density! For Coin, to keep the features small, we're avoiding JVM changes and defining a new attribute is a JVM changes of sorts. Here is the JVM spec change:

[sni]

The size of the JVM change is not the problem; the fact that potentially all class file consuming tools would need to know about the attribute is. Additionally, this would be a new kind of side-effect of annotating a method.

Using an annotation to store this information avoids the need to add a new core reflection API to access it, Method.isSafeVarargs, etc. Why SafeVarargs need to be visible using reflection API ?

Why should the information be excluded? This annotation is a statement about the semantics of the method.

By example, Synthetic attribute is not visible using reflection API.

Some synthetic information is exposed in core reflection:

http://download.java.net/jdk7/docs/api/java/lang/Class.html#isSynthetic() http://download.java.net/jdk7/docs/api/java/lang/reflect/Constructor.html#isSynthetic() http://download.java.net/jdk7/docs/api/java/lang/reflect/Method.html#isSynthetic() http://download.java.net/jdk7/docs/api/java/lang/reflect/Field.html#isSynthetic()

-Joe



More information about the coin-dev mailing list