aboutsummaryrefslogtreecommitdiffstats
path: root/weaver
diff options
context:
space:
mode:
authoraclement <aclement>2009-01-28 01:07:27 +0000
committeraclement <aclement>2009-01-28 01:07:27 +0000
commitfb0ebe4eddae6bf7bcc272c919d25d19d72c7c0d (patch)
tree21008dcf91d5143fa8a8cf09eff2150c1fbe52a2 /weaver
parent17da10da5fe342efe7e84e0ffa5a0aecc706a954 (diff)
downloadaspectj-fb0ebe4eddae6bf7bcc272c919d25d19d72c7c0d.tar.gz
aspectj-fb0ebe4eddae6bf7bcc272c919d25d19d72c7c0d.zip
refactoring to make around advice lvt fixes easier to apply - and make the code a bit clearer
Diffstat (limited to 'weaver')
-rw-r--r--weaver/src/org/aspectj/weaver/bcel/BcelShadow.java32
1 files changed, 16 insertions, 16 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
index fc170d6d7..ae2109df7 100644
--- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
+++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java
@@ -2190,20 +2190,21 @@ public class BcelShadow extends Shadow {
// parameterTypes is [Bug, C, org.aspectj.lang.JoinPoint, X, org.aspectj.lang.ProceedingJoinPoint, java.lang.Object,
// java.lang.Object]
- // now extract the advice into its own method
- String localAdviceMethodName = NameMangler.aroundAdviceMethodName(getSignature(), new Integer(getEnclosingClass()
- .getNewGeneratedNameTag()).toString());
+ // Extract the advice into a new method. This will go in the same type as the shadow
+ // name will be something like foo_aroundBody1$advice
+ String localAdviceMethodName = NameMangler.aroundAdviceMethodName(getSignature(), shadowClass.getNewGeneratedNameTag());
LazyMethodGen localAdviceMethod = new LazyMethodGen(Modifier.PRIVATE | Modifier.FINAL | Modifier.STATIC, BcelWorld
- .makeBcelType(mungerSig.getReturnType()), localAdviceMethodName, parameterTypes, new String[0], getEnclosingClass());
-
- String donorFileName = adviceMethod.getEnclosingClass().getInternalFileName();
- String recipientFileName = getEnclosingClass().getInternalFileName();
- // System.err.println("donor " + donorFileName);
- // System.err.println("recip " + recipientFileName);
- if (!donorFileName.equals(recipientFileName)) {
- localAdviceMethod.fromFilename = donorFileName;
- getEnclosingClass().addInlinedSourceFileInfo(donorFileName, adviceMethod.highestLineNumber);
- }
+ .makeBcelType(mungerSig.getReturnType()), localAdviceMethodName, parameterTypes, NoDeclaredExceptions, shadowClass);
+
+ // Doesnt work properly, so leave it out: (jsr45 support)
+ // String donorFileName = adviceMethod.getEnclosingClass().getInternalFileName();
+ // String recipientFileName = getEnclosingClass().getInternalFileName();
+ // // System.err.println("donor " + donorFileName);
+ // // System.err.println("recip " + recipientFileName);
+ // if (!donorFileName.equals(recipientFileName)) {
+ // localAdviceMethod.fromFilename = donorFileName;
+ // getEnclosingClass().addInlinedSourceFileInfo(donorFileName, adviceMethod.highestLineNumber);
+ // }
shadowClass.addMethodGen(localAdviceMethod);
@@ -2223,8 +2224,6 @@ public class BcelShadow extends Shadow {
localAdviceMethod.setMaxLocals(nVars);
- // System.err.println(localAdviceMethod);
-
// the shadow is now empty. First, create a correct call
// to the around advice. This includes both the call (which may involve
// value conversion of the advice arguments) and the return
@@ -2971,9 +2970,10 @@ public class BcelShadow extends Shadow {
LazyMethodGen extractShadowInstructionsIntoNewMethod(String extractedMethodName, int extractedMethodVisibilityModifier,
ISourceLocation adviceSourceLocation) {
// LazyMethodGen.assertGoodBody(range.getBody(), extractedMethodName);
- if (!getKind().allowsExtraction())
+ if (!getKind().allowsExtraction()) {
throw new BCException("Attempt to extract method from a shadow kind (" + getKind()
+ ") that does not support this operation");
+ }
LazyMethodGen newMethod = createShadowMethodGen(extractedMethodName, extractedMethodVisibilityModifier);
IntMap remapper = makeRemap();
range.extractInstructionsInto(newMethod, remapper, (getKind() != PreInitialization) && isFallsThrough());