<compile files="While.java" options="-1.8"/>
</ajc-test>
+<ajc-test dir="bugs189/352389" title="overweaving">
+
+ <compile files="A.java Code.java" outjar="one.jar" options="-1.8 -showWeaveInfo">
+ <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'A' (A.java:2)"/>
+ </compile>
+ <run class="Code" classpath="$sandbox/one.jar">
+ <stdout>
+ <line text="a"/>
+ </stdout>
+ </run>
+
+ <!-- The non overweaving case would look like this -->
+ <compile files="B.java" inpath="one.jar" options="-1.8 -showWeaveInfo" outjar="two.jar">
+ <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'B' (B.java:2)"/>
+ <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'A' (one.jar!A.class:2(from A.java))"/>
+ </compile>
+
+ <!-- With overweaving it looks like the advice from A isn't applying but it just isn't applying during this weave step, it
+ remains in the bytecode applied from before. -->
+ <compile files="B.java" inpath="one.jar" options="-1.8 -Xset:pipelineCompilation=false{overWeaving=true -showWeaveInfo" outjar="two.jar">
+ <message kind="warning" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
+ <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'B' (B.java:2)"/>
+ </compile>
+ <!-- Note: with overweaving output is b>a without overweaving it is a>b -->
+ <run class="Code" classpath="$sandbox/two.jar">
+ <stdout>
+ <line text="b"/>
+ <line text="a"/>
+ </stdout>
+ </run>
+
+ <compile files="C.java" inpath="two.jar" options="-1.8 -Xset:overWeaving=true -showWeaveInfo" outjar="three.jar">
+ <message kind="warning" text="advice defined in A has not been applied [Xlint:adviceDidNotMatch]"/>
+ <message kind="warning" text="advice defined in B has not been applied [Xlint:adviceDidNotMatch]"/>
+ <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'C' (C.java:2)"/>
+ </compile>
+ <!--
+ <compile files="C.java" inpath="two.jar" options="-1.8 -showWeaveInfo" outjar="three.jar">
+ <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'C' (C.java:2)"/>
+ <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'B' (two.jar!B.class:2(from B.java))"/>
+ <message kind="weave" text="Join point 'method-execution(void Code.m())' in Type 'Code' (Code.java:6) advised by before advice from 'A' (two.jar!A.class:2(from A.java))"/>
+ </compile>
+ -->
+ <!-- Note: with overweaving c>b>a but without overweaving a>b>c -->
+ <run class="Code" classpath="$sandbox/three.jar">
+ <stdout>
+ <line text="c"/>
+ <line text="b"/>
+ <line text="a"/>
+ </stdout>
+ </run>
+</ajc-test>
+
</suite>
UnwovenClassFile jc = i.next();
String name = jc.getClassName();
ResolvedType type = world.resolve(name);
- if (type.isAspect() && !world.isOverWeaving()) {
+ // No overweaving guard. If you have one then when overweaving is on the
+ // addOrReplaceAspect will not be called when the aspect delegate changes from
+ // EclipseSourceType to BcelObjectType. This will mean the mungers
+ // are not picked up.
+ if (type.isAspect()) {
needToReweaveWorld |= xcutSet.addOrReplaceAspect(type);
}
}