]> source.dussan.org Git - aspectj.git/commitdiff
fixes for 125475/125480 - matches nothing @AJ support. Definetly *NOT* as clean...
authoraclement <aclement>
Mon, 30 Jan 2006 10:25:59 +0000 (10:25 +0000)
committeraclement <aclement>
Mon, 30 Jan 2006 10:25:59 +0000 (10:25 +0000)
org.aspectj.ajdt.core/src/org/aspectj/ajdt/internal/compiler/ast/ValidateAtAspectJAnnotationsVisitor.java
weaver/src/org/aspectj/weaver/bcel/AtAjAttributes.java

index ab320a1872030133fccbdc9f1ac5af688aead38b..e16e73d517fc04d24c719ca1ca40b34a7b1cb56a 100644 (file)
@@ -493,6 +493,7 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
                        methodDeclaration.scope.problemReporter().disallowedTargetForAnnotation(ajAnnotations.adviceNameAnnotation);                    
                }
        
+               boolean noValueSupplied=true;
                boolean containsIfPcd = false;
                int[] pcLocation = new int[2];
                String pointcutExpression = getStringLiteralFor("value",ajAnnotations.pointcutAnnotation,pcLocation);
@@ -500,8 +501,9 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
                        ISourceContext context = new EclipseSourceContext(unit.compilationResult,pcLocation[0]);
             Pointcut pc = null;//abstract
             if (pointcutExpression == null  || pointcutExpression.length() == 0) {
-                ;//will have to ensure abstract ()V method
+                noValueSupplied=true; // matches nothing pointcut
             } else {
+               noValueSupplied=false;
                 pc = new PatternParser(pointcutExpression,context).parsePointcut();
             }
             pcDecl.pointcutDesignator = (pc==null)?null:new PointcutDesignator(pc);
@@ -561,16 +563,17 @@ public class ValidateAtAspectJAnnotationsVisitor extends ASTVisitor {
                }
 
         if (pcDecl.pointcutDesignator == null) {
-            if (Modifier.isAbstract(methodDeclaration.modifiers)
+            if (Modifier.isAbstract(methodDeclaration.modifiers) 
+                || noValueSupplied // this is a matches nothing pointcut
                 //those 2 checks makes sense for aop.xml concretization but NOT for regular abstraction of pointcut
                 //&& returnsVoid
                 //&& (methodDeclaration.arguments == null || methodDeclaration.arguments.length == 0)) {
                 ) {
                 ;//fine
             } else {
-                methodDeclaration.scope.problemReporter().signalError(methodDeclaration.returnType.sourceStart,
-                          methodDeclaration.returnType.sourceEnd,
-                          "Method annotated with @Pointcut() for abstract pointcut must be abstract");
+                       methodDeclaration.scope.problemReporter().signalError(methodDeclaration.returnType.sourceStart,
+                                 methodDeclaration.returnType.sourceEnd,
+                                 "Method annotated with @Pointcut() for abstract pointcut must be abstract");
             }
         } else if (Modifier.isAbstract(methodDeclaration.modifiers)) {
             methodDeclaration.scope.problemReporter().signalError(methodDeclaration.returnType.sourceStart,
index e49374dab998611a39e8c29cafef50e8f1f9403a..f09b0f8bb176b9ce035dc4945b19f57208cd0211 100644 (file)
@@ -1186,16 +1186,20 @@ public class AtAjAttributes {
                     return;//stop
                 }
             } else {
-                if (pointcutExpr != null) {
+               if (pointcutExpr==null || (pointcutExpr != null && isNullOrEmpty(pointcutExpr.getValue().stringifyValue()))) {
+                       // the matches nothing pointcut (125475/125480) - perhaps not as cleanly supported as it could be.
+               } else {
+                  if (pointcutExpr != null) {
                     // use a LazyResolvedPointcutDefinition so that the pointcut is resolved lazily
                     // since for it to be resolved, we will need other pointcuts to be registered as well
                     pc = parsePointcut(pointcutExpr.getValue().stringifyValue(), struct, true);
                     if (pc == null) return;//parse error
                     pc.setLocation(struct.context, -1, -1);//FIXME AVASM !! bMethod is null here..
-                } else {
+                  } else {
                     reportError("Found undefined @Pointcut on a non-abstract method", struct);
                     return;
-                }
+                  }
+               }
             }
             // do not resolve binding now but lazily
             struct.ajAttributes.add(