Replace bogus use of IntInsnNode with VarInsnNode
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AbstractCreateDispatchCodeAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AbstractCreateDispatchCodeAdapter.java
index 17c14c7..b8df1f7 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AbstractCreateDispatchCodeAdapter.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AbstractCreateDispatchCodeAdapter.java
@@ -31,6 +31,7 @@
 import org.objectweb.asm.tree.MethodInsnNode;

 import org.objectweb.asm.tree.MethodNode;

 import org.objectweb.asm.tree.TypeInsnNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 /**

  * Create the code for the dispatch from a base class to the teams. <br/> <br/>

@@ -82,7 +83,7 @@
 		instructions.add(new IntInsnNode(Opcodes.ASTORE, teamsAndCallinsSlot));

 

 		// teams = teamsAndCallinIds[0]

-		instructions.add(new IntInsnNode(Opcodes.ALOAD, teamsAndCallinsSlot));

+		instructions.add(new VarInsnNode(Opcodes.ALOAD, teamsAndCallinsSlot));

 		instructions.add(new InsnNode(Opcodes.ICONST_0));

 		instructions.add(new InsnNode(Opcodes.AALOAD));

 		instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, "[Lorg/objectteams/ITeam;"));

@@ -97,7 +98,7 @@
 			instructions.add(new InsnNode(Opcodes.ACONST_NULL));

 		} else {

 			// put "this" on the stack and cast it to IBoundBase2

-			instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

+			instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

 			instructions.add(new TypeInsnNode(Opcodes.CHECKCAST,

 					ClassNames.I_BOUND_BASE_SLASH));

 		}

@@ -106,13 +107,13 @@
 		instructions.add(new InsnNode(Opcodes.ICONST_0));

 

 		// callinIds = teamsAndCallinIds[1]

-		instructions.add(new IntInsnNode(Opcodes.ALOAD, teamsAndCallinsSlot));

+		instructions.add(new VarInsnNode(Opcodes.ALOAD, teamsAndCallinsSlot));

 		instructions.add(new InsnNode(Opcodes.ICONST_1));

 		instructions.add(new InsnNode(Opcodes.AALOAD));

 		instructions.add(new TypeInsnNode(Opcodes.CHECKCAST, "[I"));

 

 		if (boundMethodId == -1)

-			instructions.add(new IntInsnNode(Opcodes.ILOAD, 1)); // boundMethodId is arg#1 inside _OT$callAllBindings (base version)

+			instructions.add(new VarInsnNode(Opcodes.ILOAD, 1)); // boundMethodId is arg#1 inside _OT$callAllBindings (base version)

 		else

 			instructions.add(createLoadIntConstant(boundMethodId));

 		args = Type.getArgumentTypes(method.desc);

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AbstractTransformableClassNode.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AbstractTransformableClassNode.java
index a9da34e..04e6601 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AbstractTransformableClassNode.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AbstractTransformableClassNode.java
@@ -37,6 +37,7 @@
 import org.objectweb.asm.tree.MethodInsnNode;

 import org.objectweb.asm.tree.MethodNode;

 import org.objectweb.asm.tree.TypeInsnNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 import static org.eclipse.objectteams.otredyn.bytecode.asm.AsmBoundClass.ASM_API;

 import static org.eclipse.objectteams.otredyn.transformer.names.ConstantMembers.callOrig;

@@ -238,7 +239,7 @@
 		}

 		// put "this" on the stack for an non-static method

 		if (!isStatic) {

-			instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

+			instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

 		}

 		for (int i=0, slot=firstArgIndex; i < args.length; slot+=args[i++].getSize()) {

 			instructions.add(new IntInsnNode(args[i].getOpcode(Opcodes.ILOAD),

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AsmWritableBoundClass.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AsmWritableBoundClass.java
index 7c6c5e5..2f1ee84 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AsmWritableBoundClass.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/AsmWritableBoundClass.java
@@ -333,22 +333,15 @@
 		if (!dumping)

 			return;

 		

-		FileOutputStream fos = null;

-		try {

-			String name = getName().replaceAll("/", ".");

-			File dir = new File("otdyn");

-			if (!dir.exists())

-				dir.mkdir();

-			String filename = "otdyn/" + name + ".class";

-			fos = new FileOutputStream(filename);

+		String name = getName().replaceAll("/", ".");

+		File dir = new File("otdyn");

+		if (!dir.exists())

+			dir.mkdir();

+		String filename = "otdyn/" + name + ".class";

+		try (FileOutputStream fos = new FileOutputStream(filename)) {

 			fos.write(allocateAndGetBytecode());

 		} catch (Exception e) {

 			e.printStackTrace();

-		} finally {

-			if (fos != null)

-				try {

-					fos.close();

-				} catch (IOException e) { /* ignore */}

 		}

 	}

 

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateAddRemoveRoleMethod.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateAddRemoveRoleMethod.java
index ff27c6b..12344f5 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateAddRemoveRoleMethod.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateAddRemoveRoleMethod.java
@@ -28,6 +28,7 @@
 import org.objectweb.asm.tree.MethodInsnNode;
 import org.objectweb.asm.tree.MethodNode;
 import org.objectweb.asm.tree.TypeInsnNode;
