diff options
Diffstat (limited to 'weaver/src')
-rw-r--r-- | weaver/src/org/aspectj/weaver/Constants.java | 6 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/World.java | 11 | ||||
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java | 10 |
3 files changed, 26 insertions, 1 deletions
diff --git a/weaver/src/org/aspectj/weaver/Constants.java b/weaver/src/org/aspectj/weaver/Constants.java index e51bf96c2..9962f893c 100644 --- a/weaver/src/org/aspectj/weaver/Constants.java +++ b/weaver/src/org/aspectj/weaver/Constants.java @@ -21,4 +21,10 @@ public interface Constants { public final static int ACC_BRIDGE = 0x0040; public final static int ACC_VARARGS = 0x0080; + + public final static String RUNTIME_LEVEL_12 = "1.2"; + public final static String RUNTIME_LEVEL_15 = "1.5"; + + // Default for 1.5.0 + public final static String RUNTIME_LEVEL_DEFAULT = RUNTIME_LEVEL_15; } diff --git a/weaver/src/org/aspectj/weaver/World.java b/weaver/src/org/aspectj/weaver/World.java index 31db56be9..3f1bd7faf 100644 --- a/weaver/src/org/aspectj/weaver/World.java +++ b/weaver/src/org/aspectj/weaver/World.java @@ -79,6 +79,9 @@ public abstract class World implements Dump.INode { /** When behaving in a Java 5 way autoboxing is considered */ private boolean behaveInJava5Way = false; + /** The level of the aspectjrt.jar the code we generate needs to run on */ + private String targetAspectjRuntimeLevel = Constants.RUNTIME_LEVEL_DEFAULT; + /** * A list of RuntimeExceptions containing full stack information for every * type we couldn't find. @@ -644,6 +647,14 @@ public abstract class World implements Dump.INode { return behaveInJava5Way; } + public void setTargetAspectjRuntimeLevel(String s) { + targetAspectjRuntimeLevel = s; + } + + public String getTargetAspectjRuntimeLevel() { + return targetAspectjRuntimeLevel; + } + /* * Map of types in the world, with soft links to expendable ones. * An expendable type is a reference type that is not exposed to the weaver (ie diff --git a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java index f97eacbdf..806b4e82c 100644 --- a/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java +++ b/weaver/src/org/aspectj/weaver/bcel/LazyClassGen.java @@ -999,7 +999,14 @@ public final class LazyClassGen { // create the signature list.append(InstructionFactory.createLoad(factoryType, 0)); - if (sig.getKind().equals(Member.METHOD)) { + if (world.getTargetAspectjRuntimeLevel().equals(org.aspectj.weaver.Constants.RUNTIME_LEVEL_12)) { + list.append(new PUSH(getConstantPoolGen(), sig.getSignatureString(shadow.getWorld()))); + list.append(fact.createInvoke(factoryType.getClassName(), + sig.getSignatureMakerName(), + new ObjectType(sig.getSignatureType()), + new Type[] { Type.STRING }, + Constants.INVOKEVIRTUAL)); + } else if (sig.getKind().equals(Member.METHOD)) { BcelWorld w = shadow.getWorld(); // For methods, push the parts of the signature on. list.append(new PUSH(getConstantPoolGen(),makeString(sig.getModifiers(w)))); @@ -1079,6 +1086,7 @@ public final class LazyClassGen { new Type[] { Type.STRING }, Constants.INVOKEVIRTUAL)); } + //XXX should load source location from shadow list.append(Utility.createConstant(fact, shadow.getSourceLine())); |