]> source.dussan.org Git - aspectj.git/commitdiff
trivial extension
authoraclement <aclement>
Thu, 8 Feb 2007 12:39:01 +0000 (12:39 +0000)
committeraclement <aclement>
Thu, 8 Feb 2007 12:39:01 +0000 (12:39 +0000)
weaver/src/org/aspectj/weaver/bcel/BcelMethod.java
weaver/src/org/aspectj/weaver/bcel/PoliceExtensionUse.java

index 13839f41a83d8963cccbccabbddd02500cc46cc6..cabb84b83b3ed78501abd7cb0266becd49ee3011 100644 (file)
@@ -449,4 +449,14 @@ public final class BcelMethod extends ResolvedMemberImpl {
                                o.getMethod().getCode().getCodeString());
        }
 
-}
+        private boolean calculatedTriviality = false;
+        private boolean isTrivial = false;
+        public boolean isTrivial() {
+       if (calculatedTriviality) return isTrivial; // dont do it more than once for a method!
+               isTrivial = Utility.isSimple(method);
+               calculatedTriviality=true;
+               return isTrivial;
+     }
+     
+
+}
\ No newline at end of file
index f10e8d123bea2cc1296ec43c5e55132f900d562d..186333ca06300c2d4d6c44cd840563c8c02d1aff 100644 (file)
@@ -58,6 +58,14 @@ public class PoliceExtensionUse extends IdentityPointcutVisitor {
                                world.getMessageHandler().handleMessage(m);
                        }
                }
+               if (node.getKind()==Shadow.MethodExecution) {
+                       if (!world.isJoinpointTrivialEnabled() && 
+                           node.getSignature().getModifiers().concernedWithTriviality()) {
+                               IMessage m = MessageUtil.warn("Use of 'trivial' modifier in the execution() pointcut is not allowed without the option -Xjoinpoints:trivial", 
+                                               p.getSourceLocation());
+                               world.getMessageHandler().handleMessage(m);
+                       }
+               }
                return super.visit(node, data);
        }