diff options
15 files changed, 331 insertions, 40 deletions
diff --git a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jar b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jar Binary files differindex b283902645..3512fa4d23 100644 --- a/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jar +++ b/org.eclipse.jdt.compiler.apt.tests/lib/apttestprocessors.jar diff --git a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/elementutils/ElementUtilsProc.java b/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/elementutils/ElementUtilsProc.java index cbf995369b..18ec26cbb9 100644 --- a/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/elementutils/ElementUtilsProc.java +++ b/org.eclipse.jdt.compiler.apt.tests/processors/org/eclipse/jdt/compiler/apt/tests/processors/elementutils/ElementUtilsProc.java @@ -19,12 +19,15 @@ import javax.annotation.processing.RoundEnvironment; import javax.annotation.processing.SupportedAnnotationTypes; import javax.annotation.processing.SupportedSourceVersion; import javax.lang.model.SourceVersion; +import javax.lang.model.element.AnnotationMirror; +import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.Element; import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.TypeElement; import javax.lang.model.element.VariableElement; import javax.lang.model.util.ElementFilter; +import javax.lang.model.util.Elements; import org.eclipse.jdt.compiler.apt.tests.processors.base.BaseProcessor; @@ -40,6 +43,11 @@ public class ElementUtilsProc extends BaseProcessor // Initialized in collectElements() private TypeElement _elementF; private TypeElement _elementG; + private TypeElement _elementH; + private TypeElement _elementAnnoX; + private ExecutableElement _annoXValue; + private TypeElement _elementAnnoY; + private ExecutableElement _annoYValue; // Always return false from this processor, because it supports "*". // The return value does not signify success or failure! @@ -60,10 +68,18 @@ public class ElementUtilsProc extends BaseProcessor return false; } + if (!examineGetAllAnnotations()) { + return false; + } + if (!examineGetAllMembers()) { return false; } + if (!examineIsDeprecated()) { + return false; + } + reportSuccess(); return true; } @@ -84,10 +100,100 @@ public class ElementUtilsProc extends BaseProcessor reportError("element G was not found or was not a class"); return false; } + _elementH = _elementUtils.getTypeElement("targets.model.pc.H"); + if (_elementH == null || _elementH.getKind() != ElementKind.CLASS) { + reportError("element H was not found or was not a class"); + return false; + } + + _elementAnnoX = _elementUtils.getTypeElement("targets.model.pc.AnnoX"); + if (null == _elementAnnoX || _elementAnnoX.getKind() != ElementKind.ANNOTATION_TYPE) { + reportError("annotation type annoX was not found or was not an annotation"); + return false; + } + for (ExecutableElement method : ElementFilter.methodsIn(_elementAnnoX.getEnclosedElements())) { + if ("value".equals(method.getSimpleName().toString())) { + _annoXValue = method; + } + } + if (null == _annoXValue) { + reportError("Could not find value() method in annotation type AnnoX"); + return false; + } + + _elementAnnoY = _elementUtils.getTypeElement("targets.model.pc.AnnoY"); + if (null == _elementAnnoY || _elementAnnoY.getKind() != ElementKind.ANNOTATION_TYPE) { + reportError("annotation type annoY was not found or was not an annotation"); + return false; + } + for (ExecutableElement method : ElementFilter.methodsIn(_elementAnnoY.getEnclosedElements())) { + if ("value".equals(method.getSimpleName().toString())) { + _annoYValue = method; + } + } + if (null == _annoYValue) { + reportError("Could not find value() method in annotation type AnnoY"); + return false; + } + return true; } /** + * Test the {@link Elements#getAllAnnotationMirrors()} method + * @return true if all tests passed + */ + private boolean examineGetAllAnnotations() + { + List<? extends AnnotationMirror> annotationsH = _elementUtils.getAllAnnotationMirrors(_elementH); + if (null == annotationsH) { + reportError("getAllAnnotationMirrors(_elementH) returned null"); + return false; + } + // H has AnnoY("on H"), G has AnnoX("on G"), and F has hidden AnnoY("on F"). + int foundF = 0; + int foundG = 0; + int foundH = 0; + for (AnnotationMirror anno : annotationsH) { + Map<? extends ExecutableElement, ? extends AnnotationValue> values = anno.getElementValues(); + AnnotationValue valueY = values.get(_annoYValue); + if (null != valueY) { + if ("on F".equals(valueY.getValue())) { + foundF++; + } + else if ("on H".equals(valueY.getValue())) { + foundH++; + } + else { + reportError("unexpected value for annotation AnnoY"); + return false; + } + } + else { + AnnotationValue valueX = values.get(_annoXValue); + if (null != valueX) { + if ("on G".equals(valueX.getValue())) { + foundG++; + } + else { + reportError("unexpected value for annotation AnnoX"); + return false; + } + } + else { + reportError("getAllAnnotationMirrors(_elementH) returned a mirror with no value()"); + return false; + } + } + } + if (0 != foundF || 1 != foundG || 1 != foundH) { + reportError("getAllAnnotationMirrors() found wrong number of annotations on H"); + return false; + } + return true; + } + + /** * Test the {@link Elements#getAllMembers()} method * @return true if all tests passed */ @@ -182,4 +288,89 @@ public class ElementUtilsProc extends BaseProcessor return true; } + /** + * Test the {@link Elements#isDeprecated()} method + * @return true if all tests passed + */ + private boolean examineIsDeprecated() + { + Element _deprecatedElem = _elementUtils.getTypeElement("targets.model.pc.Deprecation"); + if (null == _deprecatedElem) { + reportError("Couldn't find targets.model.pc.Deprecation"); + return false; + } + ExecutableElement methodDeprecated = null; + ExecutableElement methodNotDeprecated = null; + for (ExecutableElement method : ElementFilter.methodsIn(_deprecatedElem.getEnclosedElements())) { + if ("deprecatedMethod".equals(method.getSimpleName().toString())) { + methodDeprecated = method; + } + else if ("nonDeprecatedMethod".equals(method.getSimpleName().toString())) { + methodNotDeprecated = method; + } + } + if (null == methodDeprecated || null == methodNotDeprecated) { + reportError("Could not find methods Deprecation.deprecatedMethod() or Deprecation.nonDeprecatedMethod()"); + return false; + } + if (_elementUtils.isDeprecated(methodNotDeprecated)) { + reportError("ElementUtils.isDeprecated(Deprecation.nonDeprecatedMethod()) is true"); + return false; + } + if (!_elementUtils.isDeprecated(methodDeprecated)) { + reportError("ElementUtils.isDeprecated(Deprecation.deprecatedMethod()) is false"); + return false; + } + TypeElement classDeprecated = null; + TypeElement classNotDeprecated = null; + TypeElement interfaceDeprecated = null; + TypeElement interfaceNotDeprecated = null; + for (TypeElement type : ElementFilter.typesIn(_deprecatedElem.getEnclosedElements())) { + if ("deprecatedClass".equals(type.getSimpleName().toString())) { + classDeprecated = type; + } + else if ("nonDeprecatedClass".equals(type.getSimpleName().toString())) { + classNotDeprecated = type; + } + else if ("deprecatedInterface".equals(type.getSimpleName().toString())) { + interfaceDeprecated = type; + } + else if ("nonDeprecatedInterface".equals(type.getSimpleName().toString())) { + interfaceNotDeprecated = type; + } + } + if (null == classDeprecated || null == classNotDeprecated) { + reportError("Could not find methods Deprecation.deprecatedClass() or Deprecation.nonDeprecatedClass()"); + return false; + } + if (null == interfaceDeprecated || null == interfaceNotDeprecated) { + reportError("Could not find methods Deprecation.deprecatedInterface() or Deprecation.nonDeprecatedInterface()"); + return false; + } + if (_elementUtils.isDeprecated(classNotDeprecated)) { + reportError("ElementUtils.isDeprecated(Deprecation.nonDeprecatedClass()) is true"); + return false; + } + if (!_elementUtils.isDeprecated(classDeprecated)) { + reportError("ElementUtils.isDeprecated(Deprecation.deprecatedClass()) is false"); + return false; + } + if (_elementUtils.isDeprecated(interfaceNotDeprecated)) { + reportError("ElementUtils.isDeprecated(Deprecation.nonDeprecatedInterface()) is true"); + return false; + } + if (!_elementUtils.isDeprecated(interfaceDeprecated)) { + reportError("ElementUtils.isDeprecated(Deprecation.deprecatedInterface()) is false"); + return false; + } + + TypeElement deprecatedInnerClass = _elementUtils.getTypeElement("targets.model.pc.Deprecation.deprecatedClass"); + if (null == deprecatedInnerClass) { + reportError("Couldn't find class Deprecation.deprecatedClass"); + return false; + } + + return true; + } + } diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AnnoX.java b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AnnoX.java new file mode 100644 index 0000000000..a5e69d05d7 --- /dev/null +++ b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AnnoX.java @@ -0,0 +1,8 @@ +package targets.model.pc; + +import java.lang.annotation.Inherited; + +@Inherited +@interface AnnoX { + String value(); +}
\ No newline at end of file diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AnnoY.java b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AnnoY.java new file mode 100644 index 0000000000..f483834c0e --- /dev/null +++ b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/AnnoY.java @@ -0,0 +1,5 @@ +package targets.model.pc; + +@interface AnnoY { + String value(); +}
\ No newline at end of file diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/Deprecation.java b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/Deprecation.java new file mode 100644 index 0000000000..74671e594b --- /dev/null +++ b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/Deprecation.java @@ -0,0 +1,30 @@ +package targets.model.pc; + +@SuppressWarnings("deprecation") +@Deprecated +public class Deprecation { + @Deprecated + public class deprecatedClass {} + + @Deprecated + public enum deprecatedEnum { Val1 } + + @Deprecated + public interface deprecatedInterface {} + + @Deprecated + public String deprecatedField; + + @Deprecated + void deprecatedMethod() {} + + public class nonDeprecatedClass {} + + public enum nonDeprecatedEnum { Val1 } + + public interface nonDeprecatedInterface {} + + public String nonDeprecatedField; + + void nonDeprecatedMethod() {} +}
\ No newline at end of file diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/F.java b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/F.java index bc45ecb902..9b12b50154 100644 --- a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/F.java +++ b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/F.java @@ -1,5 +1,6 @@ package targets.model.pc; +@AnnoY("on F") public class F<T1> { public class FChild { } @@ -13,6 +14,7 @@ public class F<T1> { int fieldInt; + @AnnoY("on F.method_T1") T1 method_T1(T1 param1) { return null; @@ -23,4 +25,10 @@ public class F<T1> { _fieldT1_private = param1; return _fieldT1_private.toString(); } + + @SuppressWarnings("deprecation") + @Deprecated + void deprecatedMethod() + { + } }
\ No newline at end of file diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/G.java b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/G.java index 8abdfa6ce5..027ae9ea16 100644 --- a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/G.java +++ b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/G.java @@ -2,12 +2,14 @@ package targets.model.pc; import targets.model.pa.IA; +@AnnoX("on G") public abstract class G extends F<String> implements IA, IF { public String _fieldString; int fieldInt; // hides definition in F @Override + @AnnoY("on G.method_T1") String method_T1(String param1) { return null; diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/H.java b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/H.java index ea1dac28b7..5499cf51cb 100644 --- a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/H.java +++ b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/H.java @@ -1,5 +1,6 @@ package targets.model.pc; +@AnnoY("on H") public class H extends G { int fieldInt; // hides definition in G diff --git a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/IF.java b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/IF.java index 5b9d505968..8533c46e08 100644 --- a/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/IF.java +++ b/org.eclipse.jdt.compiler.apt.tests/resources/targets/model/pc/IF.java @@ -1,5 +1,6 @@ package targets.model.pc; +@AnnoY("on IF") public interface IF { public class IFChild { diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementImpl.java index c5e1d21c56..07ddbea8ae 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementImpl.java @@ -11,17 +11,13 @@ package org.eclipse.jdt.internal.compiler.apt.model; import java.lang.annotation.Annotation; -import java.util.ArrayList; import java.util.Collections; -import java.util.List; import java.util.Set; -import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Modifier; import javax.lang.model.element.Name; import javax.lang.model.type.TypeMirror; -import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; import org.eclipse.jdt.internal.compiler.lookup.Binding; /** @@ -49,17 +45,6 @@ public abstract class ElementImpl return null; } - protected List<? extends AnnotationMirror> getAnnotationMirrors(AnnotationBinding[] annotations) { - if (null == annotations || 0 == annotations.length) { - return Collections.emptyList(); - } - List<AnnotationMirror> list = new ArrayList<AnnotationMirror>(annotations.length); - for (AnnotationBinding annotation : annotations) { - list.add(AnnotationMirrorImpl.getAnnotationMirror(annotation)); - } - return Collections.unmodifiableList(list); - } - @Override public Set<Modifier> getModifiers() { // Most subclasses implement this; this default is appropriate for diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementsImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementsImpl.java index dc2ceca4bf..a6525503b1 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementsImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ElementsImpl.java @@ -25,18 +25,22 @@ import java.util.Set; import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.AnnotationValue; import javax.lang.model.element.Element; +import javax.lang.model.element.ElementKind; import javax.lang.model.element.ExecutableElement; import javax.lang.model.element.Name; import javax.lang.model.element.PackageElement; import javax.lang.model.element.TypeElement; import javax.lang.model.util.Elements; +import org.eclipse.jdt.core.compiler.CharOperation; import org.eclipse.jdt.internal.compiler.apt.dispatch.BaseProcessingEnvImpl; +import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; import org.eclipse.jdt.internal.compiler.lookup.FieldBinding; import org.eclipse.jdt.internal.compiler.lookup.LookupEnvironment; import org.eclipse.jdt.internal.compiler.lookup.MethodBinding; import org.eclipse.jdt.internal.compiler.lookup.MethodVerifier; import org.eclipse.jdt.internal.compiler.lookup.ReferenceBinding; +import org.eclipse.jdt.internal.compiler.lookup.TagBits; /** * Utilities for working with language elements. @@ -54,13 +58,39 @@ public class ElementsImpl implements Elements { _env = env; } - /* (non-Javadoc) - * @see javax.lang.model.util.Elements#getAllAnnotationMirrors(javax.lang.model.element.Element) + /** + * Return all the annotation mirrors on this element, including inherited annotations. + * Annotations are inherited only if the annotation type is meta-annotated with @Inherited, + * and the annotation is on a class: e.g., annotations are not inherited for interfaces, methods, + * or fields. */ @Override public List<? extends AnnotationMirror> getAllAnnotationMirrors(Element e) { - // TODO Auto-generated method stub - return null; + // if e is a class, walk up its superclass hierarchy looking for @Inherited annotations not already in the list + if (e.getKind() == ElementKind.CLASS && e instanceof TypeElementImpl) { + List<AnnotationBinding> annotations = new ArrayList<AnnotationBinding>(); + // A class can only have one annotation of a particular annotation type. + Set<ReferenceBinding> annotationTypes = new HashSet<ReferenceBinding>(); + ReferenceBinding binding = (ReferenceBinding)((TypeElementImpl)e)._binding; + while (null != binding) { + for (AnnotationBinding annotation : binding.getAnnotations()) { + ReferenceBinding annotationType = annotation.getAnnotationType(); + if (!annotationTypes.contains(annotationType)) { + annotationTypes.add(annotationType); + annotations.add(annotation); + } + } + binding = binding.superclass(); + } + List<AnnotationMirror> list = new ArrayList<AnnotationMirror>(annotations.size()); + for (AnnotationBinding annotation : annotations) { + list.add(AnnotationMirrorImpl.getAnnotationMirror(annotation)); + } + return Collections.unmodifiableList(list); + } + else { + return e.getAnnotationMirrors(); + } } /** @@ -266,16 +296,32 @@ public class ElementsImpl implements Elements { @Override public TypeElement getTypeElement(CharSequence name) { LookupEnvironment le = _env.getLookupEnvironment(); - //TODO: do this the right way - this is a hack to test if it works - String qname = name.toString(); - String parts[] = qname.split("\\."); //$NON-NLS-1$ - int length = parts.length; - char[][] compoundName = new char[length][]; - for (int i = 0; i < length; i++) { - compoundName[i] = parts[i].toCharArray(); - } + final char[][] compoundName = CharOperation.splitOn('.', name.toString().toCharArray()); ReferenceBinding binding = le.getType(compoundName); - if (binding == null) { + // If we didn't find the binding, maybe it's a nested type; + // try finding the top-level type and then working downwards. + if (null == binding) { + ReferenceBinding topLevelBinding = null; + int topLevelSegments = compoundName.length; + while (--topLevelSegments > 0) { + char[][] topLevelName = new char[topLevelSegments][]; + for (int i = 0; i < topLevelSegments; ++i) { + topLevelName[i] = compoundName[i]; + } + topLevelBinding = le.getType(topLevelName); + if (null != topLevelBinding) { + break; + } + } + if (null == topLevelBinding) { + return null; + } + binding = topLevelBinding; + for (int i = topLevelSegments; null != binding && i < compoundName.length; ++i) { + binding = binding.getMemberType(compoundName[i]); + } + } + if (null == binding) { return null; } return new TypeElementImpl(binding); @@ -295,8 +341,10 @@ public class ElementsImpl implements Elements { */ @Override public boolean isDeprecated(Element e) { - // TODO Auto-generated method stub - return false; + if (!(e instanceof ElementImpl)) { + return false; + } + return (((ElementImpl)e)._binding.getAnnotationTagBits() & TagBits.AnnotationDeprecated) != 0; } /* (non-Javadoc) diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ExecutableElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ExecutableElementImpl.java index 5af9a35444..be384e3f1d 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ExecutableElementImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/ExecutableElementImpl.java @@ -57,14 +57,7 @@ public class ExecutableElementImpl extends ElementImpl implements @Override public List<? extends AnnotationMirror> getAnnotationMirrors() { AnnotationBinding[] annotations = ((MethodBinding)_binding).getAnnotations(); - if (0 == annotations.length) { - return Collections.emptyList(); - } - List<AnnotationMirror> list = new ArrayList<AnnotationMirror>(annotations.length); - for (AnnotationBinding annotation : annotations) { - list.add(AnnotationMirrorImpl.getAnnotationMirror(annotation)); - } - return Collections.unmodifiableList(list); + return Factory.getAnnotationMirrors(annotations); } @Override diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java index c41e7678ee..b39ff024ca 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/Factory.java @@ -12,10 +12,13 @@ package org.eclipse.jdt.internal.compiler.apt.model; +import java.util.ArrayList; import java.util.Collections; import java.util.EnumSet; +import java.util.List; import java.util.Set; +import javax.lang.model.element.AnnotationMirror; import javax.lang.model.element.Element; import javax.lang.model.element.Modifier; import javax.lang.model.element.TypeParameterElement; @@ -23,6 +26,7 @@ import javax.lang.model.type.DeclaredType; import javax.lang.model.type.TypeMirror; import org.eclipse.jdt.internal.compiler.classfmt.ClassFileConstants; +import org.eclipse.jdt.internal.compiler.lookup.AnnotationBinding; import org.eclipse.jdt.internal.compiler.lookup.ArrayBinding; import org.eclipse.jdt.internal.compiler.lookup.BaseTypeBinding; import org.eclipse.jdt.internal.compiler.lookup.Binding; @@ -38,6 +42,21 @@ import org.eclipse.jdt.internal.compiler.lookup.VariableBinding; public class Factory { /** + * Convert an array of compiler annotation bindings into a list of AnnotationMirror + * @return a non-null, possibly empty, unmodifiable list. + */ + public static List<? extends AnnotationMirror> getAnnotationMirrors(AnnotationBinding[] annotations) { + if (null == annotations || 0 == annotations.length) { + return Collections.emptyList(); + } + List<AnnotationMirror> list = new ArrayList<AnnotationMirror>(annotations.length); + for (AnnotationBinding annotation : annotations) { + list.add(AnnotationMirrorImpl.getAnnotationMirror(annotation)); + } + return Collections.unmodifiableList(list); + } + + /** * Convert from the JDT's ClassFileConstants flags to the Modifier enum. */ public static Set<Modifier> getModifiers(int modifiers) diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java index 57913ec0f6..d0008142a0 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/TypeElementImpl.java @@ -50,7 +50,7 @@ public class TypeElementImpl extends ElementImpl implements TypeElement { @Override public List<? extends AnnotationMirror> getAnnotationMirrors() { AnnotationBinding[] annotations = ((ReferenceBinding)_binding).getAnnotations(); - return getAnnotationMirrors(annotations); + return Factory.getAnnotationMirrors(annotations); } @Override diff --git a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/VariableElementImpl.java b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/VariableElementImpl.java index c1e2833476..c1250e97ae 100644 --- a/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/VariableElementImpl.java +++ b/org.eclipse.jdt.compiler.apt/src/org/eclipse/jdt/internal/compiler/apt/model/VariableElementImpl.java @@ -54,7 +54,7 @@ public class VariableElementImpl extends ElementImpl implements VariableElement public List<? extends AnnotationMirror> getAnnotationMirrors() { if (_binding instanceof VariableBinding) { AnnotationBinding[] annotations = ((VariableBinding)_binding).getAnnotations(); - return getAnnotationMirrors(annotations); + return Factory.getAnnotationMirrors(annotations); } else { // TODO: how to get annotations from parameters? |