diff options
5 files changed, 54 insertions, 9 deletions
diff --git a/tests/features169/itdInnerTypes/separate/Basic.java b/tests/features169/itdInnerTypes/separate/Basic.java new file mode 100644 index 000000000..b76e6a43f --- /dev/null +++ b/tests/features169/itdInnerTypes/separate/Basic.java @@ -0,0 +1,11 @@ +public class Basic { + public static void main(String []argv) { + new _(); + System.out.println("done"); + } +} + +aspect XX { + public static class Basic._ { + } +} diff --git a/tests/features169/itdInnerTypes/separate/Basic2.java b/tests/features169/itdInnerTypes/separate/Basic2.java new file mode 100644 index 000000000..f44b45b3d --- /dev/null +++ b/tests/features169/itdInnerTypes/separate/Basic2.java @@ -0,0 +1,6 @@ +public class Basic2 { + public static void main(String []argv) { + new Basic._(); + System.out.println("done"); + } +} diff --git a/tests/src/org/aspectj/systemtest/ajc169/AllTestsAspectJ169.java b/tests/src/org/aspectj/systemtest/ajc169/AllTestsAspectJ169.java index 485a71a69..f143fca99 100644 --- a/tests/src/org/aspectj/systemtest/ajc169/AllTestsAspectJ169.java +++ b/tests/src/org/aspectj/systemtest/ajc169/AllTestsAspectJ169.java @@ -20,7 +20,7 @@ public class AllTestsAspectJ169 { // $JUnit-BEGIN$ suite.addTest(Ajc169Tests.suite()); suite.addTest(TransparentWeavingTests.suite()); - // suite.addTest(IntertypeTests.suite()); + suite.addTest(IntertypeTests.suite()); // $JUnit-END$ return suite; } diff --git a/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java b/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java index de419eab7..6719b16ba 100644 --- a/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java +++ b/tests/src/org/aspectj/systemtest/ajc169/IntertypeTests.java @@ -43,6 +43,23 @@ import org.aspectj.testing.XMLBasedAjcTestCase; */ public class IntertypeTests extends org.aspectj.testing.XMLBasedAjcTestCase { + /** + * This is testing that on a secondary compile we can work out what happened in the first compile (where an inner type was + * intertyped onto another type). I think we need two conditions to be true for this to pass: <br> + * 1) we need an innerclass attribute on the target type <br> + * 2) we need the name of the innerclass to match its target rather than the declaring aspect<br> + * Line 277 in ClassScope:<br> + * + * memberTypeBindings[count++] = memberScope.buildType(sourceType, sourceType.fPackage, accessRestriction);<br> + * which then: builds the name based on the containing aspect. + * + * TypeDeclaration.generateCode() + * + */ + public void testSeparateCompilation() throws Exception { + runTest("separate compilation"); + } + public void testErrorTargettingTypeThatAlreadyHasIt() { runTest("already has it"); } diff --git a/tests/src/org/aspectj/systemtest/ajc169/intertype.xml b/tests/src/org/aspectj/systemtest/ajc169/intertype.xml index b7d63078f..de6854faf 100644 --- a/tests/src/org/aspectj/systemtest/ajc169/intertype.xml +++ b/tests/src/org/aspectj/systemtest/ajc169/intertype.xml @@ -2,9 +2,20 @@ <suite> + <ajc-test dir="features169/itdInnerTypes/separate" title="separate compilation"> + <compile files="Basic.java" options="-1.5"/> + <compile files="Basic2.java"/> + <run class="Basic2"> + <stdout> + <line text="done"/> + </stdout> + </run> + </ajc-test> + <ajc-test dir="features169/itdInnerTypes/eleven" title="already has it"> <compile files="Target.java Aspect1.java" options="-1.5"> - <message kind="error" text="target type already declares a member type with the name 'Inner'"/> + <message kind="error" text="Duplicate nested type Inner"/> + <message kind="error" text="target type already declares a "/> </compile> </ajc-test> @@ -49,7 +60,7 @@ <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Underscorer$_$choice)"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)"/> </stdout> </run> </ajc-test> @@ -59,7 +70,7 @@ <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Underscorer$_$choice)"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)"/> </stdout> </run> </ajc-test> @@ -69,7 +80,7 @@ <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Underscorer$_$choice)"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)"/> </stdout> </run> </ajc-test> @@ -79,7 +90,7 @@ <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote_Amender$_$choice)"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)"/> </stdout> </run> </ajc-test> @@ -89,7 +100,7 @@ <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote_Amender$_$choice)"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)"/> </stdout> </run> </ajc-test> @@ -99,7 +110,7 @@ <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote_Amender$_$choice)"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_$choice)"/> </stdout> </run> </ajc-test> @@ -109,7 +120,7 @@ <run class="a.b.c.Runner"> <stdout> <line text="wibble"/> - <line text="@a.b.c.RelatedType(value=class a.b.c.Vote_Amender$_)"/> + <line text="@a.b.c.RelatedType(value=class a.b.c.Vote$_)"/> </stdout> </run> </ajc-test> |