+import org.objectweb.asm.tree.VarInsnNode;
 
 /**
  * Implements the method <code>void _OT$addOrRemoveRole(Object role, boolean isAdding)</code>
@@ -53,13 +54,13 @@
 			genGetInitializedRoleSet(method.instructions, SET_SLOT);
 						
 			// if (isAdding) {
-			method.instructions.add(new IntInsnNode(Opcodes.ILOAD, IS_ADDING_SLOT));
+			method.instructions.add(new VarInsnNode(Opcodes.ILOAD, IS_ADDING_SLOT));
 			LabelNode jumpToRemove = new LabelNode();
 			method.instructions.add(new JumpInsnNode(Opcodes.IFEQ, jumpToRemove));
 			
 				// set.add(role);
-				method.instructions.add(new IntInsnNode(Opcodes.ALOAD, SET_SLOT));
-				method.instructions.add(new IntInsnNode(Opcodes.ALOAD, ROLE_SLOT));
+				method.instructions.add(new VarInsnNode(Opcodes.ALOAD, SET_SLOT));
+				method.instructions.add(new VarInsnNode(Opcodes.ALOAD, ROLE_SLOT));
 				method.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, ClassNames.HASH_SET_SLASH, "add", "(Ljava/lang/Object;)Z", false));
 				method.instructions.add(new InsnNode(Opcodes.POP));
 				
@@ -68,8 +69,8 @@
 			// } else {
 			method.instructions.add(jumpToRemove);
 				// set.remove(role);
-				method.instructions.add(new IntInsnNode(Opcodes.ALOAD, SET_SLOT));
-				method.instructions.add(new IntInsnNode(Opcodes.ALOAD, ROLE_SLOT));
+				method.instructions.add(new VarInsnNode(Opcodes.ALOAD, SET_SLOT));
+				method.instructions.add(new VarInsnNode(Opcodes.ALOAD, ROLE_SLOT));
 				method.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, ClassNames.HASH_SET_SLASH, "remove", "(Ljava/lang/Object;)Z", false));
 				method.instructions.add(new InsnNode(Opcodes.POP));
 	
@@ -85,24 +86,24 @@
 
 	void genGetInitializedRoleSet(InsnList instructions, int targetLocal) {
 		// x = this._OT$roleSet 
-		instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));
+		instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
 		instructions.add(new FieldInsnNode(Opcodes.GETFIELD, name, ConstantMembers.OT_ROLE_SET, ConstantMembers.HASH_SET_FIELD_TYPE));
 		
 		instructions.add(new IntInsnNode(Opcodes.ASTORE, targetLocal));
-		instructions.add(new IntInsnNode(Opcodes.ALOAD, targetLocal));
+		instructions.add(new VarInsnNode(Opcodes.ALOAD, targetLocal));
 		
 		// if (x == null) {
 		LabelNode skipInstantiation = new LabelNode();
 		instructions.add(new JumpInsnNode(Opcodes.IFNONNULL, skipInstantiation));
 				
 			// this._OT$roleSet = new HashSet();
-			instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));
+			instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
 			instructions.add(new TypeInsnNode(Opcodes.NEW, ClassNames.HASH_SET_SLASH));
 			instructions.add(new InsnNode(Opcodes.DUP));
 			instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, ClassNames.HASH_SET_SLASH, "<init>", "()V", false));
 			
 			instructions.add(new IntInsnNode(Opcodes.ASTORE, targetLocal));
-			instructions.add(new IntInsnNode(Opcodes.ALOAD, targetLocal));
+			instructions.add(new VarInsnNode(Opcodes.ALOAD, targetLocal));
 			instructions.add(new FieldInsnNode(Opcodes.PUTFIELD, name, ConstantMembers.OT_ROLE_SET, ConstantMembers.HASH_SET_FIELD_TYPE));
 			
 		instructions.add(skipInstantiation);
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateCallAllBindingsCallInOrgMethod.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateCallAllBindingsCallInOrgMethod.java
index d9fc89c..6d2e080 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateCallAllBindingsCallInOrgMethod.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateCallAllBindingsCallInOrgMethod.java
@@ -24,11 +24,11 @@
 import org.objectweb.asm.tree.AbstractInsnNode;

 import org.objectweb.asm.tree.InsnList;

 import org.objectweb.asm.tree.InsnNode;

-import org.objectweb.asm.tree.IntInsnNode;

 import org.objectweb.asm.tree.LabelNode;

 import org.objectweb.asm.tree.MethodInsnNode;

 import org.objectweb.asm.tree.MethodNode;

 import org.objectweb.asm.tree.TryCatchBlockNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 /**

  * This class creates and adds the instructions, that are needed 

@@ -105,7 +105,7 @@
 	private void generateInvocation(MethodNode method, Type[] args, AbstractInsnNode insertBefore,

 			InsnList newInstructions) {

 		// put this on the stack

-		newInstructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

+		newInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

 		// put boundMethodId on the stack

 		newInstructions.add(createLoadIntConstant(boundMethodId));

 		if (method.name.equals("<init>")) { // set bit 0x8000000 to signal the ctor

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateDispatchCodeInCallAllBindingsAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateDispatchCodeInCallAllBindingsAdapter.java
index 78aff61..74f3110 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateDispatchCodeInCallAllBindingsAdapter.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateDispatchCodeInCallAllBindingsAdapter.java
@@ -20,8 +20,8 @@
 import org.objectweb.asm.Opcodes;

 import org.objectweb.asm.Type;

 import org.objectweb.asm.tree.InsnList;

-import org.objectweb.asm.tree.IntInsnNode;

 import org.objectweb.asm.tree.MethodNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 /**

  * Create the code for the dispatch from a base class to the teams 

@@ -71,7 +71,7 @@
 	@Override

 	protected InsnList getBoxedArguments(Type[] args) {

 		InsnList instructions = new InsnList();

-		instructions.add(new IntInsnNode(Opcodes.ALOAD, 2));

+		instructions.add(new VarInsnNode(Opcodes.ALOAD, 2));

 		return instructions;

 	}

 

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateFieldAccessAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateFieldAccessAdapter.java
index 4c0ed50..5000384 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateFieldAccessAdapter.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateFieldAccessAdapter.java
@@ -24,11 +24,11 @@
 import org.objectweb.asm.tree.FieldInsnNode;

 import org.objectweb.asm.tree.InsnList;

 import org.objectweb.asm.tree.InsnNode;

-import org.objectweb.asm.tree.IntInsnNode;

 import org.objectweb.asm.tree.JumpInsnNode;

 import org.objectweb.asm.tree.LabelNode;

 import org.objectweb.asm.tree.MethodNode;

 import org.objectweb.asm.tree.TypeInsnNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 /**

  * Creates and adds the instructions,

@@ -69,7 +69,7 @@
 

 		InsnList instructions = new InsnList();

 		// put accessId on the stack

-		instructions.add(new IntInsnNode(Opcodes.ILOAD, firstArgIndex + 1));

+		instructions.add(new VarInsnNode(Opcodes.ILOAD, firstArgIndex + 1));

 		// read or write access

 		LabelNode writeAccess = new LabelNode();

 		instructions.add(new JumpInsnNode(Opcodes.IFNE, writeAccess));

@@ -80,7 +80,7 @@
 					.getName(), field.getSignature()));

 		} else {

 			// put "this" on the stack

-			instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

+			instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

 			// get value of field

 			instructions.add(new FieldInsnNode(Opcodes.GETFIELD, name, field

 					.getName(), field.getSignature()));

@@ -95,10 +95,10 @@
 		instructions.add(writeAccess);

 		//put "this" on the stack

 		if (!field.isStatic())

-			instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

+			instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

 			

 		//put "args" on the stack 

-		instructions.add(new IntInsnNode(Opcodes.ALOAD, firstArgIndex + 2));

+		instructions.add(new VarInsnNode(Opcodes.ALOAD, firstArgIndex + 2));

 		//get the first element of "args"

 		instructions.add(new InsnNode(Opcodes.ICONST_0));

 		instructions.add(new InsnNode(Opcodes.AALOAD));

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateMethodAccessAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateMethodAccessAdapter.java
index 6aac63c..b825870 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateMethodAccessAdapter.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateMethodAccessAdapter.java
@@ -22,10 +22,10 @@
 import org.objectweb.asm.Type;

 import org.objectweb.asm.tree.InsnList;

 import org.objectweb.asm.tree.InsnNode;

-import org.objectweb.asm.tree.IntInsnNode;

 import org.objectweb.asm.tree.MethodInsnNode;

 import org.objectweb.asm.tree.MethodNode;

 import org.objectweb.asm.tree.TypeInsnNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 /**

  * Creates and adds the instructions,

@@ -68,7 +68,7 @@
 			instructions.add(new InsnNode(Opcodes.DUP));

 		} else if (!method.isStatic()) {

 			//put "this" on the stack for a non-static method

-			instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

+			instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

 		}

 		

 		//Unbox arguments

@@ -78,7 +78,7 @@
 			

 			

 			for (int i = 0; i < args.length; i++) {

-				instructions.add(new IntInsnNode(Opcodes.ALOAD, firstArgIndex + 2));

+				instructions.add(new VarInsnNode(Opcodes.ALOAD, firstArgIndex + 2));

 				instructions.add(createLoadIntConstant(i));

 				instructions.add(new InsnNode(Opcodes.AALOAD));

 				Type arg = args[i];

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSpecificSuperCallInCallOrigAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSpecificSuperCallInCallOrigAdapter.java
index 0e60543..966f5f4 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSpecificSuperCallInCallOrigAdapter.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSpecificSuperCallInCallOrigAdapter.java
@@ -22,10 +22,10 @@
 import org.objectweb.asm.Type;
 import org.objectweb.asm.tree.InsnList;
 import org.objectweb.asm.tree.InsnNode;
-import org.objectweb.asm.tree.IntInsnNode;
 import org.objectweb.asm.tree.MethodInsnNode;
 import org.objectweb.asm.tree.MethodNode;
 import org.objectweb.asm.tree.TypeInsnNode;
+import org.objectweb.asm.tree.VarInsnNode;
 
 /**
  * When weaving into a method inherited from an unweavable superclass (j.l.Object?),
@@ -65,14 +65,14 @@
 
 		InsnList newInstructions = new InsnList();
 		if (!method.isStatic())
-			newInstructions.add(new IntInsnNode(Opcodes.ALOAD, 0));
+			newInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
 
 		// Unpacking & unboxing arguments
 		Type[] args = Type.getArgumentTypes(methodSignature);
 		int size = 0;
 		if (args.length > 0) {
 			for (int i = argOffset; i < args.length; i++) {
-				newInstructions.add(new IntInsnNode(Opcodes.ALOAD, firstArgIndex + argOffset + 1));
+				newInstructions.add(new VarInsnNode(Opcodes.ALOAD, firstArgIndex + argOffset + 1));
 				newInstructions.add(createLoadIntConstant(i));
 				newInstructions.add(new InsnNode(Opcodes.AALOAD));
 				Type arg = args[i];
diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchAdapter.java
index 6951682..2606f81 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchAdapter.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchAdapter.java
@@ -19,11 +19,11 @@
 import org.eclipse.objectteams.otredyn.bytecode.Method;

 import org.objectweb.asm.Opcodes;

 import org.objectweb.asm.tree.InsnNode;

-import org.objectweb.asm.tree.IntInsnNode;

 import org.objectweb.asm.tree.LabelNode;

 import org.objectweb.asm.tree.LookupSwitchInsnNode;

 import org.objectweb.asm.tree.MethodInsnNode;

 import org.objectweb.asm.tree.MethodNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 /**

  * This class creates an empty switch statement in a method.

@@ -103,7 +103,7 @@
 	 * @param method

 	 */

 	protected void addPreSwitchInstructions(MethodNode method) {

-		method.instructions.add(new IntInsnNode(Opcodes.ILOAD, firstArgIndex));

+		method.instructions.add(new VarInsnNode(Opcodes.ILOAD, firstArgIndex));

 		method.instructions.add(createLoadIntConstant(0x7fffffff));

 		method.instructions.add(new InsnNode(Opcodes.IAND)); // mask the 0x80000000 bit used for signaling a ctor

 	}

