chore: added (restored?) setType with fqn and array type

This commit is contained in:
zaaarf 2023-03-26 18:41:38 +02:00
parent f2303ce943
commit 113d234bbf
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C

View file

@ -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}