Skip to content

Commit f38d288

Browse files
committed
ignore otto annotations for not enhanced classes
1 parent 760ac59 commit f38d288

1 file changed

Lines changed: 5 additions & 6 deletions

File tree

  • AndroidAnnotations/androidannotations-otto/otto/src/main/java/org/androidannotations/otto/handler

‎AndroidAnnotations/androidannotations-otto/otto/src/main/java/org/androidannotations/otto/handler/AbstractOttoHandler.java‎

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,12 @@ public AbstractOttoHandler(String target, AndroidAnnotationsEnvironment environm
3636
@Override
3737
public void validate(Element element, ElementValidation valid) {
3838
if (!annotationHelper.enclosingElementHasEnhancedComponentAnnotation(element)) {
39-
valid.invalidate();
39+
// do nothing when otto annotations are used in non-enhanced classes
4040
return;
4141
}
4242

4343
ExecutableElement executableElement = (ExecutableElement) element;
4444

45-
/*
46-
* We check that twice to skip invalid annotated elements
47-
*/
48-
validatorHelper.enclosingElementHasEnhancedComponentAnnotation(executableElement, valid);
49-
5045
validateReturnType(executableElement, valid);
5146

5247
validatorHelper.isPublic(element, valid);
@@ -64,6 +59,10 @@ public void validate(Element element, ElementValidation valid) {
6459

6560
@Override
6661
public void process(Element element, EComponentHolder holder) throws Exception {
62+
if (!annotationHelper.enclosingElementHasEnhancedComponentAnnotation(element)) {
63+
// do nothing when otto annotations are used in non-enhanced classes
64+
return;
65+
}
6766
ExecutableElement executableElement = (ExecutableElement) element;
6867

6968
JMethod method = codeModelHelper.overrideAnnotatedMethod(executableElement, holder);

0 commit comments

Comments
 (0)