fix more remapping bugs
All checks were successful
Publish to snapshot maven / build (push) Successful in 19s

This commit is contained in:
moehreag 2024-07-08 16:42:28 +02:00
parent 69b62e7d0e
commit 2d524c0eea
4 changed files with 15 additions and 12 deletions

View file

@ -8,7 +8,7 @@ plugins {
} }
group = "dev.frogmc" group = "dev.frogmc"
version = "0.0.1-alpha.8" version = "0.0.1-alpha.9"
repositories { repositories {
mavenCentral() mavenCentral()

View file

@ -73,8 +73,9 @@ public class Thyroxine {
List<Callable<Void>> tasks = new ArrayList<>(); List<Callable<Void>> tasks = new ArrayList<>();
Map<String, List<String>> lazyParents = new ConcurrentHashMap<>(); Map<String, List<String>> lazyParents = new ConcurrentHashMap<>();
MappingData reverseData = data.reverse();
Mapper mapper = new Mapper(data, className -> lazyParents.computeIfAbsent(className, ignored -> Mapper mapper = new Mapper(data, className -> lazyParents.computeIfAbsent(className, ignored ->
Thyroxine.computeInheritances(className, inFs))); computeInheritances(className, inFs, reverseData)));
Files.walkFileTree(inFs.getPath("/"), new SimpleFileVisitor<>() { Files.walkFileTree(inFs.getPath("/"), new SimpleFileVisitor<>() {
@ -156,8 +157,11 @@ public class Thyroxine {
return false; return false;
} }
private static List<String> computeInheritances(String className, FileSystem inFs) { private static List<String> computeInheritances(String className, FileSystem inFs, MappingData reverse) {
try { try {
if (reverse.classes().containsKey(className)) {
className = reverse.classes().get(className);
}
Path path = inFs.getPath("/" + className + ".class"); Path path = inFs.getPath("/" + className + ".class");
if (!Files.isRegularFile(path)) if (!Files.isRegularFile(path))
return List.of(); return List.of();
@ -168,8 +172,12 @@ public class Thyroxine {
reader.accept(new ClassVisitor(Constants.ASM_VERSION) { reader.accept(new ClassVisitor(Constants.ASM_VERSION) {
@Override @Override
public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) { public void visit(int version, int access, String name, String signature, String superName, String[] interfaces) {
superTypes.add(superName); if (interfaces != null) {
superTypes.addAll(Arrays.asList(interfaces)); superTypes.addAll(Arrays.asList(interfaces));
}
if (!"java/lang/Object".equals(superName)) {
superTypes.add(superName);
}
} }
}, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES); }, ClassReader.SKIP_CODE | ClassReader.SKIP_DEBUG | ClassReader.SKIP_FRAMES);

View file

@ -60,9 +60,4 @@ public class Mapper extends Remapper {
return null; return null;
} }
@Override
public String mapMethodDesc(String methodDescriptor) {
return super.mapMethodDesc(methodDescriptor);
}
} }

View file

@ -43,9 +43,9 @@ public class TinyV2Parser {
if ("c".equals(line[0])) { if ("c".equals(line[0])) {
if (1+ns >= line.length) { if (1+ns >= line.length) {
do { while (lines[i + 1].startsWith("\t")) {
i++; i++;
} while (lines[i].startsWith("\t")); }
continue; continue;
} }
currentClass = line[ns]; currentClass = line[ns];