diff options
author | aclement <aclement> | 2006-08-03 07:53:27 +0000 |
---|---|---|
committer | aclement <aclement> | 2006-08-03 07:53:27 +0000 |
commit | b6925cbe5f24d611b1463558ee4f9b180d3c699a (patch) | |
tree | 193f0c4109a6187e06188556f69d271450a13ffe /weaver | |
parent | e38e83903795e8904c92144c67e1674ccb30df82 (diff) | |
download | aspectj-b6925cbe5f24d611b1463558ee4f9b180d3c699a.tar.gz aspectj-b6925cbe5f24d611b1463558ee4f9b180d3c699a.zip |
fix for problem with transform of static synchronized method on pre Java5.
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java index a7cece45e..623bfb336 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelClassWeaver.java @@ -1610,7 +1610,6 @@ class BcelClassWeaver implements IClassWeaver { parttwo.append(InstructionFactory.MONITORENTER); String fieldname = synchronizedMethod.getEnclosingClass().allocateField("class$"); - System.err.println("Going to use field name "+fieldname); Field f = new FieldGen(Modifier.STATIC | Modifier.PRIVATE, Type.getType(Class.class),fieldname,synchronizedMethod.getEnclosingClass().getConstantPoolGen()).getField(); synchronizedMethod.getEnclosingClass().addField(f, null); @@ -1625,12 +1624,14 @@ class BcelClassWeaver implements IClassWeaver { // 25: invokevirtual #52; //Method java/lang/Throwable.getMessage:()Ljava/lang/String; // 28: invokespecial #54; //Method java/lang/NoClassDefFoundError."<init>":(Ljava/lang/String;)V // 31: athrow - prepend.append(fact.createGetStatic("C", fieldname, Type.getType(Class.class))); + String name = synchronizedMethod.getEnclosingClass().getName(); + + prepend.append(fact.createGetStatic(name, fieldname, Type.getType(Class.class))); prepend.append(InstructionFactory.createDup(1)); prepend.append(InstructionFactory.createBranchInstruction(Constants.IFNONNULL, parttwo.getStart())); prepend.append(InstructionFactory.POP); - prepend.append(fact.createConstant("C")); + prepend.append(fact.createConstant(name)); InstructionHandle tryInstruction = prepend.getEnd(); prepend.append(fact.createInvoke("java.lang.Class", "forName", clazzType,new Type[]{ Type.getType(String.class)}, Constants.INVOKESTATIC)); InstructionHandle catchInstruction = prepend.getEnd(); |