fix class names being unmapped
All checks were successful
Publish to snapshot maven / build (push) Successful in 15s

This commit is contained in:
moehreag 2024-05-17 19:59:58 +02:00
parent ebb333bd02
commit c89e190c0b
2 changed files with 3 additions and 6 deletions

View file

@ -21,7 +21,7 @@ public class ParameterClassRemapper extends ClassRemapper {
MethodVisitor methodVisitor = cv.visitMethod(access, remapper.mapMethodName(className, name, descriptor), remappedDescriptor, MethodVisitor methodVisitor = cv.visitMethod(access, remapper.mapMethodName(className, name, descriptor), remappedDescriptor,
remapper.mapSignature(signature, false), exceptions == null ? null : remapper.mapTypes(exceptions)); remapper.mapSignature(signature, false), exceptions == null ? null : remapper.mapTypes(exceptions));
Parchment.Method method = parchment.getClass(className).flatMap(c -> c.getMethod(remapper.mapMethodName(className, name, descriptor), remapper.mapMethodDesc(descriptor))) Parchment.Method method = parchment.getClass(remapper.map(className)).flatMap(c -> c.getMethod(remapper.mapMethodName(className, name, descriptor), remapper.mapMethodDesc(descriptor)))
.orElse(null); .orElse(null);
return methodVisitor == null ? null : new ParameterMethodRemapper(methodVisitor, remapper, method); return methodVisitor == null ? null : new ParameterMethodRemapper(methodVisitor, remapper, method);

View file

@ -27,7 +27,6 @@ public class ParameterMethodRemapper extends MethodRemapper {
} else { } else {
name = getNewName(descriptor, signature); name = getNewName(descriptor, signature);
} }
} }
super.visitLocalVariable(name, descriptor, signature, start, end, index); super.visitLocalVariable(name, descriptor, signature, start, end, index);
} }
@ -50,6 +49,7 @@ public class ParameterMethodRemapper extends MethodRemapper {
}; };
int count = 1; int count = 1;
String nameCopy = newName;
while (usedLocalNames.contains(newName)) { while (usedLocalNames.contains(newName)) {
if (signature != null) { if (signature != null) {
String type = cleanType(signature); String type = cleanType(signature);
@ -59,10 +59,7 @@ public class ParameterMethodRemapper extends MethodRemapper {
continue; continue;
} }
} }
if (Integer.toString(count).equals(newName.substring(newName.length() - 1))) { newName = nameCopy + ++count;
newName = newName.substring(0, newName.length() - 1);
}
newName = newName + ++count;
} }
usedLocalNames.add(newName); usedLocalNames.add(newName);