[JSR308] Dynamic proxy classes

Joe Darcy Joe.Darcy at Sun.COM
Sun May 20 18:43:39 EDT 2007

Annotations that are @Inherited 
are inherited by subclasses.  Annotations on interfaces are *not* 
inherited.  Therefore, since all proxy classes extend 
java.lang.reflect.Proxy and implement some number of interfaces, the 
annotations on the interfaces should not appear on the proxy class.

The single inheritance of annotations from superclasses is a fundamental 
design decision of JSR 175 and I don't think it can be revisited.

Annotations on entities inside a class (methods, constructors, etc.) are 
not inherited.


Michael Ernst wrote:
> A dynamic proxy class is a class (created by java.lang.reflect.Proxy) that
> is created at run time and that implements a list of interfaces (that are
> also given at run time). What annotations should appear on the methods of
> the proxy class? Arguably, whichever annotations were on the methods of the
> given interfaces (when a method appears more than once, whatever
> annotations are on the method whose interface appears first in the
> list). But whether an annotation should be transferred to a proxy class may
> depend on the annotation itself; should there be a way to indicate how it
> should be treated? (Is this better handled in JSR 305?) How does Java
> handle this currently? Do we believe the current behavior is incorrect and
> needs to be amended in JSR 308?
>                     -Mike
> _______________________________________________
> JSR308 mailing list
> JSR308 at lists.csail.mit.edu
> https://lists.csail.mit.edu/mailman/listinfo/jsr308

More information about the JSR308 mailing list