0

I have the following code structure:

public interface InterfaceName {
    @AnnotationTwo
    public void method_name();  
} 

public class InterfaceNameImpl implements InterfaceName{
    @AnnotationOne
    public void method_name() {

    }
}

When I call method_name, @AnnotationOne is processed but @AnnotationTwo is not (judging by the logs) Do I need to make some sort of configuration or something for @AnnotationTwo to be processed? (Also, the annotations' code is external, so I can't change that). Ideally, I want @AnnotationTwo to be processed before @AnnotationOne.

I have an aspectj join point around the execution of @AnnotaionTwo and the corresponding code is not being executed. However the aspectj code corresponding to joint point @AnnotationOne is executed. I want the code corresponding to @AnnotationTwo to be processed before the code corresponding to @AnnotationOne.

Note: I am using apsectj with load time weaving as described here

Jatin
  • 14,112
  • 16
  • 49
  • 78
  • Did you check this about java annotations and method overriding: http://stackoverflow.com/questions/10082619/how-do-java-method-annotations-work-in-conjunction-with-method-overriding? – Vikdor Dec 02 '14 at 10:31
  • @Vikdor That talks about the case when a class extends other class. I think that's different scenario that mine. Or is the behavior same? – Jatin Dec 02 '14 at 10:33

1 Answers1

2

Not the freshest answer ever, but I believe it still holds:

Annotations on interface methods are not inherited when implementing said interface.
Annotation is not inherited from interface method
Why java classes do not inherit annotations from implemented interfaces?

Community
  • 1
  • 1
sheltem
  • 3,754
  • 1
  • 34
  • 39