[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] annotations vs. marker interfaces

Hi everybody,

I've been experimenting with the latest features of AspectJ 5. In particular, I wanted to assess whether annotations can completely replace marker interfaces. That was an early promise of annotations before the advent of AspectJ 5, if I recall correctly.
If annotations can really replace marker interfaces, it should be possible to rewrite the widely known implementation of the Observer pattern by Hannemann/Kiczales using annotations such @Subject and @Observer, in place of the Subject and Observer marker interfaces...


However, the documentation accompanying AJDT says that
"An annotation type may not be the target of an inter-type declaration"
Well, I see two ways to interpret this:
a) we cannot use ITDs add state and behaviour to annotation types.
b) we cannot use ITDs to add state and behaviour to types _referred through annotation types_.


a) makes sense, but I'm not sure the doc means b) as well.
If b) is true as well, annotations cannot be used in place of marker interfaces. Is this correct, or am I missing something?


Thanks,

Miguel Pessoa Monteiro, Ph.D.
URL: http://gec.di.uminho.pt/mpm/
Escola Superior de Tecnologia de Castelo Branco
ESTCB URL: http://www.est.ipcb.pt/portal/