1

I'm using Android Annotations library and there is @UIThread annotation, which takes an optional argument propagation. I always use this annotation with REUSE value of this parameter:

@UiThread(propagation = UiThread.Propagation.REUSE)
void doSomething() {
}

So can I make somehow my own annoation @UIThreadReuse which would extend the @UIThread annotation and pass REUSE as a parameter? So I could just write like this:

@UiThreadReuse
void doSomething() {
}
netimen
  • 4,199
  • 6
  • 41
  • 65
  • 1
    Java does not allow to extend annotations, see http://stackoverflow.com/questions/1624084/why-is-not-possible-to-extend-annotations-in-java – kulatamicuda Dec 22 '14 at 09:31
  • The title is not correct. This is about annotation processing code generation tool, and the OP wants to add a new annotation with a narrowed generation behavior of an existing annotation. – WonderCsabo Dec 22 '14 at 09:59
  • or, you could see the composing part of annotations - http://www.javacodegeeks.com/2012/12/composing-java-annotations.html – Roxana Dec 22 '14 at 09:59

1 Answers1

2

This is not possible right now. But in the near future we will support plugins for AndroidAnnotations, so you will be able to add new annotations and corresponding code generators easily.

WonderCsabo
  • 11,947
  • 13
  • 63
  • 105