Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

@interface inheritance

 
Philip Pomario
Ranch Hand
Posts: 113
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why isn't it possible to extend custom annotations... ?

the following example does not compile:
@interface Base {}
@interface Derived extends Base {}
 
Jelle Klap
Bartender
Posts: 1952
7
Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The specification doesn't allow it.
JLS3 wrote:
No extends clause is permitted. (Annotation types implicitly extend annotation.Annotation.)

Maybe the rationale behind this can be found somewhere in the discussions leading up to the specification in JSR175.

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic