summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
author zaaarf <zaaarf@proton.me>2023-03-26 18:41:38 +0200
committer zaaarf <zaaarf@proton.me>2023-03-26 18:41:38 +0200
commit113d234bbfb4879868bbe04c8088183bc05ae71e (patch)
tree0b9a11e8fcada77b73ae11f031ebdbe2e8e0e9d1 /src
parentf2303ce94374fb40f87eff0063441e09b3abdadd (diff)
chore: added (restored?) setType with fqn and array type
Diffstat (limited to 'src')
-rw-r--r--src/main/java/ftbsc/lll/proxies/impl/FieldProxy.java14
1 files changed, 14 insertions, 0 deletions
diff --git a/src/main/java/ftbsc/lll/proxies/impl/FieldProxy.java b/src/main/java/ftbsc/lll/proxies/impl/FieldProxy.java
index 61952b6..62525bc 100644
--- a/src/main/java/ftbsc/lll/proxies/impl/FieldProxy.java
+++ b/src/main/java/ftbsc/lll/proxies/impl/FieldProxy.java
@@ -7,6 +7,8 @@ import org.objectweb.asm.Type;
import java.lang.reflect.Field;
+import static ftbsc.lll.tools.DescriptorBuilder.nameToDescriptor;
+
/**
* A container for information about class fields to be used
* in ASM patching.
@@ -87,6 +89,7 @@ public class FieldProxy extends AbstractProxy {
}
/**
+ * Sets the type of the field to the given {@link Class} object.
* @param clazz the {@link Class} corresponding to the element
* @return the current state of the builder
*/
@@ -96,6 +99,17 @@ public class FieldProxy extends AbstractProxy {
}
/**
+ * Sets the type of the field to the given type.
+ * @param fqn – the fully qualified name of the parameter type
+ * @param arrayLevel the array level
+ * @return the builder's state after the change
+ */
+ public Builder setType(String fqn, int arrayLevel) {
+ super.setType(Type.getType(nameToDescriptor(fqn, arrayLevel)));
+ return this;
+ }
+
+ /**
* Builds a {@link FieldProxy} of the given kind.
* @return the built {@link FieldProxy}
*/