annotation's inheritance

I think it would be wonderfull to have Annotation's inheritance,

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?

[306 byte] By [AmirPashaa] at [2007-9-25]
# 1

> I think it would be wonderfull to have Annotation's

> inheritance,

>

> 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?

This 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:

"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).

j.d.darcya at 2007-7-14 > top of java,Core,Core APIs...