return typeMungers;
}
+ public boolean doesNotExposeShadowMungers() {
+ return true;
+ }
+
}
<message kind="error" line="14"/>
</compile>
</ajc-test>
+
+ <ajc-test dir="bugs/cflowAndJar" pr="39462"
+ title="Compiler crashes in jar and cflow (with no .jar)">
+ <compile files="TestAspect.aj,Test.java,AbstractAspect.aj">
+ <message kind="warning" line="16"/>
+ </compile>
+ <run class="Test"/>
+ </ajc-test>
+
+ <ajc-test dir="bugs/cflowAndJar" pr="39462"
+ title="Compiler crashes in jar and cflow (with .jar)"
+ comment="make lib.jar with ajc -outjar lib.jar AbstractAspect.aj">
+ <compile files="TestAspect.aj,Test.java" aspectpath="lib.jar">
+ <message kind="warning" line="16"/>
+ </compile>
+ <run class="Test"/>
+ </ajc-test>
</suite>
<!-- contains valid tests that the compiler has never passed -->
<suite>
- <ajc-test dir="bugs/cflowAndJar" pr="39462"
- title="Compiler crashes in jar and cflow"
- comment="make lib.jar with ajc -outjar lib.jar AbstractAspect.aj">
- <compile files="lib.jar,TestAspect.aj,Test.java"/>
- <run class="Test"/>
- </ajc-test>
+
</suite>
public abstract aspect AbstractAspect{\r
public abstract pointcut directCall();\r
+ \r
before(): directCall(){\r
- System.out.println("direct");\r
+ noteDirectCall();\r
}\r
+ \r
+ abstract void noteDirectCall();\r
+ \r
+ public abstract pointcut badCall();\r
+ \r
+ declare warning: badCall(): "bad";\r
}\r
-public class Test{
+import org.aspectj.testing.Tester;
+
+public class Test {
public static void main(String[] arguments){
Test test = new Test();
- test.sayHello();
+ Tester.checkEqual(TestAspect.sawDirectCall, false, "no calls");
+
test.doSayHello();
+ Tester.checkEqual(TestAspect.sawDirectCall, false, "non-cflow");
+
+ test.sayHello();
+ Tester.checkEqual(TestAspect.sawDirectCall, true, "in-cflow");
}
public void sayHello(){
public aspect TestAspect extends AbstractAspect{\r
public pointcut directCall():\r
execution(void Test.doSayHello(..))\r
- && cflow(execution(void Test.direct(..)))\r
+ && cflow(execution(void Test.sayHello(..)))\r
;\r
+ \r
+ public pointcut badCall():\r
+ call(void Test.doSayHello(..)) && withincode(void Test.sayHello(..));\r
+\r
+ void noteDirectCall() {\r
+ sawDirectCall = true;\r
+ }\r
+ \r
+ public static boolean sawDirectCall = false;\r
}\r
private final Collection collectShadowMungers() {
- if (! this.isAspect() || this.isAbstract()) return Collections.EMPTY_LIST;
+ if (! this.isAspect() || this.isAbstract() || this.doesNotExposeShadowMungers()) return Collections.EMPTY_LIST;
ArrayList acc = new ArrayList();
final Iterators.Filter dupFilter = Iterators.dupFilter();
return acc;
}
+ protected boolean doesNotExposeShadowMungers() {
+ return false;
+ }
+
public PerClause getPerClause() { return null; }
protected Collection getDeclares() {
return Collections.EMPTY_LIST;
public void setStartPos(int startPos) {
this.startPos = startPos;
}
+
+ public boolean doesNotExposeShadowMungers() {
+ return delegate.doesNotExposeShadowMungers();
+ }
}
// return sourceContext;
// }
+ /**
+ * Designed to be overriden by EclipseType to disable collection of shadow mungers
+ * during pre-weave compilation phase
+ */
+ public boolean doesNotExposeShadowMungers() {
+ return false;
+ }
+
public boolean isExposedToWeaver() {
return exposedToWeaver;
}