SafeVarargs classfile encoding
Paul Benedict
pbenedict at apache.org
Fri Jan 21 10:54:30 PST 2011
Joe,
Will there be any language restriction on using @SafeVarargs for non-var arg
methods? After all, it's just an annotation so I wonder if normal annotation
rules apply or it has restricted syntax.
Paul
On Fri, Jan 21, 2011 at 12:50 PM, Joe Darcy <joe.darcy at oracle.com> 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.
>
> The SafeVarargs information is needed in the class file in some fashion
> to so that compilers can know to omit unchecked warnings that would
> otherwise have to be emitted. Additionally, having the information in
> the class file enables tools like findbugs to do additional checking on
> the operations of the SafeVarargs methods.
>
> Using an annotation to store this information avoids the need to add a
> new core reflection API to access it, Method.isSafeVarargs, etc.
>
> -Joe
>
> Rémi Forax wrote:
> > I wonder if encoding @SafeVarargs as a runtime annotation
> > in the classfile is a good idea. A runtime visible annotation is fat.
> >
> > In my opinion, @SafeVarargs should be an annotation with
> > retention SOURCE, translated by the compiler to an empty SafeVarargs
> > method attribute.
> >
> > Is there a use case where this annotation is needed at runtime ?
> >
> > Rémi
> >
> >
>
>
>
More information about the coin-dev
mailing list