Fix record componenets (#2706)

This commit is contained in:
modmuss50 2021-09-24 13:06:15 +01:00 committed by GitHub
parent c90f6ad44b
commit 477e4a0dee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 19 additions and 1 deletions

View File

@ -119,7 +119,8 @@ import net.fabricmc.tinyremapper.OutputConsumerPath
import net.fabricmc.tinyremapper.TinyRemapper
import net.fabricmc.tinyremapper.TinyUtils
import org.apache.commons.io.FileUtils
import org.objectweb.asm.ClassVisitor;
import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.FieldVisitor
import org.objectweb.asm.Opcodes;
import java.nio.charset.StandardCharsets
@ -396,6 +397,23 @@ task mapIntermediaryJar(dependsOn: [downloadMcLibs, downloadIntermediary, mergeJ
}
}
}
remapperBuilder.extraPostApplyVisitor { cls, next ->
if (!cls.record && cls.superName == "java/lang/Record") {
return new ClassVisitor(Opcodes.ASM9, next) {
@Override
FieldVisitor visitField(int access, String name, String descriptor, String signature, Object value) {
if (name.startsWith("comp_")) {
super.visitRecordComponent(name, descriptor, signature);
}
return super.visitField(access, name, descriptor, signature, value);
}
}
}
return next
}
}
}
}