From 113d234bbfb4879868bbe04c8088183bc05ae71e Mon Sep 17 00:00:00 2001 From: zaaarf Date: Sun, 26 Mar 2023 18:41:38 +0200 Subject: chore: added (restored?) setType with fqn and array type --- src/main/java/ftbsc/lll/proxies/impl/FieldProxy.java | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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 */ @@ -95,6 +98,17 @@ public class FieldProxy extends AbstractProxy { return this; } + /** + * 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} -- cgit v1.2.3-56-ga3b1