aboutsummaryrefslogtreecommitdiffstats
path: root/tests/new/typepatternmatch
diff options
context:
space:
mode:
authorwisberg <wisberg>2002-12-16 18:51:06 +0000
committerwisberg <wisberg>2002-12-16 18:51:06 +0000
commit144143c2970a1e874d74cdbd0f8c622d4282a3c3 (patch)
treeb12383d3d9e76c7e1f25f7fbec83051ef17f81fb /tests/new/typepatternmatch
parentfafae443719b26159ab2d7dac1c9b46b5e00b671 (diff)
downloadaspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.tar.gz
aspectj-144143c2970a1e874d74cdbd0f8c622d4282a3c3.zip
initial version
Diffstat (limited to 'tests/new/typepatternmatch')
-rw-r--r--tests/new/typepatternmatch/pack1/IntroErrorLocation.java41
-rw-r--r--tests/new/typepatternmatch/pack2/TargetClass.java8
2 files changed, 49 insertions, 0 deletions
diff --git a/tests/new/typepatternmatch/pack1/IntroErrorLocation.java b/tests/new/typepatternmatch/pack1/IntroErrorLocation.java
new file mode 100644
index 000000000..3b5b397db
--- /dev/null
+++ b/tests/new/typepatternmatch/pack1/IntroErrorLocation.java
@@ -0,0 +1,41 @@
+
+package typepatternmatch.pack1;
+import org.aspectj.testing.Tester;
+import org.aspectj.testing.Tester;
+
+/**
+ * FYI the compiler will not warn when a TypePattern matches no type/class.
+ * From an email to user from Stefan
+ */
+public class IntroErrorLocation {
+ /** change to true if the compiler ever should weave in by finding type? */
+ public static volatile boolean EXPECT_INIT = false;
+ /** signifies that the initialization advice was run */
+ public static final String INIT_SIGNAL = "init";
+ static {
+ if (EXPECT_INIT) Tester.event(INIT_SIGNAL);
+ }
+ public static void main(String[] args) {
+ typepatternmatch.pack2.TargetClass target
+ = new typepatternmatch.pack2.TargetClass();
+ Tester.checkAllEvents();
+ }
+}
+
+aspect MyIntroductionAspect {
+
+ /** @testTarget typepattern.nonmatching.introduction.method */
+ public String TargetClass.introMethod(String s) { // fails to match typepattern in other package
+ return s;
+ }
+ /** @testTarget signature.nonmatching.advice.initialization */
+ after (typepatternmatch.pack2.TargetClass c)
+ : initialization(TargetClass.new()) && this(c) { // fails to match signature in other package
+ final String test = IntroErrorLocation.INIT_SIGNAL;
+ if (IntroErrorLocation.EXPECT_INIT) {
+ //Tester.event(c.introMethod(test)); // todo add positive: passed
+ }
+ // compiler error here is correct: no such method; no introMethod b/c TargetClass not matched
+ Tester.checkEqual(test, c.introMethod(test), "Round trip failed"); // correct compiler error
+ }
+}
diff --git a/tests/new/typepatternmatch/pack2/TargetClass.java b/tests/new/typepatternmatch/pack2/TargetClass.java
new file mode 100644
index 000000000..afb567423
--- /dev/null
+++ b/tests/new/typepatternmatch/pack2/TargetClass.java
@@ -0,0 +1,8 @@
+
+package typepatternmatch.pack2;
+
+/**
+ */
+// PR#TODO
+public class TargetClass {
+}