mirror of
https://github.com/zaaarf/lillero.git
synced 2024-11-12 18:49:23 +01:00
fix: fixed return type bug
This commit is contained in:
parent
45ed48b675
commit
c1cb2184aa
2 changed files with 16 additions and 7 deletions
|
@ -1,5 +1,7 @@
|
|||
package ftbsc.lll.proxies;
|
||||
|
||||
import java.lang.reflect.Modifier;
|
||||
|
||||
/**
|
||||
* Abstract proxy class, implementing common aspects
|
||||
* of {@link MethodProxy} and {@link FieldProxy}.
|
||||
|
@ -33,7 +35,7 @@ public abstract class AbstractProxy {
|
|||
|
||||
/**
|
||||
* @return the modifiers of the member, as a packed int
|
||||
* @see java.lang.reflect.Modifier
|
||||
* @see Modifier
|
||||
*/
|
||||
public int getModifiers() {
|
||||
return this.modifiers;
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue