Skip to content

Commit abf04dc

Browse files
committed
remove equivalent entries in MappingValidator
1 parent 1fc1e7f commit abf04dc

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

enigma/src/main/java/org/quiltmc/enigma/api/translation/mapping/EntryRemapper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private EntryRemapper(JarIndex jarIndex, MappingsIndex mappingsIndex, EntryTree<
5656
this.jarIndex = jarIndex;
5757
this.mappingsIndex = mappingsIndex;
5858

59-
this.validator = new MappingValidator(this.deobfuscator, jarIndex, mappingsIndex);
59+
this.validator = new MappingValidator(this.obfResolver, this.deobfuscator, jarIndex, mappingsIndex);
6060
this.proposalServices = proposalServices;
6161
}
6262

enigma/src/main/java/org/quiltmc/enigma/api/translation/mapping/MappingValidator.java

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,13 @@
2626
import java.util.stream.Collectors;
2727

2828
public class MappingValidator {
29+
private final EntryResolver resolver;
2930
private final Translator deobfuscator;
3031
private final JarIndex jarIndex;
3132
private final MappingsIndex mappingsIndex;
3233

33-
public MappingValidator(Translator deobfuscator, JarIndex jarIndex, MappingsIndex mappingsIndex) {
34+
public MappingValidator(EntryResolver resolver, Translator deobfuscator, JarIndex jarIndex, MappingsIndex mappingsIndex) {
35+
this.resolver = resolver;
3436
this.deobfuscator = deobfuscator;
3537
this.jarIndex = jarIndex;
3638
this.mappingsIndex = mappingsIndex;
@@ -92,6 +94,10 @@ private boolean validateUnique(ValidationContext context, Entry<?> entry, String
9294
siblings.addAll(this.jarIndex.getChildrenByClass().get(ancestor));
9395
}
9496

97+
// remove equivalent entries -- this can sometimes happen and break mark as deobf/obf
98+
// noinspection all
99+
siblings.removeAll(this.resolver.resolveEquivalentEntries(entry));
100+
95101
// collect deobfuscated versions
96102
Map<Entry<?>, Entry<?>> deobfSiblings = siblings.stream()
97103
.distinct() // May throw IllegalStateException otherwise

0 commit comments

Comments
 (0)