Always output class names in generated mappings, even if not renamed

Although SpecialSource avoids generating unnecessary output where
methods/fields are not renamed, the _absence_ of a class rename is
arguably as important as a class rename, especially when comparing
jars where nearly all classes are renamed.

In the common case of generating Minecraft mappings from an obfuscated
jar and an internally-renamed deobfuscated mc-dev jar, all classes
are renamed, except for one -- the main class:

net/minecraft/server/MinecraftServer net/minecraft/server/MinecraftServer

When the mc-dev server jar is shaded into CraftBukkit, all classes are
relocated under a versioned package. However, the shading relocation
simulator misses MinecraftServer since it is not included in the mappings,
as it isn't renamed.

Always outputting class names, regardless of whether they are renamed,
only increases the mapping file by one line and removes the need to
special-case MinecraftServer.
This commit is contained in:
Agaricus 2013-01-25 21:48:00 -08:00
parent ba63cd9803
commit 41fefc0167

View File

@ -120,9 +120,7 @@ public class JarMapping {
String oldClass = oldJar.classes.get(i); String oldClass = oldJar.classes.get(i);
String newClass = newJar.classes.get(i); String newClass = newJar.classes.get(i);
classes.put(oldClass, newClass); classes.put(oldClass, newClass);
if (!Objects.equals(oldClass, newClass)) { srgWriter.addClassMap(oldClass, newClass);
srgWriter.addClassMap(oldClass, newClass);
}
} }
for (int i = 0; i < oldJar.fields.size(); i++) { for (int i = 0; i < oldJar.fields.size(); i++) {
Ownable oldField = oldJar.fields.get(i); Ownable oldField = oldJar.fields.get(i);