Community
Participate
Working Groups
A declare parents ITD that extends one interface with another interface is not applied if: - the new parent interface is supplied on the inpath - the jar or classes folder specified on the inpath has the package root at the root of the jar or classes folder See the attached test case. To run the test case: - edit the three build*.sh scripts and set AJHOME and PROJHOME appropriately - make sure you have the right java on the path, or edit the build scripts to invoke the right java - run test.sh - inspect the results* files Then: proj1/jar/proj1.jar is a jar with a non-package internal structure. proj1/jar/proj1v2.jar is a jar with an internal structure that follows the package structure. With AspectJ 1.7, supplying proj1.jar on the inpath results in sucessful weaving of the interface ITD specified in proj2/src/test/extender/Extender.aj, but supplying proj1v2.jar results in no weaving. With either jar the class ITD is successful. AspectJ 1.6.10 works for both class and interface ITDs with either input jar. For example, in result_1.7_fromjar we see: Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'test.extender.InterfaceProj2' (Extender.aj) for the first compilation run (lines 1-31), but this message is missing for the second compilation run (lines 32-end)
Created attachment 242263 [details] testcase
I actually dug into this a bit and distilled out the first of the issues. I have these files (thanks for the test code!): InterfaceProj1.java ==== package test; public interface InterfaceProj1<T> { public abstract int aMethod(); } ==== Extender.aj ==== package test.extender; import test.*; public aspect Extender { declare parents: InterfaceProj1 extends InterfaceProj2; } ==== InterfaceProj2.java ==== package test.extender; public interface InterfaceProj2<T> { public abstract int bMethod(); } ==== I compile a jar: ajc -1.5 InterfaceProj1.java -outjar code.jar I then apply the aspect: ajc -1.5 -showWeaveInfo Extender.aj InterfaceProj2.java -inpath code.jar -d output 1.6.10 produces: Extending interface set for type 'test.InterfaceProj1' (InterfaceProj1.java) to include 'test.extender.InterfaceProj2' (Extender.aj) 1.7 does not produce that message, and neither does 1.8. And this does not happen if InterfaceProj1 is not generic. This pointed me to the problem and I just committed a fix. I think there are further issues so am continuing to look at it.
Two more issues came out of the test code. Both related to ordering and whether the weaver was processing ClassProj1 before InterfaceProj1. If it saw ClassProj1 first it would see InterfaceProj1<T> as the super type, process it (badly) and then fail to do the right thing for the real InterfaceProj1 (raw type). I have fixes for these things but they are a bit serious and I don't want to damage 1.8.1 unnecessarily since that release is primarily about improving the java8 support. So I'll stuff them in a branch until i get a chance to revisit (bug433351 branch).
After Jaime reminded me, I've dug up the branch and moved the test cases and fixes from it into the mainline, will be in 1.8.9. I'm still a *little* nervous since it disturbs a key hierarchy weaving algorithm, but these changes pass all the existing tests and the new tests.