Community
Participate
Working Groups
Discovered whilst migrating AspectJ to 1.6 JDT compiler. Commenting out these 3 tests until it is addressed (run the tests to see the problem): testSimplifiedGenericAspectITDTest(org.aspectj.systemtest.ajc150.Ajc150Tests) junit.framework.AssertionFailedError: test "spurious override method warning - 3" failed test "spurious override method warning - 3" failed Unexpected error messages: error at INode<P, C> getParent(); ^^^^^^ /private/tmp/ajcSandbox/workspace-aj-merge/ajcTest54148.tmp/SimpleTest.java:4:0::0 can't override INode<Tag,Tag> INode<Tag,Tag>.getParent() with INode<Parent,Child> INode.getParent() return types don't match error at public final INode<Parent, Child> INode.getParent() { ^^^^^^ /private/tmp/ajcSandbox/workspace-aj-merge/ajcTest54148.tmp/SimpleTest.java:10:0::0 can't override INode<Tag,Tag> INode<Tag,Tag>.getParent() with INode<Parent,Child> INode.getParent() return types don't match testSpuriousOverrideMethodWarning_pr119570_1(org.aspectj.systemtest.ajc150.Ajc150Tests) junit.framework.AssertionFailedError: test "spurious override method warning" failed test "spurious override method warning" failed Unexpected error messages: error at public final INode<Parent, Child> INode.getParent() { ^^^^^^ /private/tmp/ajcSandbox/workspace-aj-merge/ajcTest54149.tmp/NodeImpl.java:14:0::0 can't override bugsOtherPackage.INode<bugs.TaggedTexts$Tag,bugs.TaggedTexts$Tag> bugsOtherPackage.INode<bugs.TaggedTexts$Tag,bugs.TaggedTexts$Tag>.getParent() with bugsOtherPackage.INode<Parent,Child> bugsOtherPackage.INode.getParent() return types don't match error at INode<Parent, Child> getParent(); ^^^^^^ /private/tmp/ajcSandbox/workspace-aj-merge/ajcTest54149.tmp/INode.java:5:0::0 can't override bugsOtherPackage.INode<bugs.TaggedTexts$Tag,bugs.TaggedTexts$Tag> bugsOtherPackage.INode<bugs.TaggedTexts$Tag,bugs.TaggedTexts$Tag>.getParent() with bugsOtherPackage.INode<Parent,Child> bugsOtherPackage.INode.getParent() return types don't match testSpuriousOverrideMethodWarning_pr119570_2(org.aspectj.systemtest.ajc150.Ajc150Tests) junit.framework.AssertionFailedError: test "spurious override method warning - 2" failed test "spurious override method warning - 2" failed Unexpected error messages: error at public final INode<Parent, Child> INode.getParent() { ^^^^^^ /private/tmp/ajcSandbox/workspace-aj-merge/ajcTest54150.tmp/NodeImpl.java:14:0::0 can't override bugsOtherPackage.INode<bugs.TaggedTexts$Tag,bugs.TaggedTexts$Tag> bugsOtherPackage.INode<bugs.TaggedTexts$Tag,bugs.TaggedTexts$Tag>.getParent() with bugsOtherPackage.INode<Parent,Child> bugsOtherPackage.INode.getParent() return types don't match error at INode<Parent, Child> getParent(); ^^^^^^ /private/tmp/ajcSandbox/workspace-aj-merge/ajcTest54150.tmp/INode.java:5:0::0 can't override bugsOtherPackage.INode<bugs.TaggedTexts$Tag,bugs.TaggedTexts$Tag> bugsOtherPackage.INode<bugs.TaggedTexts$Tag,bugs.TaggedTexts$Tag>.getParent() with bugsOtherPackage.INode<Parent,Child> bugsOtherPackage.INode.getParent() return types don't match
Also this test: MultiProjectIncrementalTests.testPr119570
Also affects the other variations of 119570: MultiProjectIncrementalTests.testPr119570_2 and I just added a testPr119570_3 - a simpler form of the problem for debugging. Here is the full program: interface INode<Parent, Child> { INode<Parent, Child> getParent(); } abstract aspect NodeImpl<Parent, Child> { declare parents : Child implements INode<Parent, Child>; declare parents : Parent implements INode<Parent, Child>; private INode<Parent, Child> INode.fParent; public final INode<Parent, Child> INode.getParent() { return fParent; } } aspect PC extends NodeImpl<Tag, Tag> { } class Tag {} It goes wrong because when comparing the method on the interface INode<Parent,Child>.getParent() and the inter type munger INode<Parent,Child> Inode.getParent() we have correctly parameterized the method on the interface to INode<Tag,Tag>.getParent() but we only parameterize the ITD correctly if it shares type variables with the target type. In this case we don't and leave it as is. Parent,Child should have been set because the ITD was parameterized when 'collected up' from the sub-aspect to the concrete aspect. The collecting up mechanism does not exist for ITDs like it exists for pointcuts. So we fail to parameterize it then after noticing that the method on the interface is abstract we check that the ITD overrides the abstract method. Of course it does not because the return value doesn't match. It *would* match if the itd had been parameterized correctly. However, until a real person hits this problem and not me in some random sick testcase, I won't debug further...
unsetting the target field which is currently set for something already released