summaryrefslogtreecommitdiff
path: root/src/main/java/ftbsc/lll/tools/nodes
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-03-01 22:02:29 +0100
committer zaaarf <zaaarf@proton.me>2023-03-01 22:02:29 +0100
commit9a355f33af77ea22776a943c6d12058cc61cce2a (patch)
tree828cb9c6c4d137231213980a9cde543dd5630a21 /src/main/java/ftbsc/lll/tools/nodes
parent65d732c0790a553d00f15ba54df082bf3171e506 (diff)
feat: replaced put(), get() and call() with InsnNode extensions
Diffstat (limited to 'src/main/java/ftbsc/lll/tools/nodes')
-rw-r--r--src/main/java/ftbsc/lll/tools/nodes/FieldProxyInsnNode.java26
-rw-r--r--src/main/java/ftbsc/lll/tools/nodes/MethodProxyInsnNode.java27
2 files changed, 53 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/lll/tools/nodes/FieldProxyInsnNode.java b/src/main/java/ftbsc/lll/tools/nodes/FieldProxyInsnNode.java
new file mode 100644
index 0000000..34a0d67
--- /dev/null
+++ b/src/main/java/ftbsc/lll/tools/nodes/FieldProxyInsnNode.java
@@ -0,0 +1,26 @@
+package ftbsc.lll.tools.nodes;
+
+import ftbsc.lll.proxies.FieldProxy;
+import org.objectweb.asm.tree.FieldInsnNode;
+
+/**
+ * Overrides the {@link FieldInsnNode} to add a constructor
+ * taking in a {@link FieldProxy}.
+ * @since 0.3.0
+ */
+public class FieldProxyInsnNode extends FieldInsnNode {
+ /**
+ * Constructs a new {@link FieldInsnNode} starting
+ * from a {@link FieldProxy}.
+ * @param opcode the opcode, must be one of GETSTATIC, PUTSTATIC,
+ * GETFIELD or PUTFIELD
+ */
+ public FieldProxyInsnNode(int opcode, FieldProxy proxy) {
+ super(
+ opcode,
+ proxy.getParent().replace('.', '/'),
+ proxy.getSrgName(),
+ proxy.getDescriptor()
+ );
+ }
+} \ No newline at end of file
diff --git a/src/main/java/ftbsc/lll/tools/nodes/MethodProxyInsnNode.java b/src/main/java/ftbsc/lll/tools/nodes/MethodProxyInsnNode.java
new file mode 100644
index 0000000..10c091e
--- /dev/null
+++ b/src/main/java/ftbsc/lll/tools/nodes/MethodProxyInsnNode.java
@@ -0,0 +1,27 @@
+package ftbsc.lll.tools.nodes;
+
+import ftbsc.lll.proxies.MethodProxy;
+import org.objectweb.asm.tree.MethodInsnNode;
+
+/**
+ * Overrides the {@link MethodInsnNode} to add a constructor
+ * taking in a {@link MethodProxy}.
+ * @since 0.3.0
+ */
+public class MethodProxyInsnNode extends MethodInsnNode {
+
+ /**
+ * Constructs a new {@link MethodInsnNode} starting
+ * from a {@link MethodProxy}.
+ * @param opcode the opcode, must be one of INVOKEVIRTUAL,
+ * INVOKESPECIAL, INVOKESTATIC or INVOKEINTERFACE
+ */
+ public MethodProxyInsnNode(MethodProxy m, int opcode) {
+ super(
+ opcode,
+ m.getParent().replace('.', '/'),
+ m.getSrgName(),
+ m.getDescriptor()
+ );
+ }
+} \ No newline at end of file