Commit a02a19dfc1678e8405155332b58b89b1da401be6

Authored by Mumfrey
1 parent 98dc04c3

Remove legacy ASM in favour of Mixin ASM

Showing 36 changed files with 197 additions and 1213 deletions
build.gradle
... ... @@ -72,7 +72,7 @@ repositories {
72 72 }
73 73  
74 74 dependencies {
75   - compile('org.spongepowered:mixin:0.7.3-SNAPSHOT') {
  75 + compile('org.spongepowered:mixin:0.7.4-SNAPSHOT') {
76 76 exclude module: 'asm-commons'
77 77 exclude module: 'asm-tree'
78 78 exclude module: 'launchwrapper'
... ... @@ -81,6 +81,12 @@ dependencies {
81 81 }
82 82 }
83 83  
  84 +configurations {
  85 + forgeGradleMcDeps {
  86 + exclude module: 'asm-debug-all'
  87 + }
  88 +}
  89 +
84 90 minecraft {
85 91 version = project.mcVersion
86 92 mappings = project.mcMappings
... ...
src/client/java/com/mumfrey/liteloader/client/transformers/CrashReportTransformer.java
... ... @@ -7,13 +7,13 @@ package com.mumfrey.liteloader.client.transformers;
7 7  
8 8 import java.util.ListIterator;
9 9  
10   -import org.objectweb.asm.Opcodes;
11   -import org.objectweb.asm.tree.AbstractInsnNode;
12   -import org.objectweb.asm.tree.ClassNode;
13   -import org.objectweb.asm.tree.InsnList;
14   -import org.objectweb.asm.tree.MethodInsnNode;
15   -import org.objectweb.asm.tree.MethodNode;
16   -import org.objectweb.asm.tree.VarInsnNode;
  10 +import org.spongepowered.asm.lib.Opcodes;
  11 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  12 +import org.spongepowered.asm.lib.tree.ClassNode;
  13 +import org.spongepowered.asm.lib.tree.InsnList;
  14 +import org.spongepowered.asm.lib.tree.MethodInsnNode;
  15 +import org.spongepowered.asm.lib.tree.MethodNode;
  16 +import org.spongepowered.asm.lib.tree.VarInsnNode;
17 17  
18 18 import com.mumfrey.liteloader.core.runtime.Obf;
19 19 import com.mumfrey.liteloader.transformers.ClassTransformer;
... ...
src/main/java/com/mumfrey/liteloader/common/mixin/MixinNetHandlerPlayServer.java
... ... @@ -5,7 +5,7 @@
5 5 */
6 6 package com.mumfrey.liteloader.common.mixin;
7 7  
8   -import org.objectweb.asm.Opcodes;
  8 +import org.spongepowered.asm.lib.Opcodes;
9 9 import org.spongepowered.asm.mixin.Mixin;
10 10 import org.spongepowered.asm.mixin.Shadow;
11 11 import org.spongepowered.asm.mixin.injection.At;
... ...
src/main/java/com/mumfrey/liteloader/common/transformers/LiteLoaderPacketTransformer.java
... ... @@ -5,10 +5,11 @@
5 5 */
6 6 package com.mumfrey.liteloader.common.transformers;
7 7  
  8 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
  9 +
8 10 import com.mumfrey.liteloader.core.runtime.Obf;
9 11 import com.mumfrey.liteloader.core.runtime.Packets;
10 12 import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
11   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
12 13 import com.mumfrey.liteloader.transformers.event.MethodInfo;
13 14 import com.mumfrey.liteloader.transformers.event.inject.MethodHead;
14 15  
... ...
src/main/java/com/mumfrey/liteloader/common/transformers/PacketEvent.java
... ... @@ -8,13 +8,13 @@ package com.mumfrey.liteloader.common.transformers;
8 8 import java.util.HashSet;
9 9 import java.util.Set;
10 10  
11   -import org.objectweb.asm.Opcodes;
12   -import org.objectweb.asm.tree.InsnList;
13   -import org.objectweb.asm.tree.InsnNode;
14   -import org.objectweb.asm.tree.IntInsnNode;
15   -import org.objectweb.asm.tree.LdcInsnNode;
16   -import org.objectweb.asm.tree.MethodInsnNode;
17   -import org.objectweb.asm.tree.VarInsnNode;
  11 +import org.spongepowered.asm.lib.Opcodes;
  12 +import org.spongepowered.asm.lib.tree.InsnList;
  13 +import org.spongepowered.asm.lib.tree.InsnNode;
  14 +import org.spongepowered.asm.lib.tree.IntInsnNode;
  15 +import org.spongepowered.asm.lib.tree.LdcInsnNode;
  16 +import org.spongepowered.asm.lib.tree.MethodInsnNode;
  17 +import org.spongepowered.asm.lib.tree.VarInsnNode;
18 18  
19 19 import com.mumfrey.liteloader.core.runtime.Obf;
20 20 import com.mumfrey.liteloader.core.runtime.Packets;
... ...
src/main/java/com/mumfrey/liteloader/core/event/EventProxy.java
... ... @@ -9,9 +9,9 @@ import java.util.concurrent.Callable;
9 9  
10 10 import javax.management.RuntimeErrorException;
11 11  
12   -import org.objectweb.asm.Type;
  12 +import org.spongepowered.asm.lib.Type;
  13 +import org.spongepowered.asm.util.SignaturePrinter;
13 14  
14   -import com.mumfrey.liteloader.transformers.ByteCodeUtilities;
15 15 import com.mumfrey.liteloader.transformers.event.EventInfo;
16 16  
17 17 import net.minecraft.crash.CrashReport;
... ... @@ -181,7 +181,7 @@ public final class EventProxy
181 181 }
182 182 return false;
183 183 default:
184   - tpl.append(ByteCodeUtilities.getTypeName(type));
  184 + tpl.append(SignaturePrinter.getTypeName(type, false));
185 185 return false;
186 186 }
187 187 }
... ...
src/main/java/com/mumfrey/liteloader/core/event/HandlerList.java
... ... @@ -20,26 +20,14 @@ import java.util.List;
20 20 import java.util.Set;
21 21  
22 22 import org.apache.commons.io.FileUtils;
23   -import org.objectweb.asm.ClassReader;
24   -import org.objectweb.asm.ClassWriter;
25   -import org.objectweb.asm.Label;
26   -import org.objectweb.asm.Opcodes;
27   -import org.objectweb.asm.Type;
28   -import org.objectweb.asm.tree.AbstractInsnNode;
29   -import org.objectweb.asm.tree.ClassNode;
30   -import org.objectweb.asm.tree.FieldInsnNode;
31   -import org.objectweb.asm.tree.FieldNode;
32   -import org.objectweb.asm.tree.InsnNode;
33   -import org.objectweb.asm.tree.IntInsnNode;
34   -import org.objectweb.asm.tree.JumpInsnNode;
35   -import org.objectweb.asm.tree.LabelNode;
36   -import org.objectweb.asm.tree.LdcInsnNode;
37   -import org.objectweb.asm.tree.LineNumberNode;
38   -import org.objectweb.asm.tree.MethodInsnNode;
39   -import org.objectweb.asm.tree.MethodNode;
40   -import org.objectweb.asm.tree.TypeInsnNode;
41   -import org.objectweb.asm.tree.VarInsnNode;
42   -import org.objectweb.asm.util.CheckClassAdapter;
  23 +import org.spongepowered.asm.lib.ClassReader;
  24 +import org.spongepowered.asm.lib.ClassWriter;
  25 +import org.spongepowered.asm.lib.Label;
  26 +import org.spongepowered.asm.lib.Opcodes;
  27 +import org.spongepowered.asm.lib.Type;
  28 +import org.spongepowered.asm.lib.tree.*;
  29 +import org.spongepowered.asm.lib.util.CheckClassAdapter;
  30 +import org.spongepowered.asm.util.Bytecode;
43 31  
44 32 import com.mumfrey.liteloader.Priority;
45 33 import com.mumfrey.liteloader.core.runtime.Obf;
... ... @@ -1008,7 +996,7 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T
1008 996  
1009 997 method.instructions.add(new InsnNode(returnType.getOpcode(Opcodes.IRETURN)));
1010 998  
1011   - int argsSize = ByteCodeUtilities.getArgsSize(args);
  999 + int argsSize = Bytecode.getFirstNonArgLocalIndex(args, false);
1012 1000 method.maxLocals = argsSize + 1;
1013 1001 method.maxStack = argsSize + 1;
1014 1002 }
... ... @@ -1023,7 +1011,7 @@ public class HandlerList<T> extends LinkedList<T> implements FastIterableDeque<T
1023 1011 boolean isOrOperation = this.logicOp.isOr();
1024 1012 boolean breakOnMatch = this.logicOp.breakOnMatch();
1025 1013 int initialValue = isOrOperation && (!this.logicOp.assumeTrue() || this.size > 0) ? Opcodes.ICONST_0 : Opcodes.ICONST_1;
1026   - int localIndex = ByteCodeUtilities.getArgsSize(args) + 1;
  1014 + int localIndex = Bytecode.getFirstNonArgLocalIndex(args, false) + 1;
1027 1015  
1028 1016 method.instructions.add(new InsnNode(initialValue));
1029 1017 method.instructions.add(new VarInsnNode(Opcodes.ISTORE, localIndex));
... ...
src/main/java/com/mumfrey/liteloader/core/event/IHandlerListDecorator.java
... ... @@ -7,9 +7,9 @@ package com.mumfrey.liteloader.core.event;
7 7  
8 8 import java.util.List;
9 9  
10   -import org.objectweb.asm.Type;
11   -import org.objectweb.asm.tree.ClassNode;
12   -import org.objectweb.asm.tree.MethodNode;
  10 +import org.spongepowered.asm.lib.Type;
  11 +import org.spongepowered.asm.lib.tree.ClassNode;
  12 +import org.spongepowered.asm.lib.tree.MethodNode;
