I guess you'll have to be a bit more specific, as to what you want to achieve. Do you want to
* annotate a method on a jython subclass (parent class is java)?
* access the annotation of a method (or class) declared in the java superclass (or somewhere else).

The first case is probably not solved yet (at least according to the bugtracker [1], that means that there's no possibility to declare annotations in your Jython code

The second case can be achieved with generics, just as you would in Java (your annotations have to be declared with RetentionPolicy.RUNTIME). Check [2] for a good summary.

Summary: Declaration inside Jython is probably not going to work, Access at runtime can be achieved in the same way as in Java, through Reflection (it's a Java class, not even a Jython class).


[1] http://bugs.jython.org/issue1080
[2] http://www.eclipse.org/aspectj/doc/released/adk15notebook/annotations.html#annotations-inJava5

On Sun, May 31, 2009 at 4:02 PM, James Deng <jtdeng@gmail.com> wrote:
Hi all
As title, How to use java annotations in a jython subclass?
I am using Jython 2.5rc3 on jdk 1.6
BRs//James Deng

Register Now for Creativity and Technology (CaT), June 3rd, NYC. CaT
is a gathering of tech-side developers & brand creativity professionals. Meet
the minds behind Google Creative Lab, Visual Complexity, Processing, &
iPhoneDevCamp as they present alongside digital heavyweights like Barbarian
Group, R/GA, & Big Spaceship. http://p.sf.net/sfu/creativitycat-com
Jython-users mailing list