diff options
author | aclement <aclement> | 2005-11-30 12:11:03 +0000 |
---|---|---|
committer | aclement <aclement> | 2005-11-30 12:11:03 +0000 |
commit | fcb16b97f4c2ca11e3f02b5e2b396932764b010d (patch) | |
tree | 95d28d6c8f7e78c2f93b4709f2e4bfd3693eb342 /weaver | |
parent | c88e6bc262b9ec81625c28071989cc59862cf5e4 (diff) | |
download | aspectj-fcb16b97f4c2ca11e3f02b5e2b396932764b010d.tar.gz aspectj-fcb16b97f4c2ca11e3f02b5e2b396932764b010d.zip |
More fixes for 116679: now copes with the enclosingSP type that we introduced for 1.5
Diffstat (limited to 'weaver')
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/BcelShadow.java | 16 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java | 51 |
2 files changed, 43 insertions, 24 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java index 124b46f88..5ce739a8c 100644 --- a/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java +++ b/weaver/src/org/aspectj/weaver/bcel/BcelShadow.java @@ -1179,11 +1179,17 @@ public class BcelShadow extends Shadow { public BcelVar getThisJoinPointStaticPartBcelVar(final boolean isEnclosingJp) { if (thisJoinPointStaticPartVar == null) { Field field = getEnclosingClass().getTjpField(this, isEnclosingJp); - thisJoinPointStaticPartVar = - new BcelFieldRef( - isEnclosingJp? - world.getCoreType(UnresolvedType.forName("org.aspectj.lang.JoinPoint$EnclosingStaticPart")): - world.getCoreType(UnresolvedType.forName("org.aspectj.lang.JoinPoint$StaticPart")), + + ResolvedType sjpType = null; + if (world.isTargettingAspectJRuntime12()) { // TAG:SUPPORTING12: We didn't have different jpsp types in 1.2 + sjpType = world.getCoreType(UnresolvedType.forName("org.aspectj.lang.JoinPoint$StaticPart")); + } else { + sjpType = isEnclosingJp? + world.getCoreType(UnresolvedType.forName("org.aspectj.lang.JoinPoint$EnclosingStaticPart")): + world.getCoreType(UnresolvedType.forName("org.aspectj.lang.JoinPoint$StaticPart")); + } + thisJoinPointStaticPartVar = new BcelFieldRef( + sjpType, getEnclosingClass().getClassName(), field.getName()); // getEnclosingClass().warnOnAddedStaticInitializer(this,munger.getSourceLocation()); diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java index 806b4e82c..6279ef144 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java @@ -901,10 +901,13 @@ public final class LazyClassGen { else { modifiers |= Modifier.PRIVATE; } - ret = new FieldGen(modifiers, - isEnclosingJp?enclosingStaticTjpType:staticTjpType, - "ajc$tjp_" + tjpFields.size(), - getConstantPoolGen()).getField(); + ObjectType jpType = null; + if (world.isTargettingAspectJRuntime12()) { // TAG:SUPPORTING12: We didn't have different staticjp types in 1.2 + jpType = staticTjpType; + } else { + jpType = isEnclosingJp?enclosingStaticTjpType:staticTjpType; + } + ret = new FieldGen(modifiers,jpType,"ajc$tjp_" + tjpFields.size(),getConstantPoolGen()).getField(); addField(ret); tjpFields.put(shadow, ret); return ret; @@ -999,7 +1002,7 @@ public final class LazyClassGen { // create the signature list.append(InstructionFactory.createLoad(factoryType, 0)); - if (world.getTargetAspectjRuntimeLevel().equals(org.aspectj.weaver.Constants.RUNTIME_LEVEL_12)) { + if (world.isTargettingAspectJRuntime12()) { // TAG:SUPPORTING12: We didn't have optimized factory methods in 1.2 list.append(new PUSH(getConstantPoolGen(), sig.getSignatureString(shadow.getWorld()))); list.append(fact.createInvoke(factoryType.getClassName(), sig.getSignatureMakerName(), @@ -1091,21 +1094,31 @@ public final class LazyClassGen { list.append(Utility.createConstant(fact, shadow.getSourceLine())); final String factoryMethod; - if (staticTjpType.equals(field.getType())) { - factoryMethod = "makeSJP"; - } else if (enclosingStaticTjpType.equals(field.getType())) { - factoryMethod = "makeESJP"; + + if (world.isTargettingAspectJRuntime12()) { // TAG:SUPPORTING12: We didn't have makeESJP() in 1.2 + list.append(fact.createInvoke(factoryType.getClassName(), + "makeSJP", staticTjpType, + new Type[] { Type.STRING, sigType, Type.INT}, + Constants.INVOKEVIRTUAL)); + + // put it in the field + list.append(fact.createFieldAccess(getClassName(), field.getName(),staticTjpType, Constants.PUTSTATIC)); + } else { - throw new Error("should not happen"); - } - list.append(fact.createInvoke(factoryType.getClassName(), - factoryMethod, field.getType(), - new Type[] { Type.STRING, sigType, Type.INT}, - Constants.INVOKEVIRTUAL)); - - // put it in the field - list.append(fact.createFieldAccess(getClassName(), field.getName(), - field.getType(), Constants.PUTSTATIC)); + if (staticTjpType.equals(field.getType())) { + factoryMethod = "makeSJP"; + } else if (enclosingStaticTjpType.equals(field.getType())) { + factoryMethod = "makeESJP"; + } else { + throw new Error("should not happen"); + } + list.append(fact.createInvoke(factoryType.getClassName(), + factoryMethod, field.getType(), + new Type[] { Type.STRING, sigType, Type.INT}, + Constants.INVOKEVIRTUAL)); + // put it in the field + list.append(fact.createFieldAccess(getClassName(), field.getName(), field.getType(), Constants.PUTSTATIC)); + } } |