aboutsummaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authoracolyer <acolyer>2005-09-02 10:40:19 +0000
committeracolyer <acolyer>2005-09-02 10:40:19 +0000
commit047173e8683e4ab9004ae2151a8abad886d1b84b (patch)
tree7c70cd87214752972d5159ec43e52d4b703345d5 /tests
parentad753aa80558748ab918988809ba6f58b8c26419 (diff)
downloadaspectj-047173e8683e4ab9004ae2151a8abad886d1b84b.tar.gz
aspectj-047173e8683e4ab9004ae2151a8abad886d1b84b.zip
tests and fix for pr99136 (dup adviceDidNotMatch warnings), plus extended testing for pr105479
Diffstat (limited to 'tests')
-rw-r--r--tests/bugs150/pr105479/Driver.java10
-rw-r--r--tests/bugs150/pr105479/ReturnTypeTest.aj13
-rw-r--r--tests/bugs150/pr105479/ReturnTypeTester.java14
-rw-r--r--tests/bugs150/pr105479part2.aj39
-rw-r--r--tests/harness/XLintcflow.java6
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/ajc150/ajc150.xml26
-rw-r--r--tests/src/org/aspectj/systemtest/xlint/XLintTests.java7
-rw-r--r--tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml7
9 files changed, 128 insertions, 1 deletions
diff --git a/tests/bugs150/pr105479/Driver.java b/tests/bugs150/pr105479/Driver.java
new file mode 100644
index 000000000..6bc4b1bfc
--- /dev/null
+++ b/tests/bugs150/pr105479/Driver.java
@@ -0,0 +1,10 @@
+public class Driver {
+
+ public static void main(String[] args) {
+ ReturnTypeTester rtt = new ReturnTypeTester();
+ rtt.hashCode();
+ System.out.println(rtt.getId());
+ if (rtt.hashCode() != "id".hashCode()) throw new RuntimeException("dispatch failure");
+ }
+
+} \ No newline at end of file
diff --git a/tests/bugs150/pr105479/ReturnTypeTest.aj b/tests/bugs150/pr105479/ReturnTypeTest.aj
new file mode 100644
index 000000000..108c5319d
--- /dev/null
+++ b/tests/bugs150/pr105479/ReturnTypeTest.aj
@@ -0,0 +1,13 @@
+public aspect ReturnTypeTest {
+ private interface Test {
+ Object getId();
+ int hashCode();
+ }
+
+ public int Test.hashCode() {
+ System.out.println("in Test.hashCode()");
+ return getId().hashCode();
+ }
+
+ declare parents : ReturnTypeTester implements Test;
+} \ No newline at end of file
diff --git a/tests/bugs150/pr105479/ReturnTypeTester.java b/tests/bugs150/pr105479/ReturnTypeTester.java
new file mode 100644
index 000000000..b26445e1c
--- /dev/null
+++ b/tests/bugs150/pr105479/ReturnTypeTester.java
@@ -0,0 +1,14 @@
+import java.util.HashSet;
+import java.util.Set;
+
+public class ReturnTypeTester {
+ static Set<ReturnTypeTester> set = new HashSet<ReturnTypeTester>();
+ static {
+ ReturnTypeTester tester = new ReturnTypeTester();
+ set.add(tester);
+ }
+
+ public String getId() {
+ return "id";
+ }
+} \ No newline at end of file
diff --git a/tests/bugs150/pr105479part2.aj b/tests/bugs150/pr105479part2.aj
new file mode 100644
index 000000000..0a2d39438
--- /dev/null
+++ b/tests/bugs150/pr105479part2.aj
@@ -0,0 +1,39 @@
+import java.util.HashSet;
+import java.util.Set;
+
+aspect ReturnTypeTest {
+ private interface Test {
+ Object getId();
+ int hashCode();
+ }
+
+ public int Test.hashCode() {
+ System.out.println("in Test.hashCode()");
+ return getId().hashCode();
+ }
+
+ declare parents : ReturnTypeTester implements Test;
+}
+
+class ReturnTypeTester {
+ static Set<ReturnTypeTester> set = new HashSet<ReturnTypeTester>();
+ static {
+ ReturnTypeTester tester = new ReturnTypeTester();
+ set.add(tester);
+ }
+
+ public String getId() {
+ return "id";
+ }
+}
+
+public class pr105479part2 {
+
+ public static void main(String[] args) {
+ ReturnTypeTester rtt = new ReturnTypeTester();
+ rtt.hashCode();
+ System.out.println(rtt.getId());
+ if (rtt.hashCode() != "id".hashCode()) throw new RuntimeException("dispatch failure");
+ }
+
+} \ No newline at end of file
diff --git a/tests/harness/XLintcflow.java b/tests/harness/XLintcflow.java
new file mode 100644
index 000000000..e77445b6e
--- /dev/null
+++ b/tests/harness/XLintcflow.java
@@ -0,0 +1,6 @@
+// "Two Xlint warnings wth cflow?"
+
+aspect A {
+ before(): call(* *(..)) && cflow(execution(* *(..))) {
+ }
+}
diff --git a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
index af147c2bf..4f6d82ac4 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
+++ b/tests/src/org/aspectj/systemtest/ajc150/Ajc150Tests.java
@@ -362,6 +362,13 @@ public class Ajc150Tests extends org.aspectj.testing.XMLBasedAjcTestCase {
runTest("parse generic type signature with parameterized type in interface");
}
+ public void testOverrideAndCovarianceWithDecPRuntime() {
+ runTest("override and covariance with decp - runtime");
+ }
+
+ public void testOverrideAndCovarianceWithDecPRuntimeMultiFiles() {
+ runTest("override and covariance with decp - runtime separate files");
+ }
// helper methods.....
public SyntheticRepository createRepos(File cpentry) {
diff --git a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
index f6e20ebc8..f36716f53 100644
--- a/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
+++ b/tests/src/org/aspectj/systemtest/ajc150/ajc150.xml
@@ -432,7 +432,31 @@
<ajc-test dir="bugs150" pr="108602" title="parse generic type signature with parameterized type in interface">
<compile files="pr108602.java" options="-1.5"/>
</ajc-test>
-
+
+ <ajc-test dir="bugs150" pr="105479" title="override and covariance with decp - runtime">
+ <compile files="pr105479part2.aj" options="-1.5"/>
+ <run class="pr105479part2">
+ <stdout>
+ <line text="in Test.hashCode()"/>
+ <line text="in Test.hashCode()"/>
+ <line text="id"/>
+ <line text="in Test.hashCode()"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
+ <ajc-test dir="bugs150/pr105479" pr="105479" title="override and covariance with decp - runtime separate files">
+ <compile files="ReturnTypeTest.aj,ReturnTypeTester.java,Driver.java" options="-1.5"/>
+ <run class="Driver">
+ <stdout>
+ <line text="in Test.hashCode()"/>
+ <line text="in Test.hashCode()"/>
+ <line text="id"/>
+ <line text="in Test.hashCode()"/>
+ </stdout>
+ </run>
+ </ajc-test>
+
<!-- ============================================================================ -->
<!-- ============================================================================ -->
diff --git a/tests/src/org/aspectj/systemtest/xlint/XLintTests.java b/tests/src/org/aspectj/systemtest/xlint/XLintTests.java
index e113205c1..21e0fd1f9 100644
--- a/tests/src/org/aspectj/systemtest/xlint/XLintTests.java
+++ b/tests/src/org/aspectj/systemtest/xlint/XLintTests.java
@@ -105,6 +105,13 @@ public class XLintTests extends org.aspectj.testing.XMLBasedAjcTestCase {
// if (is15VMOrGreater)
// runTest("7 lint warnings");
// }
+
+ public void testBug99136(){
+ runTest("Two Xlint warnings wth cflow?");
+ if(ajc.getLastCompilationResult().getWarningMessages().size() != 1){
+ fail();
+ }
+ }
}
diff --git a/tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml b/tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml
index 1620fb5d3..05052cce7 100644
--- a/tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml
+++ b/tests/src/org/aspectj/systemtest/xlint/xlint-tests.xml
@@ -178,5 +178,12 @@
</compile>
</ajc-test>
-->
+
+ <ajc-test dir="harness"
+ title="Two Xlint warnings wth cflow?">
+ <compile files="XLintcflow.java" options="-1.5">
+ <message kind="warning" line="4" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
+ </compile>
+ </ajc-test>
\ No newline at end of file