diff options
author | zaaarf <zaaarf@proton.me> | 2023-03-18 14:03:25 +0100 |
---|---|---|
committer | zaaarf <zaaarf@proton.me> | 2023-03-18 14:03:25 +0100 |
commit | c1cb2184aa1b86dd1624a3b7c98b51f89af587eb (patch) | |
tree | 2fe66afa155c19affa0da760249bb83f5bd69274 /src/main/java/ftbsc/lll/proxies/MethodProxy.java | |
parent | 45ed48b675ea6f0bb43fb2d7d59d0505a6a9e8b6 (diff) |
fix: fixed return type bug0.3.4
Diffstat (limited to 'src/main/java/ftbsc/lll/proxies/MethodProxy.java')
-rw-r--r-- | src/main/java/ftbsc/lll/proxies/MethodProxy.java | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/src/main/java/ftbsc/lll/proxies/MethodProxy.java b/src/main/java/ftbsc/lll/proxies/MethodProxy.java index ff5e1f0..b9abe84 100644 --- a/src/main/java/ftbsc/lll/proxies/MethodProxy.java +++ b/src/main/java/ftbsc/lll/proxies/MethodProxy.java @@ -75,23 +75,30 @@ public class MethodProxy extends AbstractProxy { return this.descriptorCache; DescriptorBuilder b = new DescriptorBuilder(); for(Object p : this.parameters) - addParameterToBuilder(b, p); - addParameterToBuilder(b, this.returnType); + addTypeToDescriptorBuilder(b, p, false); + addTypeToDescriptorBuilder(b, this.returnType, true); this.descriptorCache = b.build(); return this.descriptorCache; } /** - * A static method used internally to correctly insert a + * A static method used internally to detect and correctly insert a * {@link TypeContainer} into a {@link DescriptorBuilder}. * @param b the {@link DescriptorBuilder} * @param p the {@link TypeContainer} + * @param isReturnType whether it should be inserted as a return type */ - private static void addParameterToBuilder(DescriptorBuilder b, Object p) { + private static void addTypeToDescriptorBuilder(DescriptorBuilder b, Object p, boolean isReturnType) { if(p instanceof TypeContainer) { TypeContainer param = (TypeContainer) p; - b.addParameter(param.fqn, param.arrayLevel); - } else b.addParameter((Class<?>) p); + if(isReturnType) + b.setReturnType(param.fqn, param.arrayLevel); + else b.addParameter(param.fqn, param.arrayLevel); + } else { + if(isReturnType) + b.setReturnType((Class<?>) p); + else b.addParameter((Class<?>) p); + } } /** |