diff options
author | jhugunin <jhugunin> | 2003-08-08 01:23:31 +0000 |
---|---|---|
committer | jhugunin <jhugunin> | 2003-08-08 01:23:31 +0000 |
commit | 3e5974557278e81a9891edd4269eca39a8d42f43 (patch) | |
tree | 3b6198180f7da196f47896ba3d5570bb58ebefe2 /weaver/src | |
parent | efc1cc47398443b33fe90da11c4cf1d14dc9c108 (diff) | |
download | aspectj-3e5974557278e81a9891edd4269eca39a8d42f43.tar.gz aspectj-3e5974557278e81a9891edd4269eca39a8d42f43.zip |
fix and tests for Bugzilla Bug 41123
Weaving failure when using injars
Diffstat (limited to 'weaver/src')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java | 4 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java | 15 |
2 files changed, 18 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java index 5b9de1855..6f57e56bf 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelTypeMunger.java @@ -223,13 +223,15 @@ public class BcelTypeMunger extends ConcreteTypeMunger { private LazyMethodGen makeMethodGen(LazyClassGen gen, ResolvedMember member) { - return new LazyMethodGen( + LazyMethodGen ret = new LazyMethodGen( member.getModifiers(), BcelWorld.makeBcelType(member.getReturnType()), member.getName(), BcelWorld.makeBcelTypes(member.getParameterTypes()), TypeX.getNames(member.getExceptions()), gen); + ret.makeSynthetic(); + return ret; } diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java index 7c4e660db..dd011f6c3 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyMethodGen.java @@ -30,11 +30,13 @@ import org.apache.bcel.Constants; import org.apache.bcel.classfile.Attribute; import org.apache.bcel.classfile.ConstantPool; import org.apache.bcel.classfile.Method; +import org.apache.bcel.classfile.Synthetic; import org.apache.bcel.generic.BranchHandle; import org.apache.bcel.generic.BranchInstruction; import org.apache.bcel.generic.CPInstruction; import org.apache.bcel.generic.ClassGenException; import org.apache.bcel.generic.CodeExceptionGen; +import org.apache.bcel.generic.ConstantPoolGen; import org.apache.bcel.generic.Instruction; import org.apache.bcel.generic.InstructionHandle; import org.apache.bcel.generic.InstructionList; @@ -85,6 +87,8 @@ public final class LazyMethodGen { private boolean canInline = true; private boolean hasExceptionHandlers; + private boolean isSynthetic = false; + /** * only used by {@link BcelClassWeaver} */ @@ -702,6 +706,13 @@ public final class LazyMethodGen { for (int i = 0, len = attributes.length; i < len; i++) { gen.addAttribute(attributes[i]); } + + if (isSynthetic) { + ConstantPoolGen cpg = gen.getConstantPool(); + int index = cpg.addUtf8("Synthetic"); + gen.addAttribute(new Synthetic(index, 0, new byte[0], cpg.getConstantPool())); + } + if (hasBody()) { packBody(gen); gen.setMaxLocals(); @@ -711,6 +722,10 @@ public final class LazyMethodGen { } return gen; } + + public void makeSynthetic() { + isSynthetic = true; + } /** fill the newly created method gen with our body, * inspired by InstructionList.copy() |