@@ -114,9 +114,9 @@
 	 */

 	protected void addInstructionForDefaultLabel(MethodNode method) {

 		if (superToCall != null) {

-			method.instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

-			method.instructions.add(new IntInsnNode(Opcodes.ILOAD, 1));

-			method.instructions.add(new IntInsnNode(Opcodes.ALOAD, 2));

+			method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

+			method.instructions.add(new VarInsnNode(Opcodes.ILOAD, 1));

+			method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 2));

 			method.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, superToCall, this.method.getName(), this.method.getSignature(), false));

 		} else {

 			method.instructions.add(new InsnNode(Opcodes.ACONST_NULL));

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForAccessAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForAccessAdapter.java
index ebeedfe..a06fb00 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForAccessAdapter.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForAccessAdapter.java
@@ -23,11 +23,11 @@
 import org.objectweb.asm.Opcodes;

 import org.objectweb.asm.Type;

 import org.objectweb.asm.tree.InsnNode;

-import org.objectweb.asm.tree.IntInsnNode;

 import org.objectweb.asm.tree.LdcInsnNode;

 import org.objectweb.asm.tree.MethodInsnNode;

 import org.objectweb.asm.tree.MethodNode;

 import org.objectweb.asm.tree.TypeInsnNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 /**

  * Initially prepares the method access or accessStatic as follows: <br/><br/>

@@ -53,9 +53,9 @@
 	@Override

 	protected void addPreSwitchInstructions(MethodNode method) {

 		// put "accessId" on the stack

-		method.instructions.add(new IntInsnNode(Opcodes.ILOAD, getFirstArgIndex()));

+		method.instructions.add(new VarInsnNode(Opcodes.ILOAD, getFirstArgIndex()));

 		// put "caller".getClass() on the stack

-		method.instructions.add(new IntInsnNode(Opcodes.ALOAD, getFirstArgIndex() + 3));

+		method.instructions.add(new VarInsnNode(Opcodes.ALOAD, getFirstArgIndex() + 3));

 		method.instructions.add(new MethodInsnNode(Opcodes.INVOKEVIRTUAL, "java/lang/Object", "getClass", "()Ljava/lang/Class;", false));

 		// call "getMemberId(accessId, callerClass)

 		method.instructions

@@ -71,7 +71,7 @@
 		if (superClassName == null || superClassName.equals("java/lang/Object")) {

 			method.instructions.add(new TypeInsnNode(Opcodes.NEW, "org/objectteams/NoSuchMethodError"));

 			method.instructions.add(new InsnNode(Opcodes.DUP));

-			method.instructions.add(new IntInsnNode(Opcodes.ILOAD, getFirstArgIndex())); // accessId

+			method.instructions.add(new VarInsnNode(Opcodes.ILOAD, getFirstArgIndex())); // accessId

 			method.instructions.add(new LdcInsnNode(clazz.getName()));					 // current class

 			method.instructions.add(new LdcInsnNode("decapsulating access"));			 // access reason

 			method.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, "org/objectteams/NoSuchMethodError", "<init>", "(ILjava/lang/String;Ljava/lang/String;)V", false));

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForCallAllBindingsNode.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForCallAllBindingsNode.java
index 4c6c844..86cc1c0 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForCallAllBindingsNode.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/CreateSwitchForCallAllBindingsNode.java
@@ -20,11 +20,11 @@
 import org.objectweb.asm.Opcodes;

 import org.objectweb.asm.Type;

 import org.objectweb.asm.tree.InsnNode;

-import org.objectweb.asm.tree.IntInsnNode;

 import org.objectweb.asm.tree.JumpInsnNode;

 import org.objectweb.asm.tree.LabelNode;

 import org.objectweb.asm.tree.MethodInsnNode;

 import org.objectweb.asm.tree.MethodNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 /**

  * Initially prepares the method callAllBindings as follows: <br/><br/>

@@ -55,13 +55,13 @@
 	@Override

 	protected void addPostSwitchInstructions(MethodNode method) {

 		method.instructions.add(gotoLabel);

-		method.instructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

+		method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

 		

 		args = Type.getArgumentTypes(method.desc);

 		int length = args.length;

 		for (int i = 0; i < length; i++) {

 			Type arg = args[i]; 

-			method.instructions.add(new IntInsnNode(arg.getOpcode(Opcodes.ILOAD), i + 1));

+			method.instructions.add(new VarInsnNode(arg.getOpcode(Opcodes.ILOAD), i + 1));

 		}

 		

 		// return callOrig(boundMethodId, args);

diff --git a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/MoveCodeToCallOrigAdapter.java b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/MoveCodeToCallOrigAdapter.java
index 5e068cd..cd248d0 100644
--- a/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/MoveCodeToCallOrigAdapter.java
+++ b/plugins/org.eclipse.objectteams.otredyn/src/org/eclipse/objectteams/otredyn/bytecode/asm/MoveCodeToCallOrigAdapter.java
@@ -36,6 +36,7 @@
 import org.objectweb.asm.tree.MethodNode;

 import org.objectweb.asm.tree.TryCatchBlockNode;

 import org.objectweb.asm.tree.TypeInsnNode;

+import org.objectweb.asm.tree.VarInsnNode;

 

 

 

@@ -94,12 +95,12 @@
 		

 		if (args.length > 0) {

 			// move boundMethodId to a higher slot, to make lower slots available for original locals

-			newInstructions.add(new IntInsnNode(Opcodes.ILOAD, boundMethodIdSlot));

+			newInstructions.add(new VarInsnNode(Opcodes.ILOAD, boundMethodIdSlot));

 			boundMethodIdSlot = orgMethod.maxLocals+1;

 			addLocal(callOrig, BOUND_METHOD_ID, "I", boundMethodIdSlot, start, end, false);

 			newInstructions.add(new IntInsnNode(Opcodes.ISTORE, boundMethodIdSlot));

 			

-			newInstructions.add(new IntInsnNode(Opcodes.ALOAD, firstArgIndex + argOffset + 1));

+			newInstructions.add(new VarInsnNode(Opcodes.ALOAD, firstArgIndex + argOffset + 1));

 			

 			int slot = firstArgIndex + argOffset;

 			for (int i = argOffset; i < args.length; i++) {

@@ -171,10 +172,10 @@
 	private InsnList superOrigCall(Method method, Type[] args) {

 		InsnList newInstructions = new InsnList();

 

-		newInstructions.add(new IntInsnNode(Opcodes.ALOAD, 0));

+		newInstructions.add(new VarInsnNode(Opcodes.ALOAD, 0));

 		

 		for (int i = argOffset; i < args.length; i++) {

-			newInstructions.add(new IntInsnNode(Opcodes.ALOAD, firstArgIndex + argOffset + 1));

+			newInstructions.add(new VarInsnNode(Opcodes.ALOAD, firstArgIndex + argOffset + 1));

 			newInstructions.add(createLoadIntConstant(i));

 			newInstructions.add(new InsnNode(Opcodes.AALOAD));

 			Type arg = args[i];

@@ -225,7 +226,7 @@
 		// replace:

 		replaceSuperCallsWithCallToCallOrig(instructions, toReplace, true, superclass, new IBoundMethodIdInsnProvider() {

 			@Override public AbstractInsnNode getLoadBoundMethodIdInsn(MethodInsnNode methodInsn) {

-				return new IntInsnNode(Opcodes.ILOAD, boundMethodIdSlot);

+				return new VarInsnNode(Opcodes.ILOAD, boundMethodIdSlot);

 			}

 		});

 	}