allow renaming parameters even without parchment
All checks were successful
Publish to snapshot maven / build (push) Successful in 20s
All checks were successful
Publish to snapshot maven / build (push) Successful in 20s
This commit is contained in:
parent
ba6c5ea32c
commit
5eaeaba14f
|
@ -8,7 +8,7 @@ plugins {
|
||||||
}
|
}
|
||||||
|
|
||||||
group = "dev.frogmc"
|
group = "dev.frogmc"
|
||||||
version = "0.0.1-alpha.2"
|
version = "0.0.1-alpha.3"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -29,7 +29,8 @@ tasks.jar {
|
||||||
manifest {
|
manifest {
|
||||||
attributes("Implementation-Version" to version,
|
attributes("Implementation-Version" to version,
|
||||||
"Implementation-Name" to project.name,
|
"Implementation-Name" to project.name,
|
||||||
"Implementation-Date" to Date())
|
"Implementation-Date" to Date(),
|
||||||
|
"Main-Class" to "dev.frogmc.thyroxine.Thyroxine")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -75,14 +75,7 @@ public class Thyroxine {
|
||||||
ClassReader reader = new ClassReader(bytes);
|
ClassReader reader = new ClassReader(bytes);
|
||||||
ClassWriter writer = new ClassWriter(0);
|
ClassWriter writer = new ClassWriter(0);
|
||||||
ClassVisitor remapper = new ClassRemapper(writer, mapper);
|
ClassVisitor remapper = new ClassRemapper(writer, mapper);
|
||||||
|
reader.accept(new ParameterClassRemapper(remapper, mapper, paramMappings), 0);
|
||||||
ClassVisitor visitor;
|
|
||||||
if (paramMappings != null) {
|
|
||||||
visitor = new ParameterClassRemapper(remapper, mapper, paramMappings);
|
|
||||||
} else {
|
|
||||||
visitor = remapper;
|
|
||||||
}
|
|
||||||
reader.accept(visitor, 0);
|
|
||||||
|
|
||||||
byte[] output = writer.toByteArray();
|
byte[] output = writer.toByteArray();
|
||||||
Files.createDirectories(result.getParent());
|
Files.createDirectories(result.getParent());
|
||||||
|
@ -106,7 +99,7 @@ public class Thyroxine {
|
||||||
|
|
||||||
exec.invokeAll(tasks);
|
exec.invokeAll(tasks);
|
||||||
|
|
||||||
System.out.printf("Finished remapping (%.2fs)\n", (System.currentTimeMillis() - startTime) / 1000F);
|
System.out.printf("Finished remapping (%.2fs)%n", (System.currentTimeMillis() - startTime) / 1000F);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -21,8 +21,8 @@ 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(remapper.map(className)).flatMap(c -> c.getMethod(remapper.mapMethodName(className, name, descriptor), remapper.mapMethodDesc(descriptor)))
|
Parchment.Method method = parchment != null ? parchment.getClass(remapper.map(className)).flatMap(c -> c.getMethod(remapper.mapMethodName(className, name, descriptor), remapper.mapMethodDesc(descriptor)))
|
||||||
.orElse(null);
|
.orElse(null) : null;
|
||||||
return methodVisitor == null ? null : new ParameterMethodRemapper(methodVisitor, remapper, method);
|
return methodVisitor == null ? null : new ParameterMethodRemapper(methodVisitor, remapper, method);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue