-
-
Notifications
You must be signed in to change notification settings - Fork 31
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Renaming an interface method that has bridges renames one of the bridges #212
Comments
Update: it does not have something to do with the fact a name is proposed. Manually building enigma to strip the call to
Additionally, by removing the proposal, the decompilation of the implementation, |
Update: I decided to poke around in the code, and interestingly, in
|
If I straight up disable bridge indexing, the issue is fixed. (commenting |
Of course it's an entry resolving issue |
pretty much the most classic component to break |
I can see why this problem hasn't occurred yet before: according to a quick script I wrote, the following classes (mapped if name is known for the latest build of QM) have potential bridge methods:
(the strategy for determining these is basically checking whether for some interface there exists a method such that it is not For reference, I used this snippet of code val MethodNode.isPotentialBridge get() =
access and ACC_SYNTHETIC != 0
&& access and ACC_PRIVATE == 0
&& access and ACC_STATIC == 0
&& access and ACC_FINAL == 0
&& instructions.countIsInstance<MethodInsnNode>() == 1
fun main() {
JarInputStream(Path("""/path/to/1.21-hashed.jar""").inputStream()).use { input ->
val itfWithBridge = generateSequence { input.nextJarEntry }
.filter { it.name.endsWith(".class") }
.map { ClassReader(input.readBytes()) }
.filter { it.access and ACC_INTERFACE != 0 }
.filter { reader ->
ClassNode().also { reader.accept(it, ClassReader.SKIP_DEBUG) }.methods.any { it.isPotentialBridge }
}.map { it.className }
val mappingsPath = """/path/to/quilt-mappings-1.21+build.9-mergedv2/mappings/mappings.tiny"""
val mappings = Path(mappingsPath).useLines { TinyMappingsV2Format.parse(it) }
val remapper = SimpleRemapper(mappings.asASMMapping(
from = "hashed",
to = "named",
includeMethods = false,
includeFields = false
))
itfWithBridge.forEach { println(remapper.map(it)) }
}
} |
For example, when mapping QM, I stumbled upon the class
net/minecraft/unmapped/C_bhbelvxt
, which appears to be some sort of collection type that extends the capabilities of aDeque
with some of the methods fromList
. Its first method ism_dnwfaduj
, but of course since I haven't mapped it yet enigma draws it as gray (the proposed name isreversed
, which seems correct). If I then give it a name (either by marking as unmapped or renaming) it has two unexpected behaviours:net/minecraft/unmapped/C_scihbqqa
, an implementation ofC_bhbelvxt
, does not get remapped (which is a consequence of the next behaviour, probably).mapping
file unexpectedly gets an entry ofMETHOD reversed reversed ()Ljava/util/Deque;
, which obviously is wrong since I mapped the methodm_dnwfaduj()Lnet/minecraft/unmapped/C_bhbelvxt;
, notreversed()Ljava/util/Deque;
This might have something to do with the fact a name is proposed.
I tried overwriting the entry in the mapping file as
METHOD m_dnwfaduj reversed ()Lnet/minecraft/unmapped/C_bhbelvxt;
, and it appears that enigma straight up ignores it. Saving the mappings or requesting to drop invalid mappings does not seem to have an effect.The text was updated successfully, but these errors were encountered: