]> source.dussan.org Git - aspectj.git/commitdiff
#108488 @AspectJ perthis(..) was broken for some pointcut issue
authoravasseur <avasseur>
Thu, 29 Sep 2005 14:29:43 +0000 (14:29 +0000)
committeravasseur <avasseur>
Thu, 29 Sep 2005 14:29:43 +0000 (14:29 +0000)
checks for @AfterXX fixed

org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
tests/java5/ataspectj/ataspectj/PerClauseTest.java
tests/src/org/aspectj/systemtest/ajc150/ataspectj/AtAjSyntaxTests.java
weaver/src/org/aspectj/weaver/patterns/PerThisOrTargetPointcutVisitor.java
weaver/src/org/aspectj/weaver/patterns/ThisOrTargetPointcut.java
weaver/src/org/aspectj/weaver/patterns/WildTypePattern.java

index 3bec1549fe78090701e54e20ee19eac69f136ff4..7aae00ecd652eba3158ad2ff7e61fc0d93f4ac34 100644 (file)
@@ -307,13 +307,9 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
                        String thrownFormal = getStringLiteralFor("throwing",ajAnnotations.adviceAnnotation,throwingLocation);
                        if (thrownFormal != null) {
                                Argument[] arguments = methodDeclaration.arguments;
-                               if (methodDeclaration.arguments != null
-                        && !toArgumentNames(methodDeclaration.arguments).contains(thrownFormal)) {
+                               if (!toArgumentNames(methodDeclaration.arguments).contains(thrownFormal)) {
                                                methodDeclaration.scope.problemReporter()
                                                        .signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"throwing formal '" + thrownFormal + "' must be declared as a parameter in the advice signature");
-                               } else {
-                                       methodDeclaration.scope.problemReporter()
-                                       .signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"throwing formal '" + thrownFormal + "' must be declared as a parameter in the advice signature");
                                }
                        }
                }
@@ -322,13 +318,9 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
                        int[] throwingLocation = new int[2];
                        String returningFormal = getStringLiteralFor("returning",ajAnnotations.adviceAnnotation,throwingLocation);
                        if (returningFormal != null) {
-                               if (methodDeclaration.arguments.length > 0
-                        && !toArgumentNames(methodDeclaration.arguments).contains(returningFormal)) {
+                               if (!toArgumentNames(methodDeclaration.arguments).contains(returningFormal)) {
                                                methodDeclaration.scope.problemReporter()
                                                        .signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"returning formal '" + returningFormal + "' must be declared as a parameter in the advice signature");
-                               } else {
-                                       methodDeclaration.scope.problemReporter()
-                                       .signalError(methodDeclaration.sourceStart,methodDeclaration.sourceEnd,"returning formal '" + returningFormal + "' must be declared as a parameter in the advice signature");
                                }
                        }
                }
index dfb529dcdd33dbb3c17cc49fc809740ca51b2b73..34d9fb5c905b28cd684edc62e5d0c62e8e75ad6b 100644 (file)
@@ -62,7 +62,7 @@ public class PerClauseTest extends TestCase {
         log("perTarget");
     }
 
-    public void xtestPerTarget() {
+    public void testPerTarget() {
         s_log = new StringBuffer();
         perTarget();
         assertEquals("AOP.perTarget perTarget ", s_log.toString());
@@ -121,7 +121,7 @@ public class PerClauseTest extends TestCase {
         log("perCflow");
     }
 
-    public void xtestPerCflow() throws Throwable {
+    public void testPerCflow() throws Throwable {
         s_log = new StringBuffer();
 
         // no aspect bound yet
@@ -177,7 +177,7 @@ public class PerClauseTest extends TestCase {
         assertEquals(2, PerClauseTestAspects.TestAspectPerCflow.s_count);
     }
 
-    public void xtestPerTypeWithin() {
+    public void testPerTypeWithin() {
         assertTrue(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTW1.class));
         assertTrue(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTW2.class));
         assertFalse(Aspects.hasAspect(PerClauseTestAspects.TestAspectPTW.class, PTWNoMatch.class));
index f4ea339e1ceb128ab5cb479e1ffdab09a6a08485..e4f883c66d38586d8fdeb16e939229cbd1f7c044 100644 (file)
@@ -77,9 +77,8 @@ public class AtAjSyntaxTests extends XMLBasedAjcTestCase {
         runTest("BindingTest no inline");
     }
 
-    //FIXME AV 2005-09 - commented as perthis(this(Type)) fails for now as of #108488
     public void testPerClause() {
-        //runTest("PerClause");
+        runTest("PerClause");
     }
 
     public void testAroundInlineMunger_XnoInline() {
index 4cbc88248b237bd6e15c6362c22c1647a1169886..42f1b2d4e68d86f72bd4033b25e3e451cfc64e22 100644 (file)
@@ -137,7 +137,8 @@ public class PerThisOrTargetPointcutVisitor extends IdentityPointcutVisitor {
             //pertarget(target(Foo)) => Foo+ for type pattern matching
             //perthis(this(Foo)) => Foo+ for type pattern matching
             // TODO AV - we do like a deep copy by parsing it again.. quite dirty, would need a clean deep copy
-            TypePattern copy = new PatternParser(node.getType().toString()).parseTypePattern();
+            TypePattern copy = new PatternParser(node.getType().toString().replace('$', '.')).parseTypePattern();
+            // TODO AV - see dirty replace from $ to . here as inner classes are with $ instead (#108488)
             copy.includeSubtypes = true;
             return copy;
         } else {
index f962cf4aa984f841afde1071154e98d5c4749fb0..7eb8ad276376fd6267fd1a6d6b7d4218ca1aa1e0 100644 (file)
@@ -93,7 +93,7 @@ public class ThisOrTargetPointcut extends NameBindingPointcut {
                UnresolvedType typeToMatch = isThis ? shadow.getThisType() : shadow.getTargetType(); 
                //if (typeToMatch == ResolvedType.MISSING) return FuzzyBoolean.NO;
                
-               return type.matches(typeToMatch.resolve(shadow.getIWorld()), TypePattern.DYNAMIC);
+               return type.matches(typeToMatch.resolve(shadow.getIWorld()), TypePattern.DYNAMIC);//AVPT was DYNAMIC
        }
 
        public void write(DataOutputStream s) throws IOException {
index 34363d39b867786123949d1f79060e1507e276ca..2cea93d52582e80706ea3a059e2e2176cb0e3b15 100644 (file)
@@ -447,7 +447,8 @@ public class WildTypePattern extends TypePattern {
         */
        public FuzzyBoolean matchesInstanceof(ResolvedType type) {
                //XXX hack to let unmatched types just silently remain so
-               if (maybeGetSimpleName() != null) return FuzzyBoolean.NO;
+               if (maybeGetSimpleName() != null) return
+                FuzzyBoolean.NO;
                
                type.getWorld().getMessageHandler().handleMessage(
                        new Message("can't do instanceof matching on patterns with wildcards",