13 13  
14 14 import com.mumfrey.liteloader.core.event.HandlerList.BakedHandlerList;
15 15 import com.mumfrey.liteloader.core.runtime.Obf;
... ...
src/main/java/com/mumfrey/liteloader/core/event/ProfilingHandlerList.java
... ... @@ -9,14 +9,14 @@ import java.lang.reflect.Constructor;
9 9 import java.util.ArrayList;
10 10 import java.util.List;
11 11  
12   -import org.objectweb.asm.Opcodes;
13   -import org.objectweb.asm.Type;
14   -import org.objectweb.asm.tree.ClassNode;
15   -import org.objectweb.asm.tree.InsnNode;
16   -import org.objectweb.asm.tree.LdcInsnNode;
17   -import org.objectweb.asm.tree.MethodInsnNode;
18   -import org.objectweb.asm.tree.MethodNode;
19   -import org.objectweb.asm.tree.VarInsnNode;
  12 +import org.spongepowered.asm.lib.Opcodes;
  13 +import org.spongepowered.asm.lib.Type;
  14 +import org.spongepowered.asm.lib.tree.ClassNode;
  15 +import org.spongepowered.asm.lib.tree.InsnNode;
  16 +import org.spongepowered.asm.lib.tree.LdcInsnNode;
  17 +import org.spongepowered.asm.lib.tree.MethodInsnNode;
  18 +import org.spongepowered.asm.lib.tree.MethodNode;
  19 +import org.spongepowered.asm.lib.tree.VarInsnNode;
20 20  
21 21 import com.mumfrey.liteloader.api.Listener;
22 22 import com.mumfrey.liteloader.core.runtime.Obf;
... ...
src/main/java/com/mumfrey/liteloader/launch/LiteLoaderTransformer.java
... ... @@ -5,11 +5,11 @@
5 5 */
6 6 package com.mumfrey.liteloader.launch;
7 7  
8   -import org.objectweb.asm.Opcodes;
9   -import org.objectweb.asm.tree.ClassNode;
10   -import org.objectweb.asm.tree.FieldNode;
11   -import org.objectweb.asm.tree.MethodInsnNode;
12   -import org.objectweb.asm.tree.MethodNode;
  8 +import org.spongepowered.asm.lib.Opcodes;
  9 +import org.spongepowered.asm.lib.tree.ClassNode;
  10 +import org.spongepowered.asm.lib.tree.FieldNode;
  11 +import org.spongepowered.asm.lib.tree.MethodInsnNode;
  12 +import org.spongepowered.asm.lib.tree.MethodNode;
13 13  
14 14 import com.mumfrey.liteloader.core.runtime.Obf;
15 15 import com.mumfrey.liteloader.transformers.ClassTransformer;
... ...
src/main/java/com/mumfrey/liteloader/launch/LiteLoaderTweaker.java
... ... @@ -16,6 +16,7 @@ import java.util.Set;
16 16 import java.util.TreeSet;
17 17  
18 18 import org.spongepowered.asm.launch.MixinBootstrap;
  19 +import org.spongepowered.asm.service.MixinService;
19 20  
20 21 import com.google.common.base.Preconditions;
21 22 import com.mumfrey.liteloader.launch.LoaderEnvironment.EnvironmentType;
... ... @@ -374,7 +375,7 @@ public class LiteLoaderTweaker implements ITweaker
374 375 {
375 376 this.transformerManager.injectDownstreamTransformers(Launch.classLoader);
376 377 this.bootstrap.preBeginGame();
377   - MixinBootstrap.addProxy();
  378 + MixinService.getService().beginPhase();
378 379 StartupState.BEGINGAME.completed();
379 380 }
380 381 catch (Throwable th)
... ...
src/main/java/com/mumfrey/liteloader/transformers/ByteCodeUtilities.java
... ... @@ -6,33 +6,15 @@
6 6 package com.mumfrey.liteloader.transformers;
7 7  
8 8 import java.io.IOException;
9   -import java.lang.annotation.Annotation;
10   -import java.util.ArrayList;
11   -import java.util.HashMap;
12   -import java.util.Iterator;
13 9 import java.util.List;
14   -import java.util.Map;
15   -
16   -import org.objectweb.asm.ClassReader;
17   -import org.objectweb.asm.Opcodes;
18   -import org.objectweb.asm.Type;
19   -import org.objectweb.asm.tree.AbstractInsnNode;
20   -import org.objectweb.asm.tree.AnnotationNode;
21   -import org.objectweb.asm.tree.ClassNode;
22   -import org.objectweb.asm.tree.FieldNode;
23   -import org.objectweb.asm.tree.FrameNode;
24   -import org.objectweb.asm.tree.InsnList;
25   -import org.objectweb.asm.tree.LabelNode;
26   -import org.objectweb.asm.tree.LocalVariableNode;
27   -import org.objectweb.asm.tree.MethodInsnNode;
28   -import org.objectweb.asm.tree.MethodNode;
29   -import org.objectweb.asm.tree.TypeInsnNode;
30   -import org.objectweb.asm.tree.VarInsnNode;
31   -import org.objectweb.asm.tree.analysis.Analyzer;
32   -import org.objectweb.asm.tree.analysis.AnalyzerException;
33   -import org.objectweb.asm.tree.analysis.BasicValue;
34   -import org.objectweb.asm.tree.analysis.Frame;
35   -import org.objectweb.asm.tree.analysis.SimpleVerifier;
  10 +
  11 +import org.spongepowered.asm.lib.ClassReader;
  12 +import org.spongepowered.asm.lib.Type;
  13 +import org.spongepowered.asm.lib.tree.AnnotationNode;
  14 +import org.spongepowered.asm.lib.tree.ClassNode;
  15 +import org.spongepowered.asm.lib.tree.FieldNode;
  16 +import org.spongepowered.asm.lib.tree.MethodNode;
  17 +import org.spongepowered.asm.util.Annotations;
