import java.io.File;
import java.io.FileOutputStream;
import java.lang.reflect.Method;
+import java.lang.reflect.InvocationTargetException;
import java.util.Map;
import java.util.WeakHashMap;
new Integer(bytes.length)
}
);
- } catch (Throwable t) {
- t.printStackTrace();
+ } catch (InvocationTargetException e) {
+ if (e.getTargetException() instanceof LinkageError) {
+ ;//is already defined (happens for X$ajcMightHaveAspect interfaces since aspects are reweaved)
+ } else {
+ e.printStackTrace();
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
}
}
URL xml = (URL) xmls.nextElement();
definitions.add(DocumentParser.parse(xml));
}
+
+ // still go thru if definitions is empty since we will configure
+ // the default message handler in there
registerOptions(weaver, loader, definitions);
registerAspectExclude(weaver, loader, definitions);
registerAspects(weaver, loader, definitions);
//FIXME dump option - dump what - dump before/after ?
public static WeaverOption parse(String options, ClassLoader laoder) {
+ if (LangUtil.isEmpty(options)) {
+ return new WeaverOption();
+ }
// the first option wins
List flags = LangUtil.anySplit(options, " ");
Collections.reverse(flags);
WeaverOption weaverOption = new WeaverOption();
- weaverOption.messageHandler = new DefaultMessageHandler();//default
-
// do a first round on the message handler since it will report the options themselves
for (Iterator iterator = flags.iterator(); iterator.hasNext();) {
} else {
weaverOption.messageHandler.handleMessage(
new Message(
- "Cannot configure weaver with option " + arg + ": unknown option",
+ "Cannot configure weaver with option '" + arg + "': unknown option",
IMessage.WARNING,
null,
null
boolean noInline;
boolean showWeaveInfo;
IMessageHandler messageHandler;
+
+ public WeaverOption() {
+ messageHandler = new DefaultMessageHandler();//default
+
+ //temp alex
+ messageHandler.dontIgnore(IMessage.WEAVEINFO);
+ messageHandler.dontIgnore(IMessage.INFO);
+ }
}
}
fail("main method in class " + className + " is not public");
} catch (InvocationTargetException invTgt) {
// the main method threw an exception...
- fail("Exception thrown by " + className + ".main(String[]) :" + invTgt.getTargetException());
+ fail("Exception thrown by " + className + ".main(String[]) :" + invTgt.getTargetException());
} finally {
System.setOut(systemOut);
System.setErr(systemErr);
<java fork="yes" classname="ataspectj.AroundInlineMungerTest" failonerror="yes">
<classpath refid="aj.path"/>
<jvmarg value="-javaagent:${aj.root}/lib/test/loadtime5.jar"/>
- <jvmarg value="-Daj5.def=ataspectj/aop.xml"/>
+ <jvmarg value="-Daj5.def=ataspectj/aop-aroundinlinemungertest.xml"/>
</java>
</target>
public void testAccessNonPublicFromAroundAdvice() {
target();
- assertEquals(3, Open.aroundCount);
- assertEquals(6, Open.beforeCount);
+ assertEquals(3, AroundInlineMungerTestAspects.Open.aroundCount);
+ assertEquals(6, AroundInlineMungerTestAspects.Open.beforeCount);
}
public void target() {}
- public static class OpenBase {
- protected void superMethod() {}
- }
-
- public static class OpenSubBase extends OpenBase {}
-
- // aspect will be prepared for inlining
- @Aspect
- public static class Open extends OpenSubBase {
-
- public static int aroundCount = 0;
- public static int beforeCount = 0;
-
- private int i;
- private static int I;
-
- @Around("execution(* ataspectj.AroundInlineMungerTest.target())")
- public Object around1(ProceedingJoinPoint jp) throws Throwable {
- aroundCount++;
- priv(1, 2L, 3);
- super.superMethod();
- new Inner().priv();//fails to be wrapped so this advice will not be inlined but previous call were still prepared
- return jp.proceed();
- }
-
- // this advice to test around advice body call/get/set advising
- @Before("(call(* ataspectj.AroundInlineMungerTest.Open.priv(..))" +
- " || get(int ataspectj.AroundInlineMungerTest.Open.i)" +
- " || set(int ataspectj.AroundInlineMungerTest.Open.i)" +
- " || get(int ataspectj.AroundInlineMungerTest.Open.I)" +
- " || set(int ataspectj.AroundInlineMungerTest.Open.I)" +
- " )&& this(ataspectj.AroundInlineMungerTest.Open)")
- public void before1() {
- beforeCount++;
- }
-
- @Around("execution(* ataspectj.AroundInlineMungerTest.target())")
- public Object around2(ProceedingJoinPoint jp) throws Throwable {
- aroundCount++;
- super.superMethod();
- new Inner().priv();//fails to be wrapped so next calls won't be prepared but previous was
- priv(1, 2L, 3);
- return jp.proceed();
- }
-
- @Around("execution(* ataspectj.AroundInlineMungerTest.target())")
- public Object around3(ProceedingJoinPoint jp) throws Throwable {
- aroundCount++;
- // all those field access will be wrapped
- int li = i;
- i = li;
- int lI = I;
- I = lI;
- return jp.proceed();
- }
-
- // -- some private member for which access will be wrapped so that around advice can be inlined
-
- private void priv(int i, long j, int k) {
- long l = i + j + k;
- }
-
- private static class Inner {
- private Inner() {}
- private void priv() {};
- }
- }
}
--- /dev/null
+/*******************************************************************************
+ * Copyright (c) 2005 Contributors.
+ * All rights reserved.
+ * This program and the accompanying materials are made available
+ * under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution and is available at
+ * http://eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Alexandre Vasseur initial implementation
+ *******************************************************************************/
+package ataspectj;
+
+import org.aspectj.lang.annotation.Aspect;
+import org.aspectj.lang.annotation.Around;
+import org.aspectj.lang.annotation.Before;
+import org.aspectj.lang.ProceedingJoinPoint;
+
+/**
+ * @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
+ */
+public class AroundInlineMungerTestAspects {
+
+ public static class OpenBase {
+ protected void superMethod() {}
+ }
+
+ public static class OpenSubBase extends OpenBase {}
+
+ // aspect will be prepared for inlining
+ @Aspect
+ public static class Open extends OpenSubBase {
+
+ public static int aroundCount = 0;
+ public static int beforeCount = 0;
+
+ private int i;
+ private static int I;
+
+ @Around("execution(* ataspectj.AroundInlineMungerTest.target())")
+ public Object around1(ProceedingJoinPoint jp) throws Throwable {
+ aroundCount++;
+ priv(1, 2L, 3);
+ super.superMethod();
+ new Open.Inner().priv();//fails to be wrapped so this advice will not be inlined but previous call were still prepared
+ return jp.proceed();
+ }
+
+ // this advice to test around advice body call/get/set advising
+ @Before("(call(* ataspectj.AroundInlineMungerTestAspects.Open.priv(..))" +
+ " || get(int ataspectj.AroundInlineMungerTestAspects.Open.i)" +
+ " || set(int ataspectj.AroundInlineMungerTestAspects.Open.i)" +
+ " || get(int ataspectj.AroundInlineMungerTestAspects.Open.I)" +
+ " || set(int ataspectj.AroundInlineMungerTestAspects.Open.I)" +
+ " )&& this(ataspectj.AroundInlineMungerTestAspects.Open)")
+ public void before1() {
+ beforeCount++;
+ }
+
+ @Around("execution(* ataspectj.AroundInlineMungerTest.target())")
+ public Object around2(ProceedingJoinPoint jp) throws Throwable {
+ aroundCount++;
+ super.superMethod();
+ new Open.Inner().priv();//fails to be wrapped so next calls won't be prepared but previous was
+ priv(1, 2L, 3);
+ return jp.proceed();
+ }
+
+ @Around("execution(* ataspectj.AroundInlineMungerTest.target())")
+ public Object around3(ProceedingJoinPoint jp) throws Throwable {
+ aroundCount++;
+ // all those field access will be wrapped
+ int li = i;
+ i = li;
+ int lI = I;
+ I = lI;
+ return jp.proceed();
+ }
+
+ // -- some private member for which access will be wrapped so that around advice can be inlined
+
+ private void priv(int i, long j, int k) {
+ long l = i + j + k;
+ }
+
+ private static class Inner {
+ private Inner() {}
+ private void priv() {};
+ }
+ }
+
+}
Enumeration e = rr.failures();
while (e.hasMoreElements()) {
sb.append("JUnit Failure: ");
- sb.append(((TestFailure)e.nextElement()).thrownException().toString());
+ TestFailure failure = (TestFailure)e.nextElement();
+ sb.append(failure.thrownException().toString());
sb.append("\n");
}
e = rr.errors();
while (e.hasMoreElements()) {
sb.append("JUnit Error: ");
- sb.append(((TestFailure)e.nextElement()).thrownException().toString());
+ TestFailure failure = (TestFailure)e.nextElement();
+ sb.append(failure.thrownException().toString());
sb.append("\n");
}
throw new RuntimeException(sb.toString());
--- /dev/null
+<?xml version="1.0"?>
+<aspectj>
+ <weaver options="-XmessageHolderClass:ataspectj.TestHelper"/>
+ <aspects>
+ <aspect name="ataspectj.AroundInlineMungerTestAspects.Open"/>
+ </aspects>
+</aspectj>
<aspect name="ataspectj.PerClauseTestAspects.TestAspectPerCflow"/>
<aspect name="ataspectj.PerClauseTestAspects.TestAspectPTW"/>
- <aspect name="ataspectj.AroundInlineMungerTest.Open"/>
+ <aspect name="ataspectj.AroundInlineMungerTestAspects.Open"/>
</aspects>
</aspectj>
return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/ltw.xml");
}
- public void testRunThemAllWithJavacCompiledAndLTW() {
- runTest("RunThemAllWithJavacCompiledAndLTW");
- }
- public void testAjcLTWPerClauseTest_XnoWeave() {
- runTest("AjcLTW PerClauseTest -XnoWeave");
- }
+ //FIXME AV - those all 4 depends on #75442...
+// public void testRunThemAllWithJavacCompiledAndLTW() {
+// runTest("RunThemAllWithJavacCompiledAndLTW");
+// }
+//
+// public void testAjcLTWPerClauseTest_XnoWeave() {
+// runTest("AjcLTW PerClauseTest -XnoWeave");
+// }
+//
+// public void testAjcLTWPerClauseTest_Xreweavable() {
+// runTest("AjcLTW PerClauseTest -Xreweavable");
+// }
+//
+// public void testJavaCAjcLTWPerClauseTest() {
+// runTest("JavaCAjcLTW PerClauseTest");
+// }
+
+ public void testAjcLTWAroundInlineMungerTest_XnoWeave() {
+ runTest("AjcLTW AroundInlineMungerTest -XnoWeave");
+ }
+
+ public void testAjcLTWAroundInlineMungerTest_Xreweavable() {
+ runTest("AjcLTW AroundInlineMungerTest -Xreweavable");
+ }
+
+ public void testAjcLTWAroundInlineMungerTest() {
+ runTest("AjcLTW AroundInlineMungerTest");
+ }
+
+ public void testAjcLTWAroundInlineMungerTest_XnoInline_Xreweavable() {
+ runTest("AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable");
+ }
+
- public void testAjcLTWPerClauseTest_Xreweavable() {
- runTest("AjcLTW PerClauseTest -Xreweavable");
- }
}
return new File("../tests/src/org/aspectj/systemtest/ajc150/ataspectj/syntax.xml");
}
-
public void testSimpleBefore() {
runTest("SimpleBefore");
}
runTest("PerClause");
}
+ public void testAroundInlineMunger_XnoInline() {
+ runTest("AroundInlineMunger -XnoInline");
+ }
+
public void testAroundInlineMunger() {
runTest("AroundInlineMunger");
}
<ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/>
</ajc-test>
-<!-- FIXME AV: todo by Andy-->
-<!-- <ajc-test dir="java5/ataspectj" title="JavaCAjcLTW PerClauseTest">-->
-<!-- <compile-->
-<!-- files="ataspectj/PerClauseTest.java,ataspectj/TestHelper.java"-->
-<!-- options="-1.5 -XnoWeave"/>-->
-<!-- <comment>-->
-<!-- aspectOf methods will be pushed in, ignore warning for adviceDidNotMatch but still do the logic for them-->
-<!-- since such just added methods are an interesting case (percflow ajc$perCflowStack advice)-->
-<!-- </comment>-->
-<!-- <compile-->
-<!-- files="ataspectj/PerClauseTestAspects.java"-->
-<!-- options="-1.5 -Xdev:NoAtAspectJProcessing">-->
-<!-- <message kind="warning"/>-->
-<!-- </compile>-->
-<!-- <ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/>-->
-<!-- </ajc-test>-->
+ <ajc-test dir="java5/ataspectj" title="JavaCAjcLTW PerClauseTest">
+ <compile
+ files="ataspectj/PerClauseTest.java,ataspectj/TestHelper.java,ataspectj/PerClauseTestAspects.java"
+ options="-1.5 -XnoWeave"/>
+ <comment>
+ aspectOf methods will be pushed in, ignore warning for adviceDidNotMatch but still do the logic for them
+ since such just added methods are an interesting case (percflow ajc$perCflowStack advice)
+ </comment>
+ <compile
+ files="ataspectj/PerClauseTestAspects.java"
+ options="-1.5 -Xdev:NoAtAspectJProcessing">
+ <message kind="warning"/>
+ </compile>
+ <ant file="ajc-ant.xml" target="ltw.PerClauseTest" verbose="true"/>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -XnoWeave">
+ <compile
+ files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java"
+ options="-1.5 -XnoWeave"/>
+ <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -Xreweavable">
+ <compile
+ files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java"
+ options="-1.5 -Xreweavable"/>
+ <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest">
+ <compile
+ files="ataspectj/AroundInlineMungerTestAspects.java"
+ options="-1.5 -Xlint:ignore"/>
+ <compile
+ files="ataspectj/AroundInlineMungerTest.java,ataspectj/TestHelper.java"
+ options="-1.5 -Xreweavable"/>
+ <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/>
+ </ajc-test>
+
+ <ajc-test dir="java5/ataspectj" title="AjcLTW AroundInlineMungerTest -XnoInline -Xreweavable">
+ <compile
+ files="ataspectj/AroundInlineMungerTestAspects.java"
+ options="-1.5 -Xlint:ignore -XnoInline -Xreweavable"/>
+ <compile
+ files="ataspectj/AroundInlineMungerTest.java,ataspectj/TestHelper.java"
+ options="-1.5 -Xreweavable -XnoInline"/>
+ <ant file="ajc-ant.xml" target="ltw.AroundInlineMungerTest" verbose="true"/>
+ </ajc-test>
</suite>
\ No newline at end of file
<run class="ataspectj.PerClauseTest"/>
</ajc-test>
- <ajc-test dir="java5/ataspectj" title="AroundInlineMunger">
- <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline -Xdev:NoAtAspectJProcessing -Xlint:ignore"/>
- <run class="ataspectj.AroundInlineMungerTest"/>
- <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"/>
+ <ajc-test dir="java5/ataspectj" title="AroundInlineMunger -XnoInline">
+ <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -XnoInline -Xdev:NoAtAspectJProcessing -Xlint:ignore"/>
<run class="ataspectj.AroundInlineMungerTest"/>
</ajc-test>
+ <ajc-test dir="java5/ataspectj" title="AroundInlineMunger">
+ <compile files="ataspectj/AroundInlineMungerTest.java,ataspectj/AroundInlineMungerTestAspects.java,ataspectj/TestHelper.java" options="-1.5 -Xdev:NoAtAspectJProcessing -Xlint:ignore"/>
+ <run class="ataspectj.AroundInlineMungerTest"/>
+ </ajc-test>
</suite>
\ No newline at end of file
* Specific state and logic is kept in the munger ala ITD so that call/get/set pointcuts can still be matched
* on the wrapped member thanks to the EffectiveSignature attribute.
*
+ * FIXME AV - this whole one should be skept when -XnoInline is used
+ * (add breakpoint on lazyMethodGen.setCanInline to see where things happening)
+ *
* @author <a href="mailto:alex AT gnilux DOT com">Alexandre Vasseur</a>
*/
public class BcelAccessForInlineMunger extends BcelTypeMunger {
curr = next;
}
+
+ // no reason for not inlining this advice
+ // since it is used for @AJ advice that cannot be inlined by defauilt
+ // make sure we set inline to true since we have done this analysis
+ if (!realizedCannotInline) {
+ aroundAdvice.setCanInline(true);
+ }
}
/**
import org.aspectj.apache.bcel.generic.InstructionFactory;
import org.aspectj.apache.bcel.generic.InstructionHandle;
import org.aspectj.apache.bcel.generic.InstructionList;
+import org.aspectj.apache.bcel.generic.ReferenceType;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.Message;
import org.aspectj.weaver.Advice;
// ATAJ: for @AJ aspects, handle implicit binding of xxJoinPoint
if (getKind() == AdviceKind.Around) {
il.append(closureInstantiation);
+ //
+// if (canInline(shadow)) {
+// //FIXME ALEX? passin a boolean instead of checking there
+// il.append(fact.createCheckCast(
+// (ReferenceType) BcelWorld.makeBcelType(TypeX.forName("org.aspectj.lang.ProceedingJoinPoint"))
+// ));
+// }
continue;
} else if ("Lorg/aspectj/lang/JoinPoint$StaticPart;".equals(getSignature().getParameterTypes()[i].getSignature())) {
if ((getExtraParameterFlags() & ThisJoinPointStaticPart) != 0) {
Set aspectsAffectingType = null;
- if (inReweavableMode) aspectsAffectingType = new HashSet();
+ if (inReweavableMode || clazz.getType().isAspect()) aspectsAffectingType = new HashSet();
boolean isChanged = false;
boolean typeMungerAffectedType = munger.munge(this);
if (typeMungerAffectedType) {
isChanged = true;
- if (inReweavableMode) aspectsAffectingType.add(munger.getAspectType().getName());
+ if (inReweavableMode || clazz.getType().isAspect()) aspectsAffectingType.add(munger.getAspectType().getName());
}
}
boolean shadowMungerMatched = match(mg);
if (shadowMungerMatched) {
// For matching mungers, add their declaring aspects to the list that affected this type
- if (inReweavableMode) aspectsAffectingType.addAll(findAspectsForMungers(mg));
+ if (inReweavableMode || clazz.getType().isAspect()) aspectsAffectingType.addAll(findAspectsForMungers(mg));
isChanged = true;
}
}
boolean typeMungerAffectedType = munger.munge(this);
if (typeMungerAffectedType) {
isChanged = true;
- if (inReweavableMode) aspectsAffectingType.add(munger.getAspectType().getName());
+ if (inReweavableMode || clazz.getType().isAspect()) aspectsAffectingType.add(munger.getAspectType().getName());
}
}
}
weaveInAddedMethods(); // FIXME asc are these potentially affected by declare annotation?
}
- if (inReweavableMode) {
+ if (inReweavableMode || clazz.getType().isAspect()) {
WeaverStateInfo wsi = clazz.getOrCreateWeaverStateInfo();
wsi.addAspectsAffectingType(aspectsAffectingType);
wsi.setUnwovenClassFileData(ty.getJavaClass().getBytes());
import org.aspectj.apache.bcel.generic.StoreInstruction;
import org.aspectj.apache.bcel.generic.TargetLostException;
import org.aspectj.apache.bcel.generic.Type;
+import org.aspectj.apache.bcel.generic.ReferenceType;
import org.aspectj.bridge.IMessage;
import org.aspectj.bridge.ISourceLocation;
import org.aspectj.bridge.Message;
BcelObjectType ot = BcelWorld.getBcelObjectType(declaringType);
LazyMethodGen adviceMethod = ot.getLazyClassGen().getLazyMethodGen(mungerSig);
- if (!adviceMethod.getCanInline())
- {
+ if (!adviceMethod.getCanInline()) {
weaveAroundClosure(munger, hasDynamicTest);
return;
}
ResolvedTypeX stateTypeX = BcelWorld.fromBcel(stateType).resolve(world);
if ("Lorg/aspectj/lang/JoinPoint;".equals(stateType.getSignature())) {
ret.append(new ALOAD(localJp));// from localAdvice signature
+// } else if ("Lorg/aspectj/lang/ProceedingJoinPoint;".equals(stateType.getSignature())) {
+// //FIXME ALEX?
+// ret.append(new ALOAD(localJp));// from localAdvice signature
+//// ret.append(fact.createCheckCast(
+//// (ReferenceType) BcelWorld.makeBcelType(stateTypeX)
+//// ));
+// // cast ?
+//
} else {
ret.append(InstructionFactory.createLoad(stateType, i));
}
// return ret;
}
- public void weaveAroundClosure(
- BcelAdvice munger,
- boolean hasDynamicTest)
- {
+ public void weaveAroundClosure(BcelAdvice munger, boolean hasDynamicTest) {
InstructionFactory fact = getFactory();
enclosingMethod.setCanInline(false);
// join point, it is unnecessary to accept (and pass) tjp.
if (thisJoinPointVar != null) {
parameterTypes = addTypeToEnd(LazyClassGen.tjpType, parameterTypes);
+ //FIXME ALEX? which one
+ //parameterTypes = addTypeToEnd(LazyClassGen.proceedingTjpType, parameterTypes);
}
TypeX returnType;
//System.out.println("type: " + type + " for " + aspectName);
if (type.isAspect()) {
+ //TODO AV - happens to reach that a lot of time: for each type flagged reweavable X for each aspect in the weaverstate
+ //=> mainly for nothing for LTW - pbly for something in incremental build...
xcutSet.addOrReplaceAspect(type);
} else {
// FIXME : Alex: better warning upon no such aspect from aop.xml
BcelObjectType classType = getClassType(className);
processReweavableStateIfPresent(className, classType);
}
-
+
+ // register all aspect that have been extracted from reweavable state for LTW
+ // note: when doing AJC, the missing aspect is already catch in the previous state thru Type.MISSING
+ if (alreadyConfirmedReweavableState != null) {
+ for (Iterator iterator = alreadyConfirmedReweavableState.iterator(); iterator.hasNext();) {
+ String aspectClassName = (String) iterator.next();
+ addLibraryAspect(aspectClassName);
+ }
+ // refresh all the stuff... perhaps too much here...
+ if (!alreadyConfirmedReweavableState.isEmpty())
+ prepareForWeave();
+ }
+
requestor.addingTypeMungers();
// We process type mungers in two groups, first mungers that change the type
world.showMessage(IMessage.INFO,
WeaverMessages.format(WeaverMessages.REWEAVABLE_MODE),
null, null);
-
+
+ //TODO AV - can't we avoid this creation (LTW = happens for each class load!)
alreadyConfirmedReweavableState = new HashSet();
}
public boolean isReweavable() {
if (myType.getWeaverState()==null) return false;
- return myType.getWeaverState().isReweavable();
+ return myType.getWeaverState().isReweavable();
}
public Set getAspectsAffectingType() {
// reflective thisJoinPoint support
Map/*BcelShadow, Field*/ tjpFields = new HashMap();
- public static final ObjectType tjpType =
+ public static final ObjectType proceedingTjpType =
+ new ObjectType("org.aspectj.lang.ProceedingJoinPoint");
+ public static final ObjectType tjpType =
new ObjectType("org.aspectj.lang.JoinPoint");
public static final ObjectType staticTjpType =
new ObjectType("org.aspectj.lang.JoinPoint$StaticPart");
private int maxLocals;
- private boolean canInline = true;
+ private boolean canInline = true;//FIXME AV - ALEX? shouldn't that default to false or unknown?
private boolean hasExceptionHandlers;
private boolean isSynthetic = false;
this.attributes = new Attribute[0];
this.enclosingClass = enclosingClass;
assertGoodBody();
+
+ // @AJ advice are not inlined by default since requires further analysis
+ // and weaving ordering control
+ // TODO AV - improve - note: no room for improvement as long as aspects are reweavable
+ // since the inlined version with wrappers and an to be done annotation to keep
+ // inline state will be garbaged due to reweavable impl
+ if (memberView != null && isAdviceMethod()) {
+ if (enclosingClass.getType().isAnnotationStyleAspect()) {
+ //TODO we could check for @Around advice as well
+ this.canInline = false;
+ }
+ }
}
private int calculateMaxLocals() {
this.accessFlags = m.getAccessFlags();
this.name = m.getName();
+
+ // @AJ advice are not inlined by default since requires further analysis
+ // and weaving ordering control
+ // TODO AV - improve - note: no room for improvement as long as aspects are reweavable
+ // since the inlined version with wrappers and an to be done annotation to keep
+ // inline state will be garbaged due to reweavable impl
+ if (memberView != null && isAdviceMethod()) {
+ if (enclosingClass.getType().isAnnotationStyleAspect()) {
+ //TODO we could check for @Around advice as well
+ this.canInline = false;
+ }
+ }
}
public boolean hasDeclaredLineNumberInfo() {
);
}
- //ATAJ inline around advice support
+ //ATAJ inline around advice support - don't use a late munger to allow around inling for itself
if (Ajc5MemberMaker.isAnnotationStyleAspect(inAspect)) {
- inAspect.crosscuttingMembers.addLateTypeMunger(new BcelAccessForInlineMunger(inAspect));
+ inAspect.crosscuttingMembers.addTypeMunger(new BcelAccessForInlineMunger(inAspect));
}
return ret;
);
}
- //ATAJ inline around advice support
+ //ATAJ inline around advice support - don't use a late munger to allow around inling for itself
if (Ajc5MemberMaker.isAnnotationStyleAspect(inAspect)) {
- inAspect.crosscuttingMembers.addLateTypeMunger(new BcelAccessForInlineMunger(inAspect));
+ inAspect.crosscuttingMembers.addTypeMunger(new BcelAccessForInlineMunger(inAspect));
}
return ret;
//ATAJ inline around advice support
if (Ajc5MemberMaker.isAnnotationStyleAspect(inAspect)) {
- inAspect.crosscuttingMembers.addLateTypeMunger(new BcelAccessForInlineMunger(inAspect));
+ inAspect.crosscuttingMembers.addTypeMunger(new BcelAccessForInlineMunger(inAspect));
}
return ret;
);
}
- //ATAJ inline around advice support
+ //ATAJ inline around advice support - don't use a late munger to allow around inling for itself
if (Ajc5MemberMaker.isAnnotationStyleAspect(inAspect)) {
- inAspect.crosscuttingMembers.addLateTypeMunger(new BcelAccessForInlineMunger(inAspect));
+ inAspect.crosscuttingMembers.addTypeMunger(new BcelAccessForInlineMunger(inAspect));
}
return ret;