This content has been marked as final. Show 2 replies
I think it would be wonderfull to have Annotation'sThis capability was considered by the JSR 175 expert group (http://www.jcp.org/en/jsr/detail?id=175) but rejected . The question is addressed in their design FAQ:
for example there is a javax.persistence.Entitiy and
org.hibernate.annotations.Entity, the former is
created for extending properties of the first; it
would be nice to make second one extends the first
one, don't you think so?
"Why don't you support annotation subtyping (where one annotation type extends another)?
It complicates the annotation type system, and makes it much more difficult to write "Specific Tools" (per the taxonomy in Section VI). "
There is also the general advice to favor composition over inheritance ("Effective Java" item 14).
I just saw this topic. On my website, I have an experimental, modified javac compiler that supports annotations with subtyping, and the beginnings of a reflection API that supports annotations with subtyping:
I'm interested in any feedback.