diff options
-rw-r--r-- | weaver/src/org/aspectj/weaver/bcel/Utility.java | 48 |
1 files changed, 45 insertions, 3 deletions
diff --git a/weaver/src/org/aspectj/weaver/bcel/Utility.java b/weaver/src/org/aspectj/weaver/bcel/Utility.java index 68f2ef2b1..48e23e90f 100644 --- a/weaver/src/org/aspectj/weaver/bcel/Utility.java +++ b/weaver/src/org/aspectj/weaver/bcel/Utility.java @@ -124,6 +124,29 @@ public class Utility { kind); } + /** + * Creae a field GET instruction + * + * @param fact + * @param signature + * @param declaringType + * @return + */ + public static Instruction createGetOn(InstructionFactory fact, Member signature, TypeX declaringType) { + short kind; + if (signature.isStatic()) { + kind = Constants.GETSTATIC; + } else { + kind = Constants.GETFIELD; + } + + return fact.createFieldAccess( + declaringType.getName(), + signature.getName(), + BcelWorld.makeBcelType(signature.getReturnType()), + kind); + } + public static Instruction createSet(InstructionFactory fact, Member signature) { short kind; if (signature.isStatic()) { @@ -201,9 +224,28 @@ public class Utility { m.getReturnType(), m.getArgumentTypes(), kind); - } - - + } + + /** + * Create an invoke instruction + * + * @param fact + * @param kind INVOKEINTERFACE, INVOKEVIRTUAL.. + * @param member + * @return + */ + public static Instruction createInvoke( + InstructionFactory fact, + short kind, + Member member) { + return fact.createInvoke( + member.getDeclaringType().getName(), + member.getName(), + BcelWorld.makeBcelType(member.getReturnType()), + BcelWorld.makeBcelTypes(member.getParameterTypes()), + kind); + } + // ??? these should perhaps be cached. Remember to profile this to see if it's a problem. public static String[] makeArgNames(int n) { String[] ret = new String[n]; |