Java inherited annotations

Dear colleagues.

There is some inconvenience concerning using of java annotations. I annotated some interfaces and methods within them. Then I made some derived interfaces and classes and tried to get my annotations here. Unfortunately annotations whose had been made for base classes were inaccessible from derived classes. It was very critical for me because I used some automated wrappers over my classes and couldn抰 add annotations manually. Anyway as a result the library was elaborated that helps to solve inheritance task.

The annotations being inherited are of classes, interfaces, or their methods. It uses the consistent inheritance model: inheritance proceeds only if the same annotation is not present on the same element (class, interface or method) within superclasses or superinterfaces. Annotations can be overridden within descendants. The library is open-source and free and can be downloaded from here:

http://www.fusionsoft-online.com/annotation.php.

Will be great to hear your opinion here?

Best Regards,

Michael.

[1078 byte] By [fusionsoft-onlinea] at [2007-11-27 6:57:19]
# 1

> Dear colleagues.

> There is some inconvenience concerning using of java

> annotations. I annotated some interfaces and methods

> within them. Then I made some derived interfaces and

> classes and tried to get my annotations here.

> Unfortunately annotations whose had been made for

> base classes were inaccessible from derived classes.

Your document's assertions that the platform does not support inheriting annotations are false. Indeed, the @Inherited annotation, included as part of JSR 175, is meant exactly for that purpose:

http://java.sun.com/j2se/1.5.0/docs/api/java/lang/annotation/Inherited.html

(This only allows inheritance along the superclass chain, not interfaces.)

j.d.darcya at 2007-7-12 18:34:34 > top of Java-index,Core,Core APIs...
# 2

> http://java.sun.com/j2se/1.5.0/docs/api/java/lang/anno

> tation/Inherited.html

>

> (This only allows inheritance along the superclass

> chain, not interfaces.)

And on class level only. So it's quite limited of use.

I for myself wrote a simple utility class that does it. No need for a framework ;)

stefan.schulza at 2007-7-12 18:34:34 > top of Java-index,Core,Core APIs...
# 3
yep I know about @Inherited but it doesn't useful if I have annotated methods in java interfaces.so I wrote a small util that allows to do so... :)Regards,Michael.
fusionsoft-onlinea at 2007-7-12 18:34:34 > top of Java-index,Core,Core APIs...