From 09bd9cbc83d87fa910e323003707a1ae95a96750 Mon Sep 17 00:00:00 2001 From: aclement Date: Wed, 20 Feb 2008 21:07:44 +0000 Subject: [PATCH] 214559: tests and fix: cope with varying orderings for interdependant declare parents statements. --- .../DeclareParentsPrecedenceTest.java | 8 +++++++ tests/bugs160/pr214559/Interface1.java | 1 + .../bugs160/pr214559/Interface1TestClass.java | 1 + tests/bugs160/pr214559/TestAspect.java | 7 ++++++ tests/bugs160/pr214559/TestClass.java | 1 + tests/bugs160/pr214559/X.java | 23 +++++++++++++++++++ tests/bugs160/pr214559/Y.java | 20 ++++++++++++++++ .../systemtest/ajc160/Ajc160Tests.java | 5 +++- .../org/aspectj/systemtest/ajc160/ajc160.xml | 15 ++++++++++++ 9 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 tests/bugs160/pr214559/DeclareParentsPrecedenceTest.java create mode 100644 tests/bugs160/pr214559/Interface1.java create mode 100644 tests/bugs160/pr214559/Interface1TestClass.java create mode 100644 tests/bugs160/pr214559/TestAspect.java create mode 100644 tests/bugs160/pr214559/TestClass.java create mode 100644 tests/bugs160/pr214559/X.java create mode 100644 tests/bugs160/pr214559/Y.java diff --git a/tests/bugs160/pr214559/DeclareParentsPrecedenceTest.java b/tests/bugs160/pr214559/DeclareParentsPrecedenceTest.java new file mode 100644 index 000000000..fdf77f02c --- /dev/null +++ b/tests/bugs160/pr214559/DeclareParentsPrecedenceTest.java @@ -0,0 +1,8 @@ + +public class DeclareParentsPrecedenceTest { + public static void main(String[]argv) { + TestClass t = new TestClass(); + if (!(t instanceof Interface1)) throw new RuntimeException("t not instanceof Interface1"); + if (!(t instanceof Interface1TestClass)) throw new RuntimeException("t not instanceof Interface1TestClass"); + } +} diff --git a/tests/bugs160/pr214559/Interface1.java b/tests/bugs160/pr214559/Interface1.java new file mode 100644 index 000000000..5ad8405b8 --- /dev/null +++ b/tests/bugs160/pr214559/Interface1.java @@ -0,0 +1 @@ +interface Interface1 {} diff --git a/tests/bugs160/pr214559/Interface1TestClass.java b/tests/bugs160/pr214559/Interface1TestClass.java new file mode 100644 index 000000000..ae149a479 --- /dev/null +++ b/tests/bugs160/pr214559/Interface1TestClass.java @@ -0,0 +1 @@ +interface Interface1TestClass {} diff --git a/tests/bugs160/pr214559/TestAspect.java b/tests/bugs160/pr214559/TestAspect.java new file mode 100644 index 000000000..65356014d --- /dev/null +++ b/tests/bugs160/pr214559/TestAspect.java @@ -0,0 +1,7 @@ +aspect TestAspect { + declare parents: + TestClass implements Interface1; + + declare parents: + TestClass && Interface1+ implements Interface1TestClass; +} diff --git a/tests/bugs160/pr214559/TestClass.java b/tests/bugs160/pr214559/TestClass.java new file mode 100644 index 000000000..90caf0722 --- /dev/null +++ b/tests/bugs160/pr214559/TestClass.java @@ -0,0 +1 @@ +class TestClass {} diff --git a/tests/bugs160/pr214559/X.java b/tests/bugs160/pr214559/X.java new file mode 100644 index 000000000..7f2861b53 --- /dev/null +++ b/tests/bugs160/pr214559/X.java @@ -0,0 +1,23 @@ + +package test; + +public class X { + public static void main(String[]argv) { + TestClass t = new TestClass(); + if (!(t instanceof Interface1)) throw new RuntimeException("t not instanceof Interface1"); + if (!(t instanceof Interface1TestClass)) throw new RuntimeException("t not instanceof Interface1TestClass"); + } +} + +interface Interface1 {} + +interface Interface1TestClass {} + +aspect TestAspect { + declare parents: + TestClass implements Interface1; + + declare parents: + TestClass && Interface1+ implements Interface1TestClass; +} +class TestClass {} diff --git a/tests/bugs160/pr214559/Y.java b/tests/bugs160/pr214559/Y.java new file mode 100644 index 000000000..c1efa1e92 --- /dev/null +++ b/tests/bugs160/pr214559/Y.java @@ -0,0 +1,20 @@ + +public class Y { + public static void main(String[]argv) { + TestClass t = new TestClass(); + if (!(t instanceof Interface1)) throw new RuntimeException("t not instanceof Interface1"); + if (!(t instanceof Interface1TestClass)) throw new RuntimeException("t not instanceof Interface1TestClass"); + } +} + +interface Interface1 {} + +interface Interface1TestClass {} + +aspect TestAspect { + declare parents: TestClass implements Interface1; + + declare parents: TestClass && Interface1+ implements Interface1TestClass; +} + +class TestClass {} diff --git a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java index 3c49de7fc..b35347709 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java +++ b/tests/src/org/aspectj/systemtest/ajc160/Ajc160Tests.java @@ -28,7 +28,10 @@ public class Ajc160Tests extends org.aspectj.testing.XMLBasedAjcTestCase { public void testGenericsSuperITD_pr206911() { runTest("generics super itd"); } public void testGenericsSuperITD_pr206911_2() { runTest("generics super itd - 2"); } public void testSerializationAnnotationStyle_pr216311() { runTest("serialization and annotation style");} - + public void testDecpRepetition_pr214559() { runTest("decp repetition problem");} // all code in one file + public void testDecpRepetition_pr214559_2() { runTest("decp repetition problem - 2");} // all code in one file, default package + public void testDecpRepetition_pr214559_3() { runTest("decp repetition problem - 3");} // across multiple files + ///////////////////////////////////////// public static Test suite() { return XMLBasedAjcTestCase.loadSuite(Ajc160Tests.class); diff --git a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml index 99cb1b17d..fdf8f0dd9 100644 --- a/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml +++ b/tests/src/org/aspectj/systemtest/ajc160/ajc160.xml @@ -45,5 +45,20 @@ + + + + + + + + + + + + + + + \ No newline at end of file -- 2.39.5