aboutsummaryrefslogtreecommitdiffstats
path: root/org.aspectj.ajdt.core
diff options
context:
space:
mode:
authoraclement <aclement>2005-01-31 13:20:44 +0000
committeraclement <aclement>2005-01-31 13:20:44 +0000
commita8b235167d8da50fcd715f6d508b7059745009d5 (patch)
treeeb0d354158833b417ecf7eae7459262406fe291d /org.aspectj.ajdt.core
parentfb2f38f003c9a29f5131b05ede54d9a34767a684 (diff)
downloadaspectj-a8b235167d8da50fcd715f6d508b7059745009d5.tar.gz
aspectj-a8b235167d8da50fcd715f6d508b7059745009d5.zip
Provided hasAnnotation() implementation
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r--org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java12
1 files changed, 11 insertions, 1 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
index 42acca173..659f92fc9 100644
--- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
+++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/EclipseSourceType.java
@@ -22,7 +22,9 @@ import org.aspectj.bridge.IMessage;
import org.aspectj.weaver.*;
import org.aspectj.weaver.patterns.PerClause;
import org.aspectj.weaver.patterns.PerSingleton;
+import org.aspectj.org.eclipse.jdt.core.compiler.CharOperation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.AbstractMethodDeclaration;
+import org.aspectj.org.eclipse.jdt.internal.compiler.ast.Annotation;
import org.aspectj.org.eclipse.jdt.internal.compiler.ast.TypeDeclaration;
import org.aspectj.org.eclipse.jdt.internal.compiler.lookup.*;
@@ -230,7 +232,15 @@ public class EclipseSourceType extends ResolvedTypeX.ConcreteName {
}
public boolean hasAnnotation(TypeX ofType) {
- throw new RuntimeException("How to implement this? Needs to ask eclipse!");
+ Annotation[] as = declaration.annotations;
+ for (int i = 0; i < as.length; i++) {
+ Annotation annotation = as[i];
+ String tname = CharOperation.charToString(annotation.resolvedType.constantPoolName());
+ if (TypeX.forName(tname).equals(ofType)) {
+ return true;
+ }
+ }
+ return false;
}
public ResolvedTypeX[] getAnnotationTypes() {