diff options
author | aclement <aclement> | 2006-02-01 16:16:16 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-02-01 16:16:16 +0000 |
commit | 7a96a40ab7d5418309c4742bdb0225cd0dfb88ff (patch) | |
tree | 7f929c6aaded9dee0fabe166f155e47704ca251a /org.aspectj.ajdt.core | |
parent | c5678d506d3d1ea2b18049d898c9c4fff4a2d1dc (diff) | |
download | aspectj-7a96a40ab7d5418309c4742bdb0225cd0dfb88ff.tar.gz aspectj-7a96a40ab7d5418309c4742bdb0225cd0dfb88ff.zip |
thats better.
Diffstat (limited to 'org.aspectj.ajdt.core')
-rw-r--r-- | org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java index 8409b0e58..fa492d9c2 100644 --- a/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java +++ b/org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/lookup/AjLookupEnvironment.java @@ -421,7 +421,7 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } } - if (hasPointcuts || dec instanceof AspectDeclaration || isAnnotationStyleAspectDeclaration(dec)) { + if (hasPointcuts || dec instanceof AspectDeclaration || couldBeAnnotationStyleAspectDeclaration(dec)) { ReferenceType name = (ReferenceType)factory.fromEclipse(sourceType); EclipseSourceType eclipseSourceType = (EclipseSourceType)name.getDelegate(); eclipseSourceType.checkPointcutDeclarations(); @@ -434,20 +434,21 @@ public class AjLookupEnvironment extends LookupEnvironment implements AnonymousC } /** - * Return true if the declaration has @Aspect annotation + * Return true if the declaration has @Aspect annotation. Called 'couldBe' rather than + * 'is' because someone else may have defined an annotation called Aspect - we can't + * verify the full name (including package name) because it may not have been resolved + * just yet and rather going through expensive resolution when we dont have to, this + * gives us a cheap check that tells us whether to bother. */ - private boolean isAnnotationStyleAspectDeclaration(TypeDeclaration dec) { - return false; -// Annotation[] annotations = dec.annotations; -// boolean isAtAspect = false; -// if (annotations != null) { -// for (int i = 0; i < annotations.length && !isAtAspect; i++) { -// if (annotations[i].resolvedType.debugName().equals("org.aspectj.lang.annotation.Aspect")) { -// isAtAspect = true; -// } -// } -// } -// return isAtAspect; + private boolean couldBeAnnotationStyleAspectDeclaration(TypeDeclaration dec) { + Annotation[] annotations = dec.annotations; + boolean couldBeAtAspect = false; + if (annotations != null) { + for (int i = 0; i < annotations.length && !couldBeAtAspect; i++) { + if (annotations[i].toString().equals("@Aspect")) couldBeAtAspect=true; + } + } + return couldBeAtAspect; } private void buildInterTypeAndPerClause(ClassScope s) { |