Lines 29-34
Link Here
|
29 |
import org.eclipse.jdt.internal.compiler.lookup.Binding; |
29 |
import org.eclipse.jdt.internal.compiler.lookup.Binding; |
30 |
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; |
30 |
import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; |
31 |
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; |
31 |
import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; |
|
|
32 |
import org.eclipse.jdt.internal.compiler.lookup.ParameterizedTypeBinding; |
32 |
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; |
33 |
import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; |
33 |
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; |
34 |
import org.eclipse.jdt.internal.compiler.lookup.SourceTypeBinding; |
34 |
import org.eclipse.jdt.internal.compiler.lookup.TagBits; |
35 |
import org.eclipse.jdt.internal.compiler.lookup.TagBits; |
Lines 64-69
Link Here
|
64 |
private void collectAnnotations(ReferenceBinding[] referenceBindings) { |
65 |
private void collectAnnotations(ReferenceBinding[] referenceBindings) { |
65 |
for (ReferenceBinding referenceBinding : referenceBindings) { |
66 |
for (ReferenceBinding referenceBinding : referenceBindings) { |
66 |
// collect all annotations from the binary types |
67 |
// collect all annotations from the binary types |
|
|
68 |
if (referenceBinding instanceof ParameterizedTypeBinding) { |
69 |
referenceBinding = ((ParameterizedTypeBinding) referenceBinding).genericType(); |
70 |
} |
67 |
AnnotationBinding[] annotationBindings = referenceBinding.getAnnotations(); |
71 |
AnnotationBinding[] annotationBindings = referenceBinding.getAnnotations(); |
68 |
for (AnnotationBinding annotationBinding : annotationBindings) { |
72 |
for (AnnotationBinding annotationBinding : annotationBindings) { |
69 |
TypeElement anno = (TypeElement)_factory.newElement(annotationBinding.getAnnotationType()); |
73 |
TypeElement anno = (TypeElement)_factory.newElement(annotationBinding.getAnnotationType()); |
Lines 127-133
Link Here
|
127 |
Set<Element> annotatedElements = new HashSet<Element>(_annoToUnit.getValues(a)); |
131 |
Set<Element> annotatedElements = new HashSet<Element>(_annoToUnit.getValues(a)); |
128 |
// For all other root elements that are TypeElements, and for their recursively enclosed |
132 |
// For all other root elements that are TypeElements, and for their recursively enclosed |
129 |
// types, add each element if it has a superclass are annotated with 'a' |
133 |
// types, add each element if it has a superclass are annotated with 'a' |
130 |
ReferenceBinding annoTypeBinding = (ReferenceBinding)((TypeElementImpl)a)._binding; |
134 |
ReferenceBinding annoTypeBinding = (ReferenceBinding) annoBinding; |
131 |
for (TypeElement element : ElementFilter.typesIn(getRootElements())) { |
135 |
for (TypeElement element : ElementFilter.typesIn(getRootElements())) { |
132 |
ReferenceBinding typeBinding = (ReferenceBinding)((TypeElementImpl)element)._binding; |
136 |
ReferenceBinding typeBinding = (ReferenceBinding)((TypeElementImpl)element)._binding; |
133 |
addAnnotatedElements(annoTypeBinding, typeBinding, annotatedElements); |
137 |
addAnnotatedElements(annoTypeBinding, typeBinding, annotatedElements); |
Lines 162-176
Link Here
|
162 |
* @return true if element has a superclass that is annotated with anno |
166 |
* @return true if element has a superclass that is annotated with anno |
163 |
*/ |
167 |
*/ |
164 |
private boolean inheritsAnno(ReferenceBinding element, ReferenceBinding anno) { |
168 |
private boolean inheritsAnno(ReferenceBinding element, ReferenceBinding anno) { |
|
|
169 |
ReferenceBinding searchedElement = element; |
165 |
do { |
170 |
do { |
166 |
AnnotationBinding[] annos = element.getAnnotations(); |
171 |
if (searchedElement instanceof ParameterizedTypeBinding) { |
|
|
172 |
searchedElement = ((ParameterizedTypeBinding) searchedElement).genericType(); |
173 |
} |
174 |
AnnotationBinding[] annos = searchedElement.getAnnotations(); |
167 |
for (AnnotationBinding annoBinding : annos) { |
175 |
for (AnnotationBinding annoBinding : annos) { |
168 |
if (annoBinding.getAnnotationType() == anno) { |
176 |
if (annoBinding.getAnnotationType() == anno) { |
169 |
// element is annotated with anno |
177 |
// element is annotated with anno |
170 |
return true; |
178 |
return true; |
171 |
} |
179 |
} |
172 |
} |
180 |
} |
173 |
} while (null != (element = element.superclass())); |
181 |
} while (null != (searchedElement = searchedElement.superclass())); |
174 |
return false; |
182 |
return false; |
175 |
} |
183 |
} |
176 |
|
184 |
|