|
15 | 15 | */ |
16 | 16 | package org.androidannotations.helper; |
17 | 17 |
|
| 18 | +import static com.sun.codemodel.JExpr._new; |
| 19 | +import static com.sun.codemodel.JExpr.lit; |
| 20 | +import static org.androidannotations.helper.ModelConstants.GENERATION_SUFFIX; |
| 21 | + |
| 22 | +import java.io.StringWriter; |
| 23 | +import java.lang.annotation.Annotation; |
| 24 | +import java.lang.annotation.Inherited; |
| 25 | +import java.lang.reflect.Field; |
| 26 | +import java.util.ArrayList; |
| 27 | +import java.util.Collections; |
| 28 | +import java.util.HashMap; |
| 29 | +import java.util.LinkedHashMap; |
| 30 | +import java.util.List; |
| 31 | +import java.util.Map; |
| 32 | + |
| 33 | +import javax.lang.model.element.AnnotationMirror; |
| 34 | +import javax.lang.model.element.AnnotationValue; |
| 35 | +import javax.lang.model.element.Element; |
| 36 | +import javax.lang.model.element.ExecutableElement; |
| 37 | +import javax.lang.model.element.TypeElement; |
| 38 | +import javax.lang.model.element.TypeParameterElement; |
| 39 | +import javax.lang.model.element.VariableElement; |
| 40 | +import javax.lang.model.type.ArrayType; |
| 41 | +import javax.lang.model.type.DeclaredType; |
| 42 | +import javax.lang.model.type.TypeKind; |
| 43 | +import javax.lang.model.type.TypeMirror; |
| 44 | +import javax.lang.model.type.WildcardType; |
| 45 | +import javax.lang.model.util.ElementFilter; |
| 46 | +import javax.lang.model.util.Types; |
| 47 | + |
| 48 | +import org.androidannotations.annotations.EBean; |
| 49 | +import org.androidannotations.holder.EBeanHolder; |
| 50 | +import org.androidannotations.holder.EComponentHolder; |
| 51 | +import org.androidannotations.holder.GeneratedClassHolder; |
| 52 | + |
18 | 53 | import com.sun.codemodel.JAnnotatable; |
19 | 54 | import com.sun.codemodel.JAnnotationUse; |
20 | 55 | import com.sun.codemodel.JBlock; |
|
32 | 67 | import com.sun.codemodel.JSuperWildcard; |
33 | 68 | import com.sun.codemodel.JType; |
34 | 69 | import com.sun.codemodel.JVar; |
35 | | -import org.androidannotations.annotations.EBean; |
36 | | -import org.androidannotations.holder.EBeanHolder; |
37 | | -import org.androidannotations.holder.EComponentHolder; |
38 | | -import org.androidannotations.holder.GeneratedClassHolder; |
39 | | - |
40 | | -import javax.lang.model.element.AnnotationMirror; |
41 | | -import javax.lang.model.element.AnnotationValue; |
42 | | -import javax.lang.model.element.Element; |
43 | | -import javax.lang.model.element.ExecutableElement; |
44 | | -import javax.lang.model.element.TypeElement; |
45 | | -import javax.lang.model.element.TypeParameterElement; |
46 | | -import javax.lang.model.element.VariableElement; |
47 | | -import javax.lang.model.type.ArrayType; |
48 | | -import javax.lang.model.type.DeclaredType; |
49 | | -import javax.lang.model.type.TypeKind; |
50 | | -import javax.lang.model.type.TypeMirror; |
51 | | -import javax.lang.model.type.WildcardType; |
52 | | -import javax.lang.model.util.ElementFilter; |
53 | | -import javax.lang.model.util.Types; |
54 | | -import java.io.StringWriter; |
55 | | -import java.lang.annotation.Annotation; |
56 | | -import java.lang.reflect.Field; |
57 | | -import java.util.ArrayList; |
58 | | -import java.util.Collections; |
59 | | -import java.util.HashMap; |
60 | | -import java.util.LinkedHashMap; |
61 | | -import java.util.List; |
62 | | -import java.util.Map; |
63 | | - |
64 | | -import static com.sun.codemodel.JExpr._new; |
65 | | -import static com.sun.codemodel.JExpr.lit; |
66 | | -import static org.androidannotations.helper.ModelConstants.GENERATION_SUFFIX; |
67 | 70 |
|
68 | 71 | public class APTCodeModelHelper { |
69 | 72 |
|
@@ -249,9 +252,11 @@ private void addParamToMethod(JMethod method, VariableElement parameter, int mod |
249 | 252 |
|
250 | 253 | public void addNonAAAnotations(JAnnotatable annotatable, List<? extends AnnotationMirror> annotationMirrors, GeneratedClassHolder holder) { |
251 | 254 | for (AnnotationMirror annotationMirror : annotationMirrors) { |
252 | | - JClass annotationClass = typeMirrorToJClass(annotationMirror.getAnnotationType(), holder); |
253 | | - if (!annotationClass.fullName().startsWith("org.androidannotations")) { |
254 | | - addAnnotation(annotatable, annotationMirror, holder); |
| 255 | + if (annotationMirror.getAnnotationType().asElement().getAnnotation(Inherited.class) == null) { |
| 256 | + JClass annotationClass = typeMirrorToJClass(annotationMirror.getAnnotationType(), holder); |
| 257 | + if (!annotationClass.fullName().startsWith("org.androidannotations")) { |
| 258 | + addAnnotation(annotatable, annotationMirror, holder); |
| 259 | + } |
255 | 260 | } |
256 | 261 | } |
257 | 262 | } |
@@ -402,7 +407,7 @@ public JDefinedClass createDelegatingAnonymousRunnableClass(EComponentHolder hol |
402 | 407 | /** |
403 | 408 | * Gets all of the methods of the class and includes the methods of any |
404 | 409 | * implemented interfaces. |
405 | | - * |
| 410 | + * |
406 | 411 | * @param typeElement |
407 | 412 | * @return full list of methods. |
408 | 413 | */ |
@@ -508,7 +513,7 @@ public JExpression litObject(Object o) { |
508 | 513 | } |
509 | 514 | } |
510 | 515 |
|
511 | | - //TODO it would be nice to cache the result map for better performance |
| 516 | + // TODO it would be nice to cache the result map for better performance |
512 | 517 | public TypeMirror getActualType(Element element, GeneratedClassHolder holder) { |
513 | 518 | Types types = holder.processingEnvironment().getTypeUtils(); |
514 | 519 | DeclaredType typeMirror = (DeclaredType) element.getEnclosingElement().asType(); |
|
0 commit comments