aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoracolyer <acolyer>2004-01-07 13:10:07 +0000
committeracolyer <acolyer>2004-01-07 13:10:07 +0000
commitc517e8507cbc0be482d3eb1be2694e3f6486a4e3 (patch)
treebf367565a440bb3007b85213648e475eb0abfd59 /tests
parent6cded1d30cf1e59ee133ac08f44dabb7859b4fed (diff)
downloadaspectj-c517e8507cbc0be482d3eb1be2694e3f6486a4e3.tar.gz
aspectj-c517e8507cbc0be482d3eb1be2694e3f6486a4e3.zip
fix for bug 49457 - test for duplicate pointcut definitions in classes
Diffstat (limited to 'tests')
-rw-r--r--tests/ajcTests.xml20
-rw-r--r--tests/bugs/OverloadedPointcutsInAspect.java23
-rw-r--r--tests/bugs/OverloadedPointcutsInClass.java9
3 files changed, 52 insertions, 0 deletions
diff --git a/tests/ajcTests.xml b/tests/ajcTests.xml
index 09844ec3a..3f9841dc7 100644
--- a/tests/ajcTests.xml
+++ b/tests/ajcTests.xml
@@ -6802,4 +6802,24 @@
<compile files="concern/ContextUser.java,concern/BaseTarget.java,core/Base.java" />
</ajc-test>
+ <ajc-test dir="bugs" pr="49457"
+ title="No error on overloaded pointcuts in class">
+ <compile files="OverloadedPointcutsInClass.java">
+ <message kind="error" line="3" text="duplicate pointcut name: pc1"/>
+ <message kind="error" line="4" text="duplicate pointcut name: pc1"/>
+ <message kind="error" line="6" text="duplicate pointcut name: pc2"/>
+ <message kind="error" line="7" text="duplicate pointcut name: pc2"/>
+ </compile>
+ </ajc-test>
+
+ <ajc-test dir="bugs" pr="49457"
+ title="No error on overloaded pointcuts unless binding variables">
+ <compile files="OverloadedPointcutsInAspect.java">
+ <message kind="error" line="15" text="duplicate pointcut name: pc"/>
+ <message kind="error" line="16" text="duplicate pointcut name: pc"/>
+ <message kind="error" line="18" text="incompatible type"/>
+ <message kind="error" line="20" text="incompatible type"/>
+ </compile>
+ </ajc-test>
+
</suite>
diff --git a/tests/bugs/OverloadedPointcutsInAspect.java b/tests/bugs/OverloadedPointcutsInAspect.java
new file mode 100644
index 000000000..d483a1885
--- /dev/null
+++ b/tests/bugs/OverloadedPointcutsInAspect.java
@@ -0,0 +1,23 @@
+class OverloadedPointcutsInAspect {
+ public static void main(String[] args) {
+ new C().run();
+ }
+}
+class C {
+ public void run() {}
+}
+
+aspect A {
+ declare parents: C implements Runnable;
+ declare parents: C implements SubRunnable;
+ interface SubRunnable extends Runnable {}
+
+ pointcut pc(Runnable r) : target(r) && call(void run());
+ pointcut pc(SubRunnable r) : target(r) && call(void run());
+ before(Runnable r) : pc(r) { log("pc(Runnable r)"); }
+ before(SubRunnable r) : pc(r) { log("pc(SubRunnable r)"); }
+ before() : pc(Runnable) { log("pc(Runnable)"); }
+ before() : pc(SubRunnable) { log("pc(SubRunnable)"); }
+ before() : pc(*) { log("pc(*)"); }
+ void log(String s) { System.out.println(s); }
+}
diff --git a/tests/bugs/OverloadedPointcutsInClass.java b/tests/bugs/OverloadedPointcutsInClass.java
new file mode 100644
index 000000000..49aff6996
--- /dev/null
+++ b/tests/bugs/OverloadedPointcutsInClass.java
@@ -0,0 +1,9 @@
+public class OverloadedPointcutsInClass {
+
+ pointcut pc1(): call(* *(..));
+ pointcut pc1(): execution(* *(..));
+
+ pointcut pc2(String s): call(* *(..)) && target(s);
+ pointcut pc2(StringBuffer sb): call(* *(..)) && target(sb);
+
+}