fix/improve name in some cases
All checks were successful
Publish to snapshot maven / build (push) Successful in 15s

This commit is contained in:
moehreag 2024-05-19 00:13:31 +02:00
parent 2a3c244d0c
commit 7005d47d1e

View file

@ -54,13 +54,11 @@ public class ParameterMethodRemapper extends MethodRemapper {
}
newName = nameCopy + ++count;
}
usedLocalNames.add(newName);
System.out.println("new name for: "+descriptor+" "+signature+" "+newName);
return newName;
}
private String convertDescriptor(String descriptor){
private String convertDescriptor(String descriptor) {
return switch (descriptor.charAt(0)) {
case 'I' -> "i";
case 'B' -> "b";
@ -70,7 +68,13 @@ public class ParameterMethodRemapper extends MethodRemapper {
case 'F' -> "f";
case 'J' -> "l";
case 'Z' -> "bl";
case '[' -> Type.getType(descriptor).getElementType().getClassName() + "s";
case '[' -> {
Type type = Type.getType(descriptor).getElementType();
if (type.getSort() == Type.OBJECT) {
yield convertDescriptor(type.getInternalName()) + "s";
}
yield type.getClassName() + "s";
}
default -> {
String name = cleanType(descriptor);
name = Character.toLowerCase(name.charAt(0)) + name.substring(1);
@ -93,7 +97,7 @@ public class ParameterMethodRemapper extends MethodRemapper {
cleaned = cleaned.substring(cleaned.lastIndexOf('$') + 1);
}
cleaned = cleaned.replaceAll("\\[]", "").replace(";", "");
cleaned = cleaned.replaceAll("\\[]", "").replaceAll("(.*)\\d.*", "$1").replace(";", "");
return cleaned;
}