From 7a96a40ab7d5418309c4742bdb0225cd0dfb88ff Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 1 Feb 2006 16:16:16 +0000 Subject: [PATCH] thats better. --- .../compiler/lookup/AjLookupEnvironment.java | 29 ++++++++++--------- .../systemtest/ajc151/Ajc151Tests.java | 8 ++--- 2 files changed, 19 insertions(+), 18 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) { diff --git a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java index a6a1d54f5..d47e36d8f 100644 --- a/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc151/Ajc151Tests.java @@ -77,10 +77,10 @@ public class Ajc151Tests extends org.aspectj.testing.XMLBasedAjcTestCase { // public void testAtAspectInheritsAdviceWithTJPAndThis_pr125699 () { // runTest("inherit adivce with this() and thisJoinPoint"); // } -// -// public void testAtAspectInheritsAbstractPointcut_pr125810 () { -// runTest("warning when inherited pointcut not made concrete"); -// } + + public void testAtAspectInheritsAbstractPointcut_pr125810 () { + runTest("warning when inherited pointcut not made concrete"); + } /* * Load-time weaving bugs and enhancements -- 2.39.5