From f2d1394bc425deabe22e845db9e097b63ebd2a2f Mon Sep 17 00:00:00 2001 From: zaaarf Date: Mon, 27 Mar 2023 12:12:43 +0200 Subject: [PATCH] feat: added set-via-descriptor-string for methods and fields --- .../java/ftbsc/lll/proxies/impl/MethodProxy.java | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java b/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java index 3710d36..a1306f7 100644 --- a/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java +++ b/src/main/java/ftbsc/lll/proxies/impl/MethodProxy.java @@ -171,6 +171,19 @@ public class MethodProxy extends AbstractProxy { return this; } + /** + * Sets the type of the method to the given descriptor, + * and extracts return and parameter types from it. + * @param descr the descriptor + * @return the builder's state after the change + */ + public Builder setDescriptor(String descr) { + super.setDescriptor(descr); + this.parameters.addAll(Arrays.asList(Type.getArgumentTypes(descr))); + this.returnType = Type.getReturnType(descr); + return this; + } + /** * Builds a {@link MethodProxy} of the given kind. * @return the built {@link MethodProxy}