aboutsummaryrefslogtreecommitdiffstats
path: root/tests/bugs
diff options
context:
space:
mode:
authoraclement <aclement>2004-02-26 09:56:40 +0000
committeraclement <aclement>2004-02-26 09:56:40 +0000
commita8c17de491cf0c062c50e7a7488d5074c3f30673 (patch)
treec2d0749597f07f7c42c457b49ef3a8f7f107651b /tests/bugs
parent9a29a973f55a157c54b18bcf554a090bb8ef19e3 (diff)
downloadaspectj-a8c17de491cf0c062c50e7a7488d5074c3f30673.tar.gz
aspectj-a8c17de491cf0c062c50e7a7488d5074c3f30673.zip
Fix for preventing the use of if/target/this/args/cflow/cflowbelow in DeclareSofts.
Diffstat (limited to 'tests/bugs')
-rw-r--r--tests/bugs/DeclareSoftDynamicPCDs.java58
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/bugs/DeclareSoftDynamicPCDs.java b/tests/bugs/DeclareSoftDynamicPCDs.java
new file mode 100644
index 000000000..934afbc9e
--- /dev/null
+++ b/tests/bugs/DeclareSoftDynamicPCDs.java
@@ -0,0 +1,58 @@
+/*
+ * From:
+ *
+ * http://dev.eclipse.org/viewcvs/indextech.cgi/~checkout~/aspectj-home/doc/progguide/semantics-declare.html#d0e6499
+ *
+ * Pointcuts that appear inside of declare forms have certain restrictions.
+ * Like other pointcuts, these pick out join points, but they do so in a
+ * way that is statically determinable.
+ *
+ * Consequently, such pointcuts may not include, directly or indirectly
+ * (through user-defined pointcut declarations) pointcuts that discriminate
+ * based on dynamic (runtime) context. Therefore, such pointcuts may not be
+ * defined in terms of
+ *
+ * cflow
+ * cflowbelow
+ * this
+ * target
+ * args
+ * if
+ *
+ * all of which can discriminate on runtime information.
+ */
+
+public aspect DeclareSoftDynamicPCDs {
+
+ declare soft : MyException:if(true) ;
+ pointcut p(): if(false);
+ declare soft : MyException: p() ;
+
+ declare soft : MyException:cflow(execution(* main(..)));
+ pointcut p2(): cflow(execution(* main(..)));
+ declare soft : MyException:p2();
+
+ declare soft : MyException:cflowbelow(execution(* main(..)));
+ pointcut p3(): cflowbelow(execution(* main(..)));
+ declare soft : MyException:p3();
+
+ declare soft : MyException: this(Object);
+ pointcut p4(): this(Object);
+ declare soft : MyException:p4();
+
+ declare soft : MyException:target(Object);
+ pointcut p5(): target(Object);
+ declare soft : MyException:p5();
+
+ declare soft : MyException:args(Object);
+ pointcut p6(): args(Object);
+ declare soft : MyException:p6();
+
+ class MyException extends Exception {
+ }
+
+ public static void main(String[] args) {
+ System.err.println("In main!");
+ }
+
+} \ No newline at end of file