Community
Participate
Working Groups
Found this problem while fixing a bug related to @Configurable support in Spring. If I use type pattern based on an interface introduced through 'declare parents' and then combine type pattern for that interface with other type pattern in another 'declare parents', it doesn't work (the second parent doesn't get introduced). Here is a test case that illustrates the problem: package test; import junit.framework.TestCase; public class DeclareParentPrecedenceTest extends TestCase { public void testParenting() { TestClass testObject = new TestClass(); assertTrue(testObject instanceof Interface1); // pass assertTrue(testObject instanceof Interface1TestClass); // fail } } aspect TestAspect { declare parents: TestClass implements Interface1; declare parents: TestClass && Interface1+ implements Interface1TestClass; } interface Interface1 { } interface Interface1TestClass { } class TestClass { } Interestingly enough: 1. If either TestClass or Interface1 is removed in the second 'declare parents' the test works. 2. If TestClass implements Interface1 directly (not through 'declare parents'), the test works.
Took me a while to get this to fail - it depends on the order in which the weaver chooses to apply the declare parents. Although the code is intended to loop around repeatedly applying them until a steady state is reached, this test showed a case that didn't work. fix committed.