36 18  
37 19 import com.mumfrey.liteloader.core.runtime.Obf;
38 20  
... ... @@ -46,498 +28,8 @@ import net.minecraft.launchwrapper.Launch;
46 28 */
47 29 public abstract class ByteCodeUtilities
48 30 {
49   - private static Map<String, List<LocalVariableNode>> calculatedLocalVariables = new HashMap<String, List<LocalVariableNode>>();
50   -
51 31 private ByteCodeUtilities() {}
52   -
53   - /**
54   - * Replace all constructor invocations for the target class in the supplied
55   - * classNode with invocations of the replacement class.
56   - *
57   - * @param classNode Class to search in
58   - * @param target Target type
59   - * @param replacement Replacement type
60   - */
61   - public static void replaceConstructors(ClassNode classNode, Obf target, Obf replacement)
62   - {
63   - for (MethodNode method : classNode.methods)
64   - {
65   - ByteCodeUtilities.replaceConstructors(method, target, replacement);
66   - }
67   - }
68   -
69   - /**
70   - * Replace all constructor invocations for the target class in the supplied
71   - * method with invocations of the replacement class.
72   - *
73   - * @param method Method to look in
74   - * @param target Target type
75   - * @param replacement Replacement type
76   - */
77   - public static void replaceConstructors(MethodNode method, Obf target, Obf replacement)
78   - {
79   - Iterator<AbstractInsnNode> iter = method.instructions.iterator();
80   - while (iter.hasNext())
81   - {
82   - AbstractInsnNode insn = iter.next();
83   - if (insn.getOpcode() == Opcodes.NEW)
84   - {
85   - TypeInsnNode typeInsn = (TypeInsnNode)insn;
86   - if (target.obf.equals(typeInsn.desc) || target.ref.equals(typeInsn.desc))
87   - {
88   - typeInsn.desc = replacement.ref;
89   - }
90   - }
91   - else if (insn instanceof MethodInsnNode && insn.getOpcode() == Opcodes.INVOKESPECIAL)
92   - {
93   - MethodInsnNode methodInsn = (MethodInsnNode)insn;
94   - if ((target.obf.equals(methodInsn.owner) || target.ref.equals(methodInsn.owner)) && "<init>".equals(methodInsn.name))
95   - {
96   - methodInsn.owner = replacement.ref;
97   - }
98   - }
99   - }
100   - }
101   -
102   - /**
103   - * Injects appropriate LOAD opcodes into the supplied InsnList appropriate
104   - * for each entry in the args array starting at pos.
105   - *
106   - * @param args Argument types
107   - * @param insns Instruction List to inject into
108   - * @param pos Start position
109   - */
110   - public static void loadArgs(Type[] args, InsnList insns, int pos)
111   - {
112   - ByteCodeUtilities.loadArgs(args, insns, pos, -1);
113   - }
114   -
115   - /**
116   - * Injects appropriate LOAD opcodes into the supplied InsnList appropriate
117   - * for each entry in the args array starting at start and ending at end.
118   - *
119   - * @param args Argument types
120   - * @param insns Instruction List to inject into
121   - * @param start Start position
122   - * @param end End position
123   - */
124   - public static void loadArgs(Type[] args, InsnList insns, int start, int end)
125   - {
126   - int pos = start;
127   -
128   - for (Type type : args)
129   - {
130   - insns.add(new VarInsnNode(type.getOpcode(Opcodes.ILOAD), pos));
131   - pos += type.getSize();
132   - if (end >= start && pos >= end) return;
133   - }
134   - }
135   -
136   - /**
137   - * Injects appropriate LOAD opcodes into the supplied InsnList for each
138   - * entry in the supplied locals array starting at pos.
139   - *
140   - * @param locals Local types (can contain nulls for uninitialised, TOP, or
141   - * RETURN values in locals)
142   - * @param insns Instruction List to inject into
143   - * @param pos Start position
144   - */
145   - public static void loadLocals(Type[] locals, InsnList insns, int pos)
146   - {
147   - for (; pos < locals.length; pos++)
148   - {
149   - if (locals[pos] != null)
150   - {
151   - insns.add(new VarInsnNode(locals[pos].getOpcode(Opcodes.ILOAD), pos));
152   - }
153   - }
154   - }
155   -
156   - /**
157   - * Get the first variable index in the supplied method which is not an
158   - * argument or "this" reference, this corresponds to the size of the
159   - * arguments passed in to the method plus an extra spot for "this" if the
160   - * method is non-static.
161   - *
162   - * @param method MethodNode to inspect
163   - * @return first available local index which is NOT used by a method
164   - * argument or "this"
165   - */
166   - public static int getFirstNonArgLocalIndex(MethodNode method)
167   - {
168   - return ByteCodeUtilities.getFirstNonArgLocalIndex(Type.getArgumentTypes(method.desc), (method.access & Opcodes.ACC_STATIC) == 0);
169   - }
170   -
171   - /**
172   - * Get the first non-arg variable index based on the supplied arg array and
173   - * whether to include the "this" reference, this corresponds to the size of
174   - * the arguments passed in to the method plus an extra spot for "this" is
175   - * specified.
176   - *
177   - * @param args Method arguments
178   - * @param includeThis Whether to include a slot for "this" (generally true
179   - * for all non-static methods)
180   - * @return first available local index which is NOT used by a method
181   - * argument or "this"
182   - */
183   - public static int getFirstNonArgLocalIndex(Type[] args, boolean includeThis)
184   - {
185   - return ByteCodeUtilities.getArgsSize(args) + (includeThis ? 1 : 0);
186   - }
187   -
188   - /**
189   - * Get the size of the specified args array in local variable terms (eg.
190   - * doubles and longs take two spaces).
191   - *
192   - * @param args Method argument types as array
193   - * @return size of the specified arguments array in terms of stack slots
194   - */
195   - public static int getArgsSize(Type[] args)
196   - {
197   - int size = 0;
198   -
199   - for (Type type : args)
200   - {
201   - size += type.getSize();
202   - }
203   -
204   - return size;
205   - }
206   -
207   - /**
208   - * Attempts to identify available locals at an arbitrary point in the
209   - * bytecode specified by node.
210   - *
211   - * <p>This method builds an approximate view of the locals available at an
212   - * arbitrary point in the bytecode by examining the following features in
213   - * the bytecode:</p>
214   - *
215   - * <ul>
216   - * <li>Any available stack map frames</li>
217   - * <li>STORE opcodes</li>
218   - * <li>The local variable table</li>
219   - * </ul>
220   - *
221   - * <p>Inference proceeds by walking the bytecode from the start of the
222   - * method looking for stack frames and STORE opcodes. When either of these
223   - * is encountered, an attempt is made to cross-reference the values in the
224   - * stack map or STORE opcode with the value in the local variable table
225   - * which covers the code range. Stack map frames overwrite the entire
226   - * simulated local variable table with their own value types, STORE opcodes
227   - * overwrite only the local slot to which they pertain. Values in the
228   - * simulated locals array are spaced according to their size (unlike the
229   - * representation in FrameNode) and this TOP, NULL and UNINTITIALIZED_THIS
230   - * opcodes will be represented as null values in the simulated frame.</p>
231   - *
232   - * <p>This code does not currently simulate the prescribed JVM behaviour
233   - * where overwriting the second slot of a DOUBLE or LONG actually
234   - * invalidates the DOUBLE or LONG stored in the previous location, so we
235   - * have to hope (for now) that this behaviour isn't emitted by the compiler
236   - * or any upstream transformers. I may have to re-think this strategy if
237   - * this situation is encountered in the wild.</p>
238   - *
239   - * @param classNode ClassNode containing the method, used to initialise the
240   - * implicit "this" reference in simple methods with no stack frames
241   - * @param method MethodNode to explore
242   - * @param node Node indicating the position at which to determine the locals
243   - * state. The locals will be enumerated UP TO the specified node, so
244   - * bear in mind that if the specified node is itself a STORE opcode,
245   - * then we will be looking at the state of the locals PRIOR to its
246   - * invocation
247   - * @return A sparse array containing a view (hopefully) of the locals at the
248   - * specified location
249   - */
250   - public static LocalVariableNode[] getLocalsAt(ClassNode classNode, MethodNode method, AbstractInsnNode node)
251   - {
252   - LocalVariableNode[] frame = new LocalVariableNode[method.maxLocals];
253   -
254   - // Initialise implicit "this" reference in non-static methods
255   - if ((method.access & Opcodes.ACC_STATIC) == 0)
256   - {
257   - frame[0] = new LocalVariableNode("this", classNode.name, null, null, null, 0);
258   - }
259   -
260   - for (Iterator<AbstractInsnNode> iter = method.instructions.iterator(); iter.hasNext();)
261   - {
262   - AbstractInsnNode insn = iter.next();
263   - if (insn instanceof FrameNode)
264   - {
265   - FrameNode frameNode = (FrameNode)insn;
266   -
267   - // localPos tracks the location in the frame node's locals list, which doesn't leave space for TOP entries
268   - for (int localPos = 0, framePos = 0; framePos < frame.length; framePos++, localPos++)
269   - {
270   - // Get the local at the current position in the FrameNode's locals list
271   - final Object localType = (localPos < frameNode.local.size()) ? frameNode.local.get(localPos) : null;
272   -
273   - if (localType instanceof String) // String refers to a reference type
274   - {
275   - frame[framePos] = ByteCodeUtilities.getLocalVariableAt(classNode, method, node, framePos);
276   - }
277   - else if (localType instanceof Integer) // Integer refers to a primitive type or other marker
278   - {
279   - boolean isMarkerType = localType == Opcodes.UNINITIALIZED_THIS || localType == Opcodes.TOP || localType == Opcodes.NULL;
280   - boolean is32bitValue = localType == Opcodes.INTEGER || localType == Opcodes.FLOAT;
281   - boolean is64bitValue = localType == Opcodes.DOUBLE || localType == Opcodes.LONG;
282   - if (isMarkerType)
283   - {
284   - frame[framePos] = null;
285   - }
286   - else if (is32bitValue || is64bitValue)
287   - {
288   - frame[framePos] = ByteCodeUtilities.getLocalVariableAt(classNode, method, node, framePos);
289   -
290   - if (is64bitValue)
291   - {
292   - framePos++;
293   - frame[framePos] = null; // TOP
294   - }
295   - }
296   - else
297   - {
298   - throw new RuntimeException("Unrecognised locals opcode " + localType + " in locals array at position " + localPos + " in "
299   - + classNode.name + "." + method.name + method.desc);
300   - }
301   - }
302   - else if (localType == null)
303   - {
304   - frame[framePos] = null;
305   - }
306   - else
307   - {
308   - throw new RuntimeException("Invalid value " + localType + " in locals array at position " + localPos + " in " + classNode.name
309   - + "." + method.name + method.desc);
310   - }
311   - }
312   - }
313   - else if (insn instanceof VarInsnNode)
314   - {
315   - VarInsnNode varNode = (VarInsnNode)insn;
316   - frame[varNode.var] = ByteCodeUtilities.getLocalVariableAt(classNode, method, node, varNode.var);
317   - }
318   - else if (insn == node)
319   - {
320   - break;
321   - }
322   - }
323   -
324   - return frame;
325   - }
326   -
327   - /**
328   - * Attempts to locate the appropriate entry in the local variable table for
329   - * the specified local variable index at the location specified by node.
330   - *
331   - * @param classNode Containing class
332   - * @param method Method
333   - * @param node Instruction defining the location to get the local variable
334   - * table at
335   - * @param var Local variable index
336   - * @return a LocalVariableNode containing information about the local
337   - * variable at the specified location in the specified local slot
338   - */
339   - public static LocalVariableNode getLocalVariableAt(ClassNode classNode, MethodNode method, AbstractInsnNode node, int var)
340   - {
341   - LocalVariableNode localVariableNode = null;
342   -
343   - int pos = method.instructions.indexOf(node);
344   -
345   - List<LocalVariableNode> localVariables = ByteCodeUtilities.getLocalVariableTable(classNode, method);
346   - for (LocalVariableNode local : localVariables)
347   - {
348   - if (local.index != var) continue;
349   - int start = method.instructions.indexOf(local.start);
350   - int end = method.instructions.indexOf(local.end);
351   - if (localVariableNode == null || start < pos && end > pos)
352   - {
353   - localVariableNode = local;
354   - }
355   - }
356   -
357   - return localVariableNode;
358   - }
359   -
360   - /**
361   - * Fetches or generates the local variable table for the specified method.
362   - * Since Mojang strip the local variable table as part of the obfuscation
363   - * process, we need to generate the local variable table when running
364   - * obfuscated. We cache the generated tables so that we only need to do the
365   - * relatively expensive calculation once per method we encounter.
366   - *
367   - * @param classNode Containing class
368   - * @param method Method
369   - */
370   - public static List<LocalVariableNode> getLocalVariableTable(ClassNode classNode, MethodNode method)
371   - {
372   - if (method.localVariables.isEmpty())
373   - {
374   - String signature = String.format("%s.%s%s", classNode.name, method.name, method.desc);
375   -
376   - List<LocalVariableNode> localVars = ByteCodeUtilities.calculatedLocalVariables.get(signature);
377   - if (localVars != null)
378   - {
379   - return localVars;
380   - }
381   -
382   - localVars = ByteCodeUtilities.generateLocalVariableTable(classNode, method);
383   - ByteCodeUtilities.calculatedLocalVariables.put(signature, localVars);
384   - return localVars;
385   - }
386   -
387   - return method.localVariables;
388   - }
389   -
390   - /**
391   - * Use ASM Analyzer to generate the local variable table for the specified
392   - * method.
393   - *
394   - * @param classNode Containing class
395   - * @param method Method
396   - */
397   - public static List<LocalVariableNode> generateLocalVariableTable(ClassNode classNode, MethodNode method)
398   - {
399   - List<Type> interfaces = null;
400   - if (classNode.interfaces != null)
401   - {
402   - interfaces = new ArrayList<Type>();
403   - for (String iface : classNode.interfaces)
404   - {
405   - interfaces.add(Type.getObjectType(iface));
406   - }
407   - }
408   -
409   - Type objectType = null;
410   - if (classNode.superName != null)
411   - {
412   - objectType = Type.getObjectType(classNode.superName);
413   - }
414   -
415   - // Use Analyzer to generate the bytecode frames
416   - Analyzer<BasicValue> analyzer = new Analyzer<BasicValue>(new SimpleVerifier(Type.getObjectType(classNode.name),
417   - objectType, interfaces, false));
418   - try
419   - {
420   - analyzer.analyze(classNode.name, method);
421   - }
422   - catch (AnalyzerException ex)
423   - {
424   - ex.printStackTrace();
425   - }
426   -
427   - // Get frames from the Analyzer
428   - Frame<BasicValue>[] frames = analyzer.getFrames();
429   -
430   - // Record the original size of hte method
431   - int methodSize = method.instructions.size();
432   -
433   - // List of LocalVariableNodes to return
434   - List<LocalVariableNode> localVariables = new ArrayList<LocalVariableNode>();
435   -
436   - LocalVariableNode[] localNodes = new LocalVariableNode[method.maxLocals]; // LocalVariableNodes for current frame
437   - BasicValue[] locals = new BasicValue[method.maxLocals]; // locals in previous frame, used to work out what changes between frames
438   - LabelNode[] labels = new LabelNode[methodSize]; // Labels to add to the method, for the markers
439   -
440   - // Traverse the frames and work out when locals begin and end
441   - for (int i = 0; i < methodSize; i++)
442   - {
443   - Frame<BasicValue> f = frames[i];
444   - if (f == null) continue;
445   - LabelNode label = null;
446   -
447   - for (int j = 0; j < f.getLocals(); j++)
448   - {
449   - BasicValue local = f.getLocal(j);
450   - if (local == null && locals[j] == null) continue;
451   - if (local != null && local.equals(locals[j])) continue;
452   -
453   - if (label == null)
454   - {
455   - label = new LabelNode();
456   - labels[i] = label;
457   - }
458   -
459   - if (local == null && locals[j] != null)
460   - {
461   - localVariables.add(localNodes[j]);
462   - localNodes[j].end = label;
463   - localNodes[j] = null;
464   - }
465   - else if (local != null)
466   - {
467   - if (locals[j] != null)
468   - {
469   - localVariables.add(localNodes[j]);
470   - localNodes[j].end = label;
471   - localNodes[j] = null;
472   - }
473   -
474   - String desc = (local.getType() != null) ? local.getType().getDescriptor() : null;
475   - localNodes[j] = new LocalVariableNode("var" + j, desc, null, label, null, j);
476   - }
477   -
478   - locals[j] = local;
479   - }
480   - }
481   -
482   - // Reached the end of the method so flush all current locals and mark the end
483   - LabelNode label = null;
484   - for (int k = 0; k < localNodes.length; k++)
485   - {
486   - if (localNodes[k] != null)
487   - {
488   - if (label == null)
489   - {
490   - label = new LabelNode();
491   - method.instructions.add(label);
492   - }
493   -
494   - localNodes[k].end = label;
495   - localVariables.add(localNodes[k]);
496   - }
497   - }
498   -
499   - // Insert generated labels into the method body
500   - for (int n = methodSize - 1; n >= 0; n--)
501   - {
502   - if (labels[n] != null)
503   - {
504   - method.instructions.insert(method.instructions.get(n), labels[n]);
505   - }
506   - }
507   -
508   - return localVariables;
509   - }
510   -
511   - /**
512   - * Get the source code name for the specified type.
513   - *
514   - * @param type Type to generate a friendly name for
515   - * @return String representation of the specified type, eg "int" for an
516   - * integer primitive or "String" for java.lang.String
517   - */
518   - public static String getTypeName(Type type)
519   - {
520   - switch (type.getSort())
521   - {
522   - case Type.BOOLEAN: return "boolean";
523   - case Type.CHAR: return "char";
524   - case Type.BYTE: return "byte";
525   - case Type.SHORT: return "short";
526   - case Type.INT: return "int";
527   - case Type.FLOAT: return "float";
528   - case Type.LONG: return "long";
529   - case Type.DOUBLE: return "double";
530   - case Type.ARRAY: return ByteCodeUtilities.getTypeName(type.getElementType()) + "[]";
531   - case Type.OBJECT:
532   - String typeName = type.getClassName();
533   - typeName = typeName.substring(typeName.lastIndexOf('.') + 1);
534   - return typeName;
535   - default:
536   - return "Object";
537   - }
538   -
539   - }
540   -
  32 +
541 33 /**
542 34 * Finds a method in the target class, uses names specified in the
543 35 * {@link Obfuscated} annotation if present.
... ... @@ -555,10 +47,10 @@ public abstract class ByteCodeUtilities
555 47 }
556 48 }
557 49  
558   - AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getVisibleAnnotation(searchFor, Obfuscated.class);
  50 + AnnotationNode obfuscatedAnnotation = Annotations.getVisible(searchFor, Obfuscated.class);
559 51 if (obfuscatedAnnotation != null)
560 52 {
561   - for (String obfuscatedName : ByteCodeUtilities.<List<String>>getAnnotationValue(obfuscatedAnnotation))
  53 + for (String obfuscatedName : Annotations.<String>getValue(obfuscatedAnnotation, "value", true))
562 54 {
563 55 for (MethodNode target : targetClass.methods)
564 56 {
... ... @@ -590,10 +82,10 @@ public abstract class ByteCodeUtilities
590 82 }
591 83 }
592 84  
593   - AnnotationNode obfuscatedAnnotation = ByteCodeUtilities.getVisibleAnnotation(searchFor, Obfuscated.class);
  85 + AnnotationNode obfuscatedAnnotation = Annotations.getVisible(searchFor, Obfuscated.class);
594 86 if (obfuscatedAnnotation != null)
595 87 {
596   - for (String obfuscatedName : ByteCodeUtilities.<List<String>>getAnnotationValue(obfuscatedAnnotation))
  88 + for (String obfuscatedName : Annotations.<String>getValue(obfuscatedAnnotation, "value", true))
597 89 {
598 90 for (FieldNode target : targetClass.fields)
599 91 {
... ... @@ -708,107 +200,6 @@ public abstract class ByteCodeUtilities
708 200 }
709 201  
710 202 /**
711   - * Get an annotation of the specified class from the supplied field node
712   - */
713   - public static AnnotationNode getVisibleAnnotation(FieldNode field, Class<? extends Annotation> annotationClass)
714   - {
715   - return ByteCodeUtilities.getAnnotation(field.visibleAnnotations, Type.getDescriptor(annotationClass));
716   - }
717   -
718   - /**
719   - * Get an annotation of the specified class from the supplied field node
720   - */
721   - public static AnnotationNode getInvisibleAnnotation(FieldNode field, Class<? extends Annotation> annotationClass)
722   - {
723   - return ByteCodeUtilities.getAnnotation(field.invisibleAnnotations, Type.getDescriptor(annotationClass));
724   - }
725   -
726   - /**
727   - * Get an annotation of the specified class from the supplied method node
728   - */
729   - public static AnnotationNode getVisibleAnnotation(MethodNode method, Class<? extends Annotation> annotationClass)
730   - {
731   - return ByteCodeUtilities.getAnnotation(method.visibleAnnotations, Type.getDescriptor(annotationClass));
732   - }
733   -
734   - /**
735   - * Get an annotation of the specified class from the supplied method node
736   - */
737   - public static AnnotationNode getInvisibleAnnotation(MethodNode method, Class<? extends Annotation> annotationClass)
738   - {
739   - return ByteCodeUtilities.getAnnotation(method.invisibleAnnotations, Type.getDescriptor(annotationClass));
740   - }
741   -
742   - /**
743   - * Get an annotation of the specified class from the supplied class node
744   - */
745   - public static AnnotationNode getVisibleAnnotation(ClassNode classNode, Class<? extends Annotation> annotationClass)
746   - {
747   - return ByteCodeUtilities.getAnnotation(classNode.visibleAnnotations, Type.getDescriptor(annotationClass));
748   - }
749   -
750   - /**
751   - * Get an annotation of the specified class from the supplied class node
752   - */
753   - public static AnnotationNode getInvisibleAnnotation(ClassNode classNode, Class<? extends Annotation> annotationClass)
754   - {
755   - return ByteCodeUtilities.getAnnotation(classNode.invisibleAnnotations, Type.getDescriptor(annotationClass));
756   - }
757   -
758   - /**
759   - * Get an annotation of the specified class from the supplied list of
760   - * annotations, returns null if no matching annotation was found
761   - */
762   - public static AnnotationNode getAnnotation(List<AnnotationNode> annotations, String annotationType)
763   - {
764   - if (annotations != null)
765   - {
766   - for (AnnotationNode annotation : annotations)
767   - {
768   - if (annotationType.equals(annotation.desc))
769   - {
770   - return annotation;
771   - }
772   - }
773   - }
774   -
775   - return null;
776   - }
777   -
778   - /**
779   - * Get the value of an annotation node (the value at key "value")
780   - *
781   - * @param annotation Annotation node to inspect
782   - */
783   - public static <T> T getAnnotationValue(AnnotationNode annotation)
784   - {
785   - return ByteCodeUtilities.getAnnotationValue(annotation, "value");
786   - }
787   -
788   - /**
789   - * Get the value of an annotation node
790   - *
791   - * @param annotation
792   - * @param key
793   - */
794   - @SuppressWarnings("unchecked")
795   - public static <T> T getAnnotationValue(AnnotationNode annotation, String key)
796   - {
797   - if (annotation == null || annotation.values == null)
798   - {
799   - return null;
800   - }
801   -
802   - boolean getNextValue = false;
803   - for (Object value : annotation.values)
804   - {
805   - if (getNextValue) return (T)value;
806   - if (value.equals(key)) getNextValue = true;
807   - }
808   - return null;
809   - }
810   -
811   - /**
812 203 * @param returnType
813 204 * @param args
814 205 */
... ...
src/main/java/com/mumfrey/liteloader/transformers/CallbackInjectionTransformer.java
... ... @@ -10,17 +10,17 @@ import java.util.Iterator;
10 10 import java.util.Map;
11 11 import java.util.Map.Entry;
12 12  
13   -import org.objectweb.asm.Opcodes;
14   -import org.objectweb.asm.Type;
15   -import org.objectweb.asm.tree.AbstractInsnNode;
16   -import org.objectweb.asm.tree.ClassNode;
17   -import org.objectweb.asm.tree.InsnList;
18   -import org.objectweb.asm.tree.InsnNode;
19   -import org.objectweb.asm.tree.IntInsnNode;
20   -import org.objectweb.asm.tree.LdcInsnNode;
21   -import org.objectweb.asm.tree.MethodInsnNode;
22   -import org.objectweb.asm.tree.MethodNode;
23   -import org.objectweb.asm.tree.VarInsnNode;
  13 +import org.spongepowered.asm.lib.Opcodes;
  14 +import org.spongepowered.asm.lib.Type;
  15 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  16 +import org.spongepowered.asm.lib.tree.ClassNode;
  17 +import org.spongepowered.asm.lib.tree.InsnList;
  18 +import org.spongepowered.asm.lib.tree.InsnNode;
  19 +import org.spongepowered.asm.lib.tree.IntInsnNode;
  20 +import org.spongepowered.asm.lib.tree.LdcInsnNode;
  21 +import org.spongepowered.asm.lib.tree.MethodInsnNode;
  22 +import org.spongepowered.asm.lib.tree.MethodNode;
  23 +import org.spongepowered.asm.lib.tree.VarInsnNode;
24 24  
25 25 import com.mumfrey.liteloader.core.runtime.Obf;
26 26 import com.mumfrey.liteloader.transformers.Callback.CallbackType;
... ...
src/main/java/com/mumfrey/liteloader/transformers/ClassOverlayTransformer.java
... ... @@ -13,20 +13,20 @@
13 13 //import java.util.Map;
14 14 //import java.util.Set;
15 15 //
16   -//import org.objectweb.asm.ClassReader;
17   -//import org.objectweb.asm.ClassWriter;
18   -//import org.objectweb.asm.Opcodes;
19   -//import org.objectweb.asm.Type;
20   -//import org.objectweb.asm.commons.RemappingClassAdapter;
21   -//import org.objectweb.asm.commons.SimpleRemapper;
22   -//import org.objectweb.asm.tree.AbstractInsnNode;
23   -//import org.objectweb.asm.tree.AnnotationNode;
24   -//import org.objectweb.asm.tree.ClassNode;
25   -//import org.objectweb.asm.tree.FieldInsnNode;
26   -//import org.objectweb.asm.tree.FieldNode;
27   -//import org.objectweb.asm.tree.LineNumberNode;
28   -//import org.objectweb.asm.tree.MethodInsnNode;
29   -//import org.objectweb.asm.tree.MethodNode;
  16 +//import org.spongepowered.asm.lib.ClassReader;
  17 +//import org.spongepowered.asm.lib.ClassWriter;
  18 +//import org.spongepowered.asm.lib.Opcodes;
  19 +//import org.spongepowered.asm.lib.Type;
  20 +//import org.spongepowered.asm.lib.commons.RemappingClassAdapter;
  21 +//import org.spongepowered.asm.lib.commons.SimpleRemapper;
  22 +//import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  23 +//import org.spongepowered.asm.lib.tree.AnnotationNode;
  24 +//import org.spongepowered.asm.lib.tree.ClassNode;
  25 +//import org.spongepowered.asm.lib.tree.FieldInsnNode;
  26 +//import org.spongepowered.asm.lib.tree.FieldNode;
  27 +//import org.spongepowered.asm.lib.tree.LineNumberNode;
  28 +//import org.spongepowered.asm.lib.tree.MethodInsnNode;
  29 +//import org.spongepowered.asm.lib.tree.MethodNode;
30 30 //
31 31 //import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
32 32 //
... ...
src/main/java/com/mumfrey/liteloader/transformers/ClassTransformer.java
... ... @@ -5,9 +5,9 @@
5 5 */
6 6 package com.mumfrey.liteloader.transformers;
7 7  
8   -import org.objectweb.asm.ClassReader;
9   -import org.objectweb.asm.ClassWriter;
10   -import org.objectweb.asm.tree.ClassNode;
  8 +import org.spongepowered.asm.lib.ClassReader;
  9 +import org.spongepowered.asm.lib.ClassWriter;
  10 +import org.spongepowered.asm.lib.tree.ClassNode;
11 11  
12 12 import net.minecraft.launchwrapper.IClassTransformer;
13 13  
... ...
src/main/java/com/mumfrey/liteloader/transformers/IsolatedClassWriter.java
... ... @@ -5,8 +5,8 @@
5 5 */
6 6 package com.mumfrey.liteloader.transformers;
7 7  
8   -import org.objectweb.asm.ClassReader;
9   -import org.objectweb.asm.ClassWriter;
  8 +import org.spongepowered.asm.lib.ClassReader;
  9 +import org.spongepowered.asm.lib.ClassWriter;
10 10  
11 11 /**
12 12 * ClassWriter isolated from ASM so that it exists in the LaunchClassLoader
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/AccessorTransformer.java
... ... @@ -12,19 +12,11 @@ import java.util.List;
12 12 import java.util.regex.Matcher;
13 13 import java.util.regex.Pattern;
14 14  
15   -import org.objectweb.asm.Opcodes;
16   -import org.objectweb.asm.Type;
17   -import org.objectweb.asm.tree.AnnotationNode;
18   -import org.objectweb.asm.tree.ClassNode;
19   -import org.objectweb.asm.tree.FieldInsnNode;
20   -import org.objectweb.asm.tree.FieldNode;
21   -import org.objectweb.asm.tree.InsnList;
22   -import org.objectweb.asm.tree.InsnNode;
23   -import org.objectweb.asm.tree.LdcInsnNode;
24   -import org.objectweb.asm.tree.MethodInsnNode;
25   -import org.objectweb.asm.tree.MethodNode;
26   -import org.objectweb.asm.tree.TypeInsnNode;
27   -import org.objectweb.asm.tree.VarInsnNode;
  15 +import org.spongepowered.asm.lib.Opcodes;
  16 +import org.spongepowered.asm.lib.Type;
  17 +import org.spongepowered.asm.lib.tree.*;
  18 +import org.spongepowered.asm.util.Annotations;
  19 +import org.spongepowered.asm.util.Bytecode;
28 20  
29 21 import com.mumfrey.liteloader.core.runtime.Obf;
30 22 import com.mumfrey.liteloader.transformers.ByteCodeUtilities;
... ... @@ -83,7 +75,7 @@ abstract class AccessorTransformer extends ClassTransformer
83 75 * @throws IOException Thrown if an problem occurs when loading the
84 76 * interface bytecode
85 77 */
86   - protected AccessorInjection(String iface) throws IOException
  78 + protected AccessorInjection(String iface) throws IOException, ClassNotFoundException
87 79 {
88 80 this(iface, null);
89 81 }
... ... @@ -95,8 +87,9 @@ abstract class AccessorTransformer extends ClassTransformer
95 87 * @param obfProvider Obfuscation provider for this context
96 88 * @throws IOException Thrown if an problem occurs when loading the
97 89 * interface bytecode
  90 + * @throws ClassNotFoundException
98 91 */
99   - protected AccessorInjection(String iface, ObfProvider obfProvider) throws IOException
  92 + protected AccessorInjection(String iface, ObfProvider obfProvider) throws IOException, ClassNotFoundException
100 93 {
101 94 ClassNode ifaceNode = ByteCodeUtilities.loadClass(iface, false);
102 95  
... ... @@ -173,12 +166,12 @@ abstract class AccessorTransformer extends ClassTransformer
173 166 @SuppressWarnings("unchecked")
174 167 private Class<? extends Obf> setupTable(ClassNode ifaceNode)
175 168 {
176   - AnnotationNode annotation = ByteCodeUtilities.getInvisibleAnnotation(ifaceNode, ObfTableClass.class);
  169 + AnnotationNode annotation = Annotations.getInvisible(ifaceNode, ObfTableClass.class);
177 170 if (annotation != null)
178 171 {
179 172 try
180 173 {
181   - Type obfTableType = ByteCodeUtilities.getAnnotationValue(annotation);
  174 + Type obfTableType = Annotations.<Type>getValue(annotation);
182 175 return (Class<? extends Obf>)Class.forName(obfTableType.getClassName(), true, Launch.classLoader);
183 176 }
184 177 catch (ClassNotFoundException ex)
... ... @@ -196,14 +189,14 @@ abstract class AccessorTransformer extends ClassTransformer
196 189 */
197 190 private Obf setupTarget(ClassNode ifaceNode)
198 191 {
199   - AnnotationNode annotation = ByteCodeUtilities.getInvisibleAnnotation(ifaceNode, Accessor.class);
  192 + AnnotationNode annotation = Annotations.getInvisible(ifaceNode, Accessor.class);
200 193 if (annotation == null)
201 194 {
202 195 throw new RuntimeException("Accessor interfaces must be annotated with an @Accessor annotation specifying the target class");
203 196 }
204 197  
205   - List<String> targetClass = ByteCodeUtilities.<List<String>>getAnnotationValue(annotation);
206   - if (targetClass == null || targetClass.isEmpty())
  198 + List<String> targetClass = Annotations.<String>getValue(annotation, "value", true);
  199 + if (targetClass.isEmpty())
207 200 {
208 201 throw new RuntimeException("Invalid @Accessor annotation, the annotation must specify a target class");
209 202 }
... ... @@ -261,17 +254,17 @@ abstract class AccessorTransformer extends ClassTransformer
261 254 LiteLoaderLogger.debug("[AccessorTransformer] Attempting to add %s to %s", method.name, classNode.name);
262 255  
263 256 List<String> targetId = null;
264   - AnnotationNode accessor = ByteCodeUtilities.getInvisibleAnnotation(method, Accessor.class);
265   - AnnotationNode invoker = ByteCodeUtilities.getInvisibleAnnotation(method, Invoker.class);
  257 + AnnotationNode accessor = Annotations.getInvisible(method, Accessor.class);
  258 + AnnotationNode invoker = Annotations.getInvisible(method, Invoker.class);
266 259 if (accessor != null)
267 260 {
268   - targetId = ByteCodeUtilities.<List<String>>getAnnotationValue(accessor);
  261 + targetId = Annotations.<String>getValue(accessor, "value", true);
269 262 Obf target = this.getObf(targetId);
270 263 if (this.injectAccessor(classNode, method, target)) return;
271 264 }
272 265 else if (invoker != null)
273 266 {
274   - targetId = ByteCodeUtilities.<List<String>>getAnnotationValue(invoker);
  267 + targetId = Annotations.<String>getValue(invoker, "value", true);
275 268 Obf target = this.getObf(targetId);
276 269 if (this.injectInvoker(classNode, method, target)) return;
277 270 }
... ... @@ -355,7 +348,7 @@ abstract class AccessorTransformer extends ClassTransformer
355 348 boolean isStatic = (field.access & Opcodes.ACC_STATIC) != 0;
356 349  
357 350 method.instructions.clear();
358   - method.maxLocals = ByteCodeUtilities.getFirstNonArgLocalIndex(method);
  351 + method.maxLocals = Bytecode.getFirstNonArgLocalIndex(method);
359 352 method.maxStack = fieldType.getSize();
360 353  
361 354 if (isStatic)
... ... @@ -394,7 +387,7 @@ abstract class AccessorTransformer extends ClassTransformer
394 387 boolean isStatic = (field.access & Opcodes.ACC_STATIC) != 0;
395 388  
396 389 method.instructions.clear();
397   - method.maxLocals = ByteCodeUtilities.getFirstNonArgLocalIndex(method);
  390 + method.maxLocals = Bytecode.getFirstNonArgLocalIndex(method);
398 391 method.maxStack = fieldType.getSize();
399 392  
400 393 if (isStatic)
... ... @@ -426,17 +419,17 @@ abstract class AccessorTransformer extends ClassTransformer
426 419 boolean isStatic = (targetMethod.access & Opcodes.ACC_STATIC) != 0;
427 420  
428 421 method.instructions.clear();
429   - method.maxStack = (method.maxLocals = ByteCodeUtilities.getFirstNonArgLocalIndex(method)) + 1;
  422 + method.maxStack = (method.maxLocals = Bytecode.getFirstNonArgLocalIndex(method)) + 1;
430 423  
431 424 if (isStatic)
432 425 {
433   - ByteCodeUtilities.loadArgs(args, method.instructions, 0);
  426 + Bytecode.loadArgs(args, method.instructions, 0);
434 427 method.instructions.add(new MethodInsnNode(Opcodes.INVOKESTATIC, classNode.name, targetMethod.name, targetMethod.desc, false));
435 428 }
436 429 else
437 430 {
438 431 method.instructions.add(new VarInsnNode(Opcodes.ALOAD, 0));
439   - ByteCodeUtilities.loadArgs(args, method.instructions, 1);
  432 + Bytecode.loadArgs(args, method.instructions, 1);
440 433 method.instructions.add(new MethodInsnNode(Opcodes.INVOKESPECIAL, classNode.name, targetMethod.name, targetMethod.desc, false));
441 434 }
442 435  
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/Event.java
... ... @@ -14,25 +14,13 @@ import java.util.Map;
14 14 import java.util.Map.Entry;
15 15 import java.util.Set;
16 16  
17   -import org.objectweb.asm.Label;
18   -import org.objectweb.asm.Opcodes;
19   -import org.objectweb.asm.Type;
20   -import org.objectweb.asm.tree.AbstractInsnNode;
21   -import org.objectweb.asm.tree.ClassNode;
22   -import org.objectweb.asm.tree.InsnList;
23   -import org.objectweb.asm.tree.InsnNode;
24   -import org.objectweb.asm.tree.JumpInsnNode;
25   -import org.objectweb.asm.tree.LabelNode;
26   -import org.objectweb.asm.tree.LdcInsnNode;
27   -import org.objectweb.asm.tree.LineNumberNode;
28   -import org.objectweb.asm.tree.MethodInsnNode;
29   -import org.objectweb.asm.tree.MethodNode;
30   -import org.objectweb.asm.tree.TryCatchBlockNode;
31   -import org.objectweb.asm.tree.TypeInsnNode;
32   -import org.objectweb.asm.tree.VarInsnNode;
  17 +import org.spongepowered.asm.lib.Label;
  18 +import org.spongepowered.asm.lib.Opcodes;
  19 +import org.spongepowered.asm.lib.Type;
  20 +import org.spongepowered.asm.lib.tree.*;
  21 +import org.spongepowered.asm.util.Bytecode;
33 22  
34 23 import com.mumfrey.liteloader.core.runtime.Obf;
35   -import com.mumfrey.liteloader.transformers.ByteCodeUtilities;
36 24 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
37 25  
38 26 /**
... ... @@ -376,7 +364,7 @@ public class Event implements Comparable&lt;Event&gt;
376 364 this.validate(injectionPoint, cancellable, globalEventID);
377 365  
378 366 Type[] arguments = Type.getArgumentTypes(this.method.desc);
379   - int initialFrameSize = ByteCodeUtilities.getFirstNonArgLocalIndex(arguments, !this.methodIsStatic);
  367 + int initialFrameSize = Bytecode.getFirstNonArgLocalIndex(arguments, !this.methodIsStatic);
380 368  
381 369 boolean doCaptureLocals = captureLocals && locals != null && locals.length > initialFrameSize;
382 370 String eventDescriptor = this.generateEventDescriptor(doCaptureLocals, locals, arguments, initialFrameSize);
... ... @@ -413,10 +401,10 @@ public class Event implements Comparable&lt;Event&gt;
413 401  
414 402 // Call the event handler method in the proxy
415 403 insns.add(new VarInsnNode(Opcodes.ALOAD, marshallVar));
416   - ByteCodeUtilities.loadArgs(arguments, insns, this.methodIsStatic ? 0 : 1);
  404 + Bytecode.loadArgs(arguments, insns, this.methodIsStatic ? 0 : 1);
417 405 if (doCaptureLocals)
418 406 {
419   - ByteCodeUtilities.loadLocals(locals, insns, initialFrameSize);
  407 + Bytecode.loadArgs(locals, insns, initialFrameSize);
420 408 }
421 409 insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, Event.getActiveProxyRef(), handler.name, handler.desc, false));
422 410  
... ... @@ -646,7 +634,7 @@ public class Event implements Comparable&lt;Event&gt;
646 634 insns.add(lineNumberLabel);
647 635 insns.add(new LineNumberNode(++lineNumber, lineNumberLabel));
648 636  
649   - ByteCodeUtilities.loadArgs(args, insns, 0);
  637 + Bytecode.loadArgs(args, insns, 0);
650 638 insns.add(new MethodInsnNode(Opcodes.INVOKESTATIC, listener.ownerRef, listener.getOrInflectName(event.name),
651 639 handlerMethod.desc, false));
652 640 }
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/EventInfo.java
... ... @@ -5,7 +5,7 @@
5 5 */
6 6 package com.mumfrey.liteloader.transformers.event;
7 7  
8   -import org.objectweb.asm.Type;
  8 +import org.spongepowered.asm.lib.Type;
9 9  
10 10 import com.mumfrey.liteloader.core.event.Cancellable;
11 11 import com.mumfrey.liteloader.core.event.EventCancellationException;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/EventInjectionTransformer.java
... ... @@ -5,6 +5,8 @@
5 5 */
6 6 package com.mumfrey.liteloader.transformers.event;
7 7  
  8 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
  9 +
8 10 import com.mumfrey.liteloader.transformers.ObfProvider;
9 11  
10 12 import net.minecraft.launchwrapper.IClassTransformer;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/EventProxyTransformer.java
... ... @@ -5,10 +5,10 @@
5 5 */
6 6 package com.mumfrey.liteloader.transformers.event;
7 7  
8   -import org.objectweb.asm.Opcodes;
9   -import org.objectweb.asm.tree.ClassNode;
10   -import org.objectweb.asm.tree.InsnNode;
11   -import org.objectweb.asm.tree.MethodNode;
  8 +import org.spongepowered.asm.lib.Opcodes;
  9 +import org.spongepowered.asm.lib.tree.ClassNode;
  10 +import org.spongepowered.asm.lib.tree.InsnNode;
  11 +import org.spongepowered.asm.lib.tree.MethodNode;
12 12  
13 13 import com.mumfrey.liteloader.core.runtime.Obf;
14 14 import com.mumfrey.liteloader.transformers.ClassTransformer;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/EventTransformer.java
... ... @@ -17,17 +17,17 @@ import java.util.Set;
17 17 import java.util.TreeSet;
18 18  
19 19 import org.apache.commons.io.FileUtils;
20   -import org.objectweb.asm.ClassWriter;
21   -import org.objectweb.asm.Type;
22   -import org.objectweb.asm.tree.AbstractInsnNode;
23   -import org.objectweb.asm.tree.ClassNode;
24   -import org.objectweb.asm.tree.LocalVariableNode;
25   -import org.objectweb.asm.tree.MethodNode;
26   -import org.objectweb.asm.util.CheckClassAdapter;
  20 +import org.spongepowered.asm.lib.ClassWriter;
  21 +import org.spongepowered.asm.lib.Type;
  22 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  23 +import org.spongepowered.asm.lib.tree.ClassNode;
  24 +import org.spongepowered.asm.lib.tree.LocalVariableNode;
  25 +import org.spongepowered.asm.lib.tree.MethodNode;
  26 +import org.spongepowered.asm.lib.util.CheckClassAdapter;
  27 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
27 28  
28 29 import com.google.common.collect.Maps;
29 30 import com.mumfrey.liteloader.core.runtime.Obf;
30   -import com.mumfrey.liteloader.transformers.ByteCodeUtilities;
31 31 import com.mumfrey.liteloader.transformers.ClassTransformer;
32 32 import com.mumfrey.liteloader.transformers.ObfProvider;
33 33 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
... ... @@ -151,16 +151,6 @@ public final class EventTransformer extends ClassTransformer
151 151 return this.captureLocals;
152 152 }
153 153  
154   - public void checkCaptureLocals(InjectionPoint injectionPoint)
155   - {
156   - if (injectionPoint.captureLocals != this.captureLocals)
157   - {
158   - throw new RuntimeException("Overlapping injection points defined with incompatible settings. Attempting to handle "
159   - + injectionPoint + " with capture locals [" + injectionPoint.captureLocals + "] but already defined injection point with ["
160   - + this.captureLocals + "]");
161   - }
162   - }
163   -
164 154 public void add(Event event)
165 155 {
166 156 this.events.add(event);
... ... @@ -328,43 +318,16 @@ public final class EventTransformer extends ClassTransformer
328 318 event.attach(method);
329 319 InjectionPoint injectionPoint = eventEntry.getValue();
330 320 nodes.clear();
331   - if (injectionPoint.find(method.desc, insns, nodes, event))
  321 + if (injectionPoint.find(method.desc, insns, nodes))
332 322 {
333 323 for (AbstractInsnNode node : nodes)
334 324 {
335 325 Injection injection = injectionPoints.get(node);
336 326 if (injection == null)
337 327 {
338   - injection = new Injection(node, injectionPoint.captureLocals());
  328 + injection = new Injection(node, false);
339 329 injectionPoints.put(node, injection);
340 330 }
341   - else
342   - {
343   - injection.checkCaptureLocals(injectionPoint);
344   - }
345   -
346   - if (injectionPoint.captureLocals() && !injection.hasLocals())
347   - {
348   - LocalVariableNode[] locals = ByteCodeUtilities.getLocalsAt(classNode, method, node);
349   - injection.setLocals(locals);
350   - if (injectionPoint.logLocals())
351   - {
352   - int startPos = ByteCodeUtilities.getFirstNonArgLocalIndex(method);
353   -
354   - LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
355   - LiteLoaderLogger.debug("Logging local variables for " + injectionPoint);
356   - for (int i = startPos; i < locals.length; i++)
357   - {
358   - LocalVariableNode local = locals[i];
359   - if (local != null)
360   - {
361   - LiteLoaderLogger.debug(" Local[%d] %s %s", i, ByteCodeUtilities.getTypeName(Type.getType(local.desc)),
362   - local.name);
363   - }
364   - }
365   - LiteLoaderLogger.debug(ClassTransformer.HORIZONTAL_RULE);
366   - }
367   - }
368 331  
369 332 injection.add(event);
370 333 }
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/InjectionPoint.java deleted 100644 โ†’ 0
1   -/*
2   - * This file is part of LiteLoader.
3   - * Copyright (C) 2012-16 Adam Mummery-Smith
4   - * All Rights Reserved.
5   - */
6   -package com.mumfrey.liteloader.transformers.event;
7   -
8   -import java.util.ArrayList;
9   -import java.util.Collection;
10   -import java.util.LinkedHashSet;
11   -import java.util.List;
12   -
13   -import org.objectweb.asm.tree.AbstractInsnNode;
14   -import org.objectweb.asm.tree.InsnList;
15   -
16   -import com.google.common.base.Joiner;
17   -
18   -/**
19   - * Base class for injection point discovery classes. Each subclass describes a
20   - * strategy for locating code injection points within a method, with the
21   - * {@link #find} method populating a collection with insn nodes from the method
22   - * which satisfy its strategy.
23   - *
24   - * <p>This base class also contains composite strategy factory methods such as
25   - * {@code and} and {@code or} which allow strategies to be combined using
26   - * intersection (and) or union (or) relationships to allow multiple strategies
27   - * to be easily combined.</p>
28   - *
29   - * <p>You are free to create your own injection point subclasses, but take note
30   - * that it is allowed for a single InjectionPoint instance to be used for
31   - * multiple injections and thus implementing classes MUST NOT cache the insn
32   - * list, event, or nodes instance passed to the {@code find} method, as each
33   - * call to {@code find} must be considered a separate functional contract and
34   - * the InjectionPoint's lifespan is not linked to the discovery lifespan,
35   - * therefore it is important that the InjectionPoint implementation is fully
36   - * STATELESS.</p>
37   - *
38   - * @author Adam Mummery-Smith
39   - */
40   -public abstract class InjectionPoint
41   -{
42   - /**
43   - * Capture locals as well as args
44   - */
45   - protected boolean captureLocals;
46   -
47   - protected boolean logLocals;
48   -
49   - /**
50   - * Find injection points in the supplied insn list
51   - *
52   - * @param desc Method descriptor, supplied to allow return types and
53   - * arguments etc. to be determined
54   - * @param insns Insn list to search in, the strategy MUST ONLY add nodes
55   - * from this list to the {@code nodes} collection
56   - * @param nodes Collection of nodes to populate. Injectors should NOT make
57   - * any assumptions about the state of this collection and should only
58   - * call add()
59   - * @param event Event being injected here, supplied to allow alteration of
60   - * behaviour for specific event configurations (eg. cancellable)
61   - * @return true if one or more injection points were found
62   - */
63   - public abstract boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event);
64   -
65   - /**
66   - * Set whether this injection point should capture local variables as well
67   - * as method arguments.
68   - *
69   - * @param captureLocals
70   - * @return this, for fluent interface
71   - */
72   - public InjectionPoint setCaptureLocals(boolean captureLocals)
73   - {
74   - this.captureLocals = captureLocals;
75   - return this;
76   - }
77   -
78   - /**
79   - * Get whether capture locals is enabled
80   - */
81   - public boolean captureLocals()
82   - {
83   - return this.captureLocals;
84   - }
85   -
86   - /**
87   - * Since it's virtually impossible to know what locals are available at a
88   - * given injection point by reading the source, this method causes the
89   - * injection point to dump the locals to the debug log at injection time.
90   - *
91   - * @param logLocals
92   - * @return this, for fluent interface
93   - */
94   - public InjectionPoint setLogLocals(boolean logLocals)
95   - {
96   - this.logLocals = logLocals;
97   - return this;
98   - }
99   -
100   - /**
101   - * Get whether log locals is enabled
102   - */
103   - public boolean logLocals()
104   - {
105   - return this.logLocals;
106   - }
107   -
108   - @Override
109   - public String toString()
110   - {
111   - return "InjectionPoint(" + this.getClass().getSimpleName() + ")";
112   - }
113   -
114   - /**
115   - * Composite injection point
116   - *
117   - * @author Adam Mummery-Smith
118   - */
119   - abstract static class CompositeInjectionPoint extends InjectionPoint
120   - {
121   - protected final InjectionPoint[] components;
122   -
123   - protected CompositeInjectionPoint(InjectionPoint... components)
124   - {
125   - if (components == null || components.length < 2)
126   - {
127   - throw new IllegalArgumentException("Must supply two or more component injection points for composite point!");
128   - }
129   -
130   - this.components = components;
131   -
132   - for (InjectionPoint component : this.components)
133   - {
134   - this.captureLocals |= component.captureLocals;
135   - this.logLocals |= component.logLocals;
136   - }
137   - }
138   -
139   - @Override
140   - public String toString()
141   - {
142   - return "CompositeInjectionPoint(" + this.getClass().getSimpleName() + ")[" + Joiner.on(',').join(this.components) + "]";
143   - }
144   - }
145   -
146   - static final class Intersection extends InjectionPoint.CompositeInjectionPoint
147   - {
148   - public Intersection(InjectionPoint... points)
149   - {
150   - super(points);
151   - }
152   -
153   - @Override
154   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
155   - {
156   - boolean found = false;
157   -
158   - @SuppressWarnings("unchecked")
159   - ArrayList<AbstractInsnNode>[] allNodes = new ArrayList[this.components.length];
160   -
161   - for (int i = 0; i < this.components.length; i++)
162   - {
163   - allNodes[i] = new ArrayList<AbstractInsnNode>();
164   - this.components[i].find(desc, insns, allNodes[i], event);
165   - }
166   -
167   - ArrayList<AbstractInsnNode> alpha = allNodes[0];
168   - for (int nodeIndex = 0; nodeIndex < alpha.size(); nodeIndex++)
169   - {
170   - AbstractInsnNode node = alpha.get(nodeIndex);
171   - boolean in = true;
172   -
173   - for (int b = 1; b < allNodes.length; b++)
174   - {
175   - if (!allNodes[b].contains(node))
176   - {
177   - break;
178   - }
179   - }
180   -
181   - if (!in) continue;
182   -
183   - nodes.add(node);
184   - found = true;
185   - }
186   -
187   - return found;
188   - }
189   - }
190   -
191   - static final class Union extends InjectionPoint.CompositeInjectionPoint
192   - {
193   - public Union(InjectionPoint... points)
194   - {
195   - super(points);
196   - }
197   -
198   - @Override
199   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
200   - {
201   - LinkedHashSet<AbstractInsnNode> allNodes = new LinkedHashSet<AbstractInsnNode>();
202   -
203   - for (int i = 0; i < this.components.length; i++)
204   - {
205   - this.components[i].find(desc, insns, allNodes, event);
206   - }
207   -
208   - nodes.addAll(allNodes);
209   -
210   - return allNodes.size() > 0;
211   - }
212   - }
213   -
214   - static final class Shift extends InjectionPoint
215   - {
216   - private final InjectionPoint input;
217   - private final int shift;
218   -
219   - public Shift(InjectionPoint input, int shift)
220   - {
221   - if (input == null)
222   - {
223   - throw new IllegalArgumentException("Must supply an input injection point for SHIFT");
224   - }
225   -
226   - this.input = input;
227   - this.shift = shift;
228   - }
229   -
230   - @Override
231   - public InjectionPoint setCaptureLocals(boolean captureLocals)
232   - {
233   - return this.input.setCaptureLocals(captureLocals);
234   - }
235   -
236   - @Override
237   - public boolean captureLocals()
238   - {
239   - return this.input.captureLocals();
240   - }
241   -
242   - @Override
243   - public InjectionPoint setLogLocals(boolean logLocals)
244   - {
245   - return this.input.setLogLocals(logLocals);
246   - }
247   -
248   - @Override
249   - public boolean logLocals()
250   - {
251   - return this.input.logLocals();
252   - }
253   -
254   - @Override
255   - public String toString()
256   - {
257   - return "InjectionPoint(" + this.getClass().getSimpleName() + ")[" + this.input + "]";
258   - }
259   -
260   - @Override
261   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
262   - {
263   - List<AbstractInsnNode> list = (nodes instanceof List) ? (List<AbstractInsnNode>)nodes : new ArrayList<AbstractInsnNode>(nodes);
264   -
265   - this.input.find(desc, insns, nodes, event);
266   -
267   - for (int i = 0; i < list.size(); i++)
268   - {
269   - list.set(i, insns.get(insns.indexOf(list.get(i)) + this.shift));
270   - }
271   -
272   - if (nodes != list)
273   - {
274   - nodes.clear();
275   - nodes.addAll(list);
276   - }
277   -
278   - return nodes.size() > 0;
279   - }
280   - }
281   -
282   - /**
283   - * Returns a composite injection point which returns the intersection of
284   - * nodes from all component injection points
285   - *
286   - * @param operands
287   - */
288   - public static InjectionPoint and(InjectionPoint... operands)
289   - {
290   - return new InjectionPoint.Intersection(operands);
291   - }
292   -
293   - /**
294   - * Returns a composite injection point which returns the union of nodes from
295   - * all component injection points.
296   - *
297   - * @param operands
298   - */
299   - public static InjectionPoint or(InjectionPoint... operands)
300   - {
301   - return new InjectionPoint.Union(operands);
302   - }
303   -
304   - /**
305   - * Returns an injection point which returns all insns immediately following
306   - * insns from the supplied injection point.
307   - *
308   - * @param point
309   - */
310   - public static InjectionPoint after(InjectionPoint point)
311   - {
312   - return new InjectionPoint.Shift(point, 1);
313   - }
314   -
315   - /**
316   - * Returns an injection point which returns all insns immediately prior to
317   - * insns from the supplied injection point.
318   - *
319   - * @param point
320   - */
321   - public static InjectionPoint before(InjectionPoint point)
322   - {
323   - return new InjectionPoint.Shift(point, -1);
324   - }
325   -
326   - /**
327   - * Returns an injection point which returns all insns offset by the
328   - * specified "count" from insns from the supplied injection point.
329   - *
330   - * @param point
331   - */
332   - public static InjectionPoint shift(InjectionPoint point, int count)
333   - {
334   - return new InjectionPoint.Shift(point, count);
335   - }
336   -}
src/main/java/com/mumfrey/liteloader/transformers/event/Jump.java
... ... @@ -5,13 +5,13 @@
5 5 */
6 6 //package com.mumfrey.liteloader.transformers.event;
7 7 //
8   -//import org.objectweb.asm.Opcodes;
9   -//import org.objectweb.asm.tree.AbstractInsnNode;
10   -//import org.objectweb.asm.tree.InsnList;
11   -//import org.objectweb.asm.tree.InsnNode;
12   -//import org.objectweb.asm.tree.JumpInsnNode;
13   -//import org.objectweb.asm.tree.MethodInsnNode;
14   -//import org.objectweb.asm.tree.VarInsnNode;
  8 +//import org.spongepowered.asm.lib.Opcodes;
  9 +//import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  10 +//import org.spongepowered.asm.lib.tree.InsnList;
  11 +//import org.spongepowered.asm.lib.tree.InsnNode;
  12 +//import org.spongepowered.asm.lib.tree.JumpInsnNode;
  13 +//import org.spongepowered.asm.lib.tree.MethodInsnNode;
  14 +//import org.spongepowered.asm.lib.tree.VarInsnNode;
15 15 //
16 16 //public class Jump extends Event
17 17 //{
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/ReadOnlyInsnList.java
... ... @@ -7,8 +7,8 @@ package com.mumfrey.liteloader.transformers.event;
7 7  
8 8 import java.util.ListIterator;
9 9  
10   -import org.objectweb.asm.tree.AbstractInsnNode;
11   -import org.objectweb.asm.tree.InsnList;
  10 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  11 +import org.spongepowered.asm.lib.tree.InsnList;
12 12  
13 13 /**
14 14 * Read-only wrapper for InsnList
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/ReturnEventInfo.java
... ... @@ -5,7 +5,7 @@
5 5 */
6 6 package com.mumfrey.liteloader.transformers.event;
7 7  
8   -import org.objectweb.asm.Type;
  8 +import org.spongepowered.asm.lib.Type;
9 9  
10 10 import com.mumfrey.liteloader.core.event.EventCancellationException;
11 11  
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeFieldAccess.java
... ... @@ -5,8 +5,8 @@
5 5 */
6 6 package com.mumfrey.liteloader.transformers.event.inject;
7 7  
8   -import org.objectweb.asm.tree.AbstractInsnNode;
9   -import org.objectweb.asm.tree.FieldInsnNode;
  8 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  9 +import org.spongepowered.asm.lib.tree.FieldInsnNode;
10 10  
11 11 import com.mumfrey.liteloader.core.runtime.Obf;
12 12 import com.mumfrey.liteloader.transformers.event.MethodInfo;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeInvoke.java
... ... @@ -8,14 +8,13 @@ package com.mumfrey.liteloader.transformers.event.inject;
8 8 import java.util.Collection;
9 9 import java.util.ListIterator;
10 10  
11   -import org.objectweb.asm.tree.AbstractInsnNode;
12   -import org.objectweb.asm.tree.FieldInsnNode;
13   -import org.objectweb.asm.tree.InsnList;
14   -import org.objectweb.asm.tree.MethodInsnNode;
  11 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  12 +import org.spongepowered.asm.lib.tree.FieldInsnNode;
  13 +import org.spongepowered.asm.lib.tree.InsnList;
  14 +import org.spongepowered.asm.lib.tree.MethodInsnNode;
  15 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
15 16  
16 17 import com.mumfrey.liteloader.transformers.ClassTransformer;
17   -import com.mumfrey.liteloader.transformers.event.Event;
18   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
19 18 import com.mumfrey.liteloader.transformers.event.MethodInfo;
20 19 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
21 20  
... ... @@ -281,15 +280,8 @@ public class BeforeInvoke extends InjectionPoint
281 280 return this;
282 281 }
283 282  
284   - /* (non-Javadoc)
285   - * @see com.mumfrey.liteloader.transformers.event.InjectionStrategy
286   - * #findInjectionPoint(java.lang.String,
287   - * org.objectweb.asm.tree.InsnList,
288   - * com.mumfrey.liteloader.transformers.event.Event,
289   - * java.util.Collection)
290   - */
291 283 @Override
292   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
  284 + public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes)
293 285 {
294 286 int ordinal = 0;
295 287 boolean found = false;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeNew.java
... ... @@ -8,14 +8,13 @@ package com.mumfrey.liteloader.transformers.event.inject;
8 8 import java.util.Collection;
9 9 import java.util.ListIterator;
10 10  
11   -import org.objectweb.asm.Opcodes;
12   -import org.objectweb.asm.tree.AbstractInsnNode;
13   -import org.objectweb.asm.tree.InsnList;
14   -import org.objectweb.asm.tree.TypeInsnNode;
  11 +import org.spongepowered.asm.lib.Opcodes;
  12 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  13 +import org.spongepowered.asm.lib.tree.InsnList;
  14 +import org.spongepowered.asm.lib.tree.TypeInsnNode;
  15 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
15 16  
16 17 import com.mumfrey.liteloader.core.runtime.Obf;
17   -import com.mumfrey.liteloader.transformers.event.Event;
18   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
19 18  
20 19 public class BeforeNew extends InjectionPoint
21 20 {
... ... @@ -50,7 +49,7 @@ public class BeforeNew extends InjectionPoint
50 49 }
51 50  
52 51 @Override
53   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
  52 + public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes)
54 53 {
55 54 boolean found = false;
56 55 int ordinal = 0;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeReturn.java
... ... @@ -8,14 +8,12 @@ package com.mumfrey.liteloader.transformers.event.inject;
8 8 import java.util.Collection;
9 9 import java.util.ListIterator;
10 10  
11   -import org.objectweb.asm.Opcodes;
12   -import org.objectweb.asm.Type;
13   -import org.objectweb.asm.tree.AbstractInsnNode;
14   -import org.objectweb.asm.tree.InsnList;
15   -import org.objectweb.asm.tree.InsnNode;
16   -
17   -import com.mumfrey.liteloader.transformers.event.Event;
18   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  11 +import org.spongepowered.asm.lib.Opcodes;
  12 +import org.spongepowered.asm.lib.Type;
  13 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  14 +import org.spongepowered.asm.lib.tree.InsnList;
  15 +import org.spongepowered.asm.lib.tree.InsnNode;
  16 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
19 17  
20 18 /**
21 19 * An injection point which searches for RETURN opcodes in the supplied method
... ... @@ -38,7 +36,7 @@ public class BeforeReturn extends InjectionPoint
38 36 }
39 37  
40 38 @Override
41   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
  39 + public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes)
42 40 {
43 41 boolean found = false;
44 42 int returnOpcode = Type.getReturnType(desc).getOpcode(Opcodes.IRETURN);
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/inject/BeforeStringInvoke.java
... ... @@ -7,11 +7,10 @@ package com.mumfrey.liteloader.transformers.event.inject;
7 7  
8 8 import java.util.Collection;
9 9  
10   -import org.objectweb.asm.tree.AbstractInsnNode;
11   -import org.objectweb.asm.tree.InsnList;
12   -import org.objectweb.asm.tree.LdcInsnNode;
  10 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  11 +import org.spongepowered.asm.lib.tree.InsnList;
  12 +import org.spongepowered.asm.lib.tree.LdcInsnNode;
13 13  
14   -import com.mumfrey.liteloader.transformers.event.Event;
15 14 import com.mumfrey.liteloader.transformers.event.MethodInfo;
16 15 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
17 16  
... ... @@ -49,11 +48,11 @@ public class BeforeStringInvoke extends BeforeInvoke
49 48 }
50 49  
51 50 @Override
52   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
  51 + public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes)
53 52 {
54 53 this.foundLdc = false;
55 54  
56   - return super.find(desc, insns, nodes, event);
  55 + return super.find(desc, insns, nodes);
57 56 }
58 57  
59 58 @Override
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/inject/JumpInsnPoint.java
... ... @@ -8,12 +8,10 @@ package com.mumfrey.liteloader.transformers.event.inject;
8 8 import java.util.Collection;
9 9 import java.util.ListIterator;
10 10  
11   -import org.objectweb.asm.tree.AbstractInsnNode;
12   -import org.objectweb.asm.tree.InsnList;
13   -import org.objectweb.asm.tree.JumpInsnNode;
14   -
15   -import com.mumfrey.liteloader.transformers.event.Event;
16   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  11 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  12 +import org.spongepowered.asm.lib.tree.InsnList;
  13 +import org.spongepowered.asm.lib.tree.JumpInsnNode;
  14 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
17 15  
18 16 /**
19 17 * An injection point which searches for JUMP opcodes (if, try/catch, continue,
... ... @@ -47,7 +45,7 @@ public class JumpInsnPoint extends InjectionPoint
47 45 }
48 46  
49 47 @Override
50   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
  48 + public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes)
51 49 {
52 50 boolean found = false;
53 51 int ordinal = 0;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/inject/MethodHead.java
... ... @@ -7,11 +7,9 @@ package com.mumfrey.liteloader.transformers.event.inject;
7 7  
8 8 import java.util.Collection;
9 9  
10   -import org.objectweb.asm.tree.AbstractInsnNode;
11   -import org.objectweb.asm.tree.InsnList;
12   -
13   -import com.mumfrey.liteloader.transformers.event.Event;
14   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
  10 +import org.spongepowered.asm.lib.tree.AbstractInsnNode;
  11 +import org.spongepowered.asm.lib.tree.InsnList;
  12 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
15 13  
16 14 /**
17 15 * An injection point which locates the first instruction in a method body
... ... @@ -25,7 +23,7 @@ public class MethodHead extends InjectionPoint
25 23 }
26 24  
27 25 @Override
28   - public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes, Event event)
  26 + public boolean find(String desc, InsnList insns, Collection<AbstractInsnNode> nodes)
29 27 {
30 28 nodes.add(insns.getFirst());
31 29 return true;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/json/JsonEvent.java
... ... @@ -9,9 +9,10 @@ import java.io.Serializable;
9 9 import java.util.ArrayList;
10 10 import java.util.List;
11 11  
  12 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
  13 +
12 14 import com.google.gson.annotations.SerializedName;
13 15 import com.mumfrey.liteloader.transformers.event.Event;
14   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
15 16 import com.mumfrey.liteloader.transformers.event.MethodInfo;
16 17  
17 18 /**
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/json/JsonInjection.java
... ... @@ -8,8 +8,9 @@ package com.mumfrey.liteloader.transformers.event.json;
8 8 import java.io.Serializable;
9 9 import java.lang.reflect.Constructor;
10 10  
  11 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
  12 +
11 13 import com.google.gson.annotations.SerializedName;
12   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
13 14 import com.mumfrey.liteloader.transformers.event.MethodInfo;
14 15 import com.mumfrey.liteloader.transformers.event.inject.BeforeInvoke;
15 16 import com.mumfrey.liteloader.transformers.event.inject.BeforeReturn;
... ...
src/main/java/com/mumfrey/liteloader/transformers/event/json/ModEventInjectionTransformer.java
... ... @@ -5,11 +5,12 @@
5 5 */
6 6 package com.mumfrey.liteloader.transformers.event.json;
7 7  
  8 +import org.spongepowered.asm.mixin.injection.InjectionPoint;
  9 +
8 10 import com.mumfrey.liteloader.transformers.ClassTransformer;
9 11 import com.mumfrey.liteloader.transformers.ObfProvider;
10 12 import com.mumfrey.liteloader.transformers.event.Event;
11 13 import com.mumfrey.liteloader.transformers.event.EventInjectionTransformer;
12   -import com.mumfrey.liteloader.transformers.event.InjectionPoint;
13 14 import com.mumfrey.liteloader.transformers.event.MethodInfo;
14 15 import com.mumfrey.liteloader.transformers.event.json.ModEvents.ModEventDefinition;
15 16 import com.mumfrey.liteloader.util.log.LiteLoaderLogger;
... ...