The namespaces in the tiny file should be {@code official, intermediary, named}. + * The SRG names will add a new namespace called {@code srg} so that the final namespaces + * are {@code official, srg, intermediary, named}. + * *
This method does not care about method parameters, local variables or javadoc comments.
* As such, it shouldn't be used for remapping the game jar.
*
@@ -239,7 +346,7 @@ public final class SrgMerger {
* whether an unobfuscated name is needed in the result file
* @param lenient whether lenient mode is enabled
* @throws IOException if an IO error occurs while reading or writing the mappings
- * @throws MappingException if the input tiny tree's default namespace is not 'official'
+ * @throws MappingException if the input tiny mappings' namespaces are incorrect
* or if an element mentioned in the SRG file does not have tiny mappings in non-lenient mode
*/
public static void mergeSrg(Path srg, Path tiny, Path out, @Nullable ExtraMappings extraMappings, boolean lenient)
@@ -276,4 +383,18 @@ public final class SrgMerger {
return new ExtraMappings(path, MappingFormat.TSRG2, MappingsNamespace.OFFICIAL.toString(), MappingsNamespace.NAMED.toString());
}
}
+
+ private record SrgMethodKey(String name, String desc) {
+ @Override
+ public String toString() {
+ return name + desc;
+ }
+ }
+
+ private record MethodData(String obfOwner, String obfName, String obfDesc, boolean hasTiny, String intermediaryName, String namedName) {
+ @Override
+ public String toString() {
+ return "%s.%s%s => %s/%s (%s)".formatted(obfOwner, obfName, obfDesc, intermediaryName, namedName, hasTiny ? "tiny" : "filled");
+ }
+ }
}
diff --git a/src/test/resources/forge/testSrg/expectedOutput.tiny b/src/test/resources/forge/testSrg/expectedOutput.tiny
index a44421aa..6fae24e8 100644
--- a/src/test/resources/forge/testSrg/expectedOutput.tiny
+++ b/src/test/resources/forge/testSrg/expectedOutput.tiny
@@ -2,6 +2,11 @@ tiny 2 0 official srg intermediary named
c a test/FakeClass class_1 test/SomeClass
f I a f_1_ field_1 myInt
m ()I a m_1_ method_1 getMyInt
+ m ()V evilUnobfMethod m_3_ method_2 differentNamedName
c b test/FakeSubclass class_2 test/SomeSubclass
c test/DeObfClass test/DeObfClass test/DeObfClass test/DeObfClass
m ()V iAmNotObfuscated m_2_ iAmNotObfuscated iAmNotObfuscated
+c c test/FormerSiblingA class_3 test/RelatedA
+ m ()V a m_4_ method_3 fromClassA
+c d test/FormerSiblingB class_4 test/RelatedB
+ m ()V a m_4_ method_4 fromClassB
diff --git a/src/test/resources/forge/testSrg/extraInput.tsrg b/src/test/resources/forge/testSrg/extraInput.tsrg
index 4cbffd52..cc395b84 100644
--- a/src/test/resources/forge/testSrg/extraInput.tsrg
+++ b/src/test/resources/forge/testSrg/extraInput.tsrg
@@ -3,8 +3,13 @@ a test/FakeClass