fix: trying to get fqn of primitive

This commit is contained in:
zaaarf 2023-03-27 18:41:48 +02:00
parent a3f4dafff7
commit b2b516b2b1
No known key found for this signature in database
GPG key ID: 82240E075E31FA4C
2 changed files with 5 additions and 3 deletions

View file

@ -39,6 +39,8 @@ public class MethodProxy extends AbstractProxy {
*/
protected MethodProxy(String name, int modifiers, QualifiableProxy parent, Type[] parameters, Type returnType) {
super(name, Type.getMethodDescriptor(returnType, parameters), modifiers, parent, ProxyType.METHOD);
for(Type t : parameters)
System.out.println(t.toString() + t.getSort());
this.parameters = Arrays.stream(parameters)
.map(t -> TypeProxy.from(t, 0))
.toArray(TypeProxy[]::new);

View file

@ -50,15 +50,15 @@ public class TypeProxy extends QualifiableProxy {
* Builds a {@link TypeProxy} from a {@link Type} and modifiers.
* @param type the {@link Type} representing this Class
* @param modifiers the modifiers of the class
* @return the builty {@link TypeProxy}
* @return the built {@link TypeProxy}
*/
public static TypeProxy from(Type type, int modifiers) {
while(type.getSort() == Type.ARRAY)
type = type.getElementType();
String fqn = type.getInternalName().replace('/', '.');
boolean primitive = type.getSort() < Type.ARRAY;
String fqn = primitive ? type.getClassName() : type.getInternalName().replace('/', '.');
String simpleName = extractSimpleNameFromFQN(fqn);
String parent = extractParentFromFQN(fqn);
boolean primitive = type.getSort() < Type.ARRAY;
if(fqn.contains("$"))
return new TypeProxy(simpleName, type.getDescriptor(), modifiers, from(type, Modifier.PUBLIC), primitive);
else return new TypeProxy(simpleName, type.getDescriptor(), modifiers, parent, primitive);