summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoraclement <aclement>2004-08-10 16:22:01 +0000
committeraclement <aclement>2004-08-10 16:22:01 +0000
commitb75cd93e0de66996397e9f18809973abec91fe46 (patch)
treeb0685fd382e05305bf8342d2e9efea48cf8ced46 /tests
parent05dabd1821fffd9f353d1e965a56658b962c82d7 (diff)
downloadaspectj-b75cd93e0de66996397e9f18809973abec91fe46.tar.gz
aspectj-b75cd93e0de66996397e9f18809973abec91fe46.zip
Fix for Bugzilla Bug 65319
ajc crashes when compiling the following program (binding this() and target())
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs/oxford/PR65319.java30
-rw-r--r--tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml16
3 files changed, 52 insertions, 1 deletions
diff --git a/tests/bugs/oxford/PR65319.java b/tests/bugs/oxford/PR65319.java
new file mode 100644
index 000000000..2a00b9acd
--- /dev/null
+++ b/tests/bugs/oxford/PR65319.java
@@ -0,0 +1,30 @@
+class Test
+{
+ public static void main(String args[]) {
+ new Test().method();
+ }
+ public void method() {
+ new Test2().method2();
+ }
+
+ public void method3() {
+ new Test2().method3(new Test());
+ }
+
+ public void method4(Test t) {
+ new Test().method4(new Test());
+ }
+}
+class Test2 {
+ public void method2() {}
+ public void method3(Test t) {}
+}
+aspect Plain {
+ before(Test x): call(void *.* (..)) && (target(x) || this(x)) {}
+
+ before(Test x): call(void *.* (..)) && (this(x) || target(x)){}
+
+ before(Test x): call(void *.*(..)) && (this(x) || args(x)) {}
+
+ before(Test x): call(void *.*(..)) && (args(x) || target(x)) {}
+} \ No newline at end of file
diff --git a/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java b/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java
index 5a3c6d496..e32a91e37 100644
--- a/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc121/Ajc121Tests.java
@@ -10,7 +10,9 @@
package org.aspectj.systemtest.ajc121;
import java.io.File;
+
import junit.framework.Test;
+
import org.aspectj.testing.XMLBasedAjcTestCase;
public class Ajc121Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
@@ -139,5 +141,10 @@ public class Ajc121Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
public void test025_proceedInAround3() {
runTest("proceed used as method name in around advice (3)");
}
+
+ public void test026_bindingThisAndTargetToTheSameFormal() {
+ runTest("ajc crashes when compiling the following program (binding this() and target())");
+ }
+
}
diff --git a/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml b/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml
index 37ac4da2d..579adf58d 100644
--- a/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml
+++ b/tests/src/org/aspectj/systemtest/ajc121/ajc121-tests.xml
@@ -201,4 +201,18 @@
title="proceed used as method name in around advice (3)">
<compile files="Proceeding3.aj"/>
<run class="Proceeding3"/>
- </ajc-test> \ No newline at end of file
+ </ajc-test>
+
+ <ajc-test dir="bugs/oxford" pr="65319"
+ title="ajc crashes when compiling the following program (binding this() and target())">
+ <compile files="PR65319.java">
+ <message kind="error" line="7" text="Cannot use target() to match at this"/>
+ <message kind="error" line="7" text="Cannot use this() to match at this"/>
+ <message kind="error" line="11" text="Cannot use target() to match at this"/>
+ <message kind="error" line="11" text="Cannot use this() to match at this"/>
+ <message kind="error" line="11" text="Ambiguous binding of type Test"/>
+ <message kind="error" line="15" text="Cannot use target() to match at this"/>
+ <message kind="error" line="15" text="Cannot use this() to match at this"/>
+ <message kind="error" line="15" text="Ambiguous binding of type Test"/>
+ </compile>
+ </ajc-test>