aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoraclement <aclement>2006-04-24 14:58:39 +0000
committeraclement <aclement>2006-04-24 14:58:39 +0000
commitf6aaed5b40f403abc8640513d66beadc6b2e31a9 (patch)
treef3b44165dad2a4b8c30931013dd20be2db1c00fe
parent77d9906679b671488272fe62c8409bcc32bbb99c (diff)
downloadaspectj-f6aaed5b40f403abc8640513d66beadc6b2e31a9.tar.gz
aspectj-f6aaed5b40f403abc8640513d66beadc6b2e31a9.zip
test and fix for part2 of 138158
-rw-r--r--tests/bugs152/pr138158/Doo.java27
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java1
-rw-r--r--tests/src/org/aspectj/systemtest/ajc152/ajc152.xml7
-rw-r--r--weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java2
4 files changed, 36 insertions, 1 deletions
diff --git a/tests/bugs152/pr138158/Doo.java b/tests/bugs152/pr138158/Doo.java
new file mode 100644
index 000000000..fbc13bfe7
--- /dev/null
+++ b/tests/bugs152/pr138158/Doo.java
@@ -0,0 +1,27 @@
+import java.lang.annotation.*;
+
+@Retention(RetentionPolicy.RUNTIME)
+@interface Goo {}
+
+
+@Goo
+public class Doo {
+ public static void main(String []argv) {
+ new Doo().m(); // advises here
+ }
+
+ public void m() {
+ System.err.println("");
+ }
+}
+
+class Soo {
+ public void m() {
+ System.err.println("");
+ }
+}
+
+aspect X {
+ before(): call(* println(..)) && !@within(Goo) {
+ }
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
index 120cd10d2..de76cc76f 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc152/Ajc152Tests.java
@@ -19,6 +19,7 @@ public class Ajc152Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void testNotAtWithincode_pr138158_1() { runTest("not at withincode - 1");}
public void testNotAtWithincode_pr138158_2() { runTest("not at withincode - 2");}
+ public void testNotAtWithincode_pr138158_3() { runTest("not at within - 3");}
// public void testComplexGenericDecl_pr137568() { runTest("complicated generics declaration");}
public void testNpeOnDup_pr138143() { runTest("npe on duplicate method with ataj");}
public void testPointcutsAndGenerics_pr137496_1() { runTest("pointcuts and generics - B");}
diff --git a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
index 4147db02e..7fb993960 100644
--- a/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
+++ b/tests/src/org/aspectj/systemtest/ajc152/ajc152.xml
@@ -27,6 +27,13 @@
<run class="Boo"/>
</ajc-test>
+ <ajc-test dir="bugs152/pr138158" title="not at within - 3">
+ <compile files="Doo.java" options="-1.5 -showWeaveInfo">
+ <message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Soo' (Doo.java:20) advised by before advice from 'X' (Doo.java:25)"/>
+ </compile>
+ <run class="Doo"/>
+ </ajc-test>
+
<ajc-test dir="bugs152/pr138158" title="not at withincode - 2">
<compile files="Foo.java" options="-1.5 -showWeaveInfo">
<message kind="weave" text="Join point 'method-call(void java.io.PrintStream.println(java.lang.String))' in Type 'Foo' (Foo.java:14) advised by before advice from 'X' (Foo.java:26)"/>
diff --git a/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java b/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
index f2c5d8a88..4439079d6 100644
--- a/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
+++ b/weaver/src/org/aspectj/weaver/patterns/WithinAnnotationPointcut.java
@@ -143,7 +143,7 @@ public class WithinAnnotationPointcut extends NameBindingPointcut {
state.set(btp.getFormalIndex(),var);
}
- return Literal.TRUE;
+ return match(shadow).alwaysTrue() ? Literal.TRUE : Literal.FALSE;
}
/* (non-Javadoc)