From b4aaff683d78ab92b83f3a7257c33b8e27d1affa Mon Sep 17 00:00:00 2001 From: Thog Date: Tue, 7 Mar 2017 21:24:39 +0100 Subject: Drop unix case style and implement hashCode when equals is overrided Also update Guava to version 21 --- .../java/cuchaz/enigma/convert/ClassIdentity.java | 19 +++-- .../java/cuchaz/enigma/convert/ClassMatches.java | 88 +++++++++++----------- .../java/cuchaz/enigma/convert/ClassMatching.java | 36 ++++----- .../java/cuchaz/enigma/convert/FieldMatches.java | 68 ++++++++--------- .../cuchaz/enigma/convert/MappingsConverter.java | 53 ++++++------- .../java/cuchaz/enigma/convert/MatchesReader.java | 5 +- .../java/cuchaz/enigma/convert/MemberMatches.java | 70 ++++++++--------- 7 files changed, 164 insertions(+), 175 deletions(-) (limited to 'src/main/java/cuchaz/enigma/convert') diff --git a/src/main/java/cuchaz/enigma/convert/ClassIdentity.java b/src/main/java/cuchaz/enigma/convert/ClassIdentity.java index 7360011..f72bf70 100644 --- a/src/main/java/cuchaz/enigma/convert/ClassIdentity.java +++ b/src/main/java/cuchaz/enigma/convert/ClassIdentity.java @@ -20,7 +20,6 @@ import java.util.List; import java.util.Map; import java.util.Set; -import cuchaz.enigma.Constants; import cuchaz.enigma.analysis.ClassImplementationsTreeNode; import cuchaz.enigma.analysis.EntryReference; import cuchaz.enigma.analysis.JarIndex; @@ -49,9 +48,9 @@ public class ClassIdentity { private Multiset references; private String outer; - private final ClassNameReplacer m_classNameReplacer = new ClassNameReplacer() { + private final ClassNameReplacer classNameReplacer = new ClassNameReplacer() { - private Map m_classNames = Maps.newHashMap(); + private Map classNames = Maps.newHashMap(); @Override public String replace(String className) { @@ -76,14 +75,14 @@ public class ClassIdentity { } // otherwise, use local naming - if (!m_classNames.containsKey(className)) { - m_classNames.put(className, getNewClassName()); + if (!classNames.containsKey(className)) { + classNames.put(className, getNewClassName()); } - return m_classNames.get(className); + return classNames.get(className); } private String getNewClassName() { - return String.format("C%03d", m_classNames.size()); + return String.format("C%03d", classNames.size()); } }; @@ -229,7 +228,7 @@ public class ClassIdentity { } private String scrubClassName(String className) { - return m_classNameReplacer.replace(className); + return classNameReplacer.replace(className); } private String scrubType(String typeName) { @@ -238,7 +237,7 @@ public class ClassIdentity { private Type scrubType(Type type) { if (type.hasClass()) { - return new Type(type, m_classNameReplacer); + return new Type(type, classNameReplacer); } else { return type; } @@ -249,7 +248,7 @@ public class ClassIdentity { } private Signature scrubSignature(Signature signature) { - return new Signature(signature, m_classNameReplacer); + return new Signature(signature, classNameReplacer); } private boolean isClassMatchedUniquely(String className) { diff --git a/src/main/java/cuchaz/enigma/convert/ClassMatches.java b/src/main/java/cuchaz/enigma/convert/ClassMatches.java index 3a25435..431c4f2 100644 --- a/src/main/java/cuchaz/enigma/convert/ClassMatches.java +++ b/src/main/java/cuchaz/enigma/convert/ClassMatches.java @@ -22,28 +22,28 @@ import cuchaz.enigma.mapping.ClassEntry; public class ClassMatches implements Iterable { - Collection m_matches; - Map m_matchesBySource; - Map m_matchesByDest; - BiMap m_uniqueMatches; - Map m_ambiguousMatchesBySource; - Map m_ambiguousMatchesByDest; - Set m_unmatchedSourceClasses; - Set m_unmatchedDestClasses; + private Collection matches; + private Map matchesBySource; + private Map matchesByDest; + private BiMap uniqueMatches; + private Map ambiguousMatchesBySource; + private Map ambiguousMatchesByDest; + private Set unmatchedSourceClasses; + private Set unmatchedDestClasses; public ClassMatches() { this(new ArrayList<>()); } public ClassMatches(Collection matches) { - m_matches = matches; - m_matchesBySource = Maps.newHashMap(); - m_matchesByDest = Maps.newHashMap(); - m_uniqueMatches = HashBiMap.create(); - m_ambiguousMatchesBySource = Maps.newHashMap(); - m_ambiguousMatchesByDest = Maps.newHashMap(); - m_unmatchedSourceClasses = Sets.newHashSet(); - m_unmatchedDestClasses = Sets.newHashSet(); + this.matches = matches; + matchesBySource = Maps.newHashMap(); + matchesByDest = Maps.newHashMap(); + uniqueMatches = HashBiMap.create(); + ambiguousMatchesBySource = Maps.newHashMap(); + ambiguousMatchesByDest = Maps.newHashMap(); + unmatchedSourceClasses = Sets.newHashSet(); + unmatchedDestClasses = Sets.newHashSet(); for (ClassMatch match : matches) { indexMatch(match); @@ -51,92 +51,92 @@ public class ClassMatches implements Iterable { } public void add(ClassMatch match) { - m_matches.add(match); + matches.add(match); indexMatch(match); } public void remove(ClassMatch match) { for (ClassEntry sourceClass : match.sourceClasses) { - m_matchesBySource.remove(sourceClass); - m_uniqueMatches.remove(sourceClass); - m_ambiguousMatchesBySource.remove(sourceClass); - m_unmatchedSourceClasses.remove(sourceClass); + matchesBySource.remove(sourceClass); + uniqueMatches.remove(sourceClass); + ambiguousMatchesBySource.remove(sourceClass); + unmatchedSourceClasses.remove(sourceClass); } for (ClassEntry destClass : match.destClasses) { - m_matchesByDest.remove(destClass); - m_uniqueMatches.inverse().remove(destClass); - m_ambiguousMatchesByDest.remove(destClass); - m_unmatchedDestClasses.remove(destClass); + matchesByDest.remove(destClass); + uniqueMatches.inverse().remove(destClass); + ambiguousMatchesByDest.remove(destClass); + unmatchedDestClasses.remove(destClass); } - m_matches.remove(match); + matches.remove(match); } public int size() { - return m_matches.size(); + return matches.size(); } @Override public Iterator iterator() { - return m_matches.iterator(); + return matches.iterator(); } private void indexMatch(ClassMatch match) { if (!match.isMatched()) { // unmatched - m_unmatchedSourceClasses.addAll(match.sourceClasses); - m_unmatchedDestClasses.addAll(match.destClasses); + unmatchedSourceClasses.addAll(match.sourceClasses); + unmatchedDestClasses.addAll(match.destClasses); } else { if (match.isAmbiguous()) { // ambiguously matched for (ClassEntry entry : match.sourceClasses) { - m_ambiguousMatchesBySource.put(entry, match); + ambiguousMatchesBySource.put(entry, match); } for (ClassEntry entry : match.destClasses) { - m_ambiguousMatchesByDest.put(entry, match); + ambiguousMatchesByDest.put(entry, match); } } else { // uniquely matched - m_uniqueMatches.put(match.getUniqueSource(), match.getUniqueDest()); + uniqueMatches.put(match.getUniqueSource(), match.getUniqueDest()); } } for (ClassEntry entry : match.sourceClasses) { - m_matchesBySource.put(entry, match); + matchesBySource.put(entry, match); } for (ClassEntry entry : match.destClasses) { - m_matchesByDest.put(entry, match); + matchesByDest.put(entry, match); } } public BiMap getUniqueMatches() { - return m_uniqueMatches; + return uniqueMatches; } public Set getUnmatchedSourceClasses() { - return m_unmatchedSourceClasses; + return unmatchedSourceClasses; } public Set getUnmatchedDestClasses() { - return m_unmatchedDestClasses; + return unmatchedDestClasses; } public Set getAmbiguouslyMatchedSourceClasses() { - return m_ambiguousMatchesBySource.keySet(); + return ambiguousMatchesBySource.keySet(); } public ClassMatch getAmbiguousMatchBySource(ClassEntry sourceClass) { - return m_ambiguousMatchesBySource.get(sourceClass); + return ambiguousMatchesBySource.get(sourceClass); } public ClassMatch getMatchBySource(ClassEntry sourceClass) { - return m_matchesBySource.get(sourceClass); + return matchesBySource.get(sourceClass); } public ClassMatch getMatchByDest(ClassEntry destClass) { - return m_matchesByDest.get(destClass); + return matchesByDest.get(destClass); } public void removeSource(ClassEntry sourceClass) { - ClassMatch match = m_matchesBySource.get(sourceClass); + ClassMatch match = matchesBySource.get(sourceClass); if (match != null) { remove(match); match.sourceClasses.remove(sourceClass); @@ -147,7 +147,7 @@ public class ClassMatches implements Iterable { } public void removeDest(ClassEntry destClass) { - ClassMatch match = m_matchesByDest.get(destClass); + ClassMatch match = matchesByDest.get(destClass); if (match != null) { remove(match); match.destClasses.remove(destClass); diff --git a/src/main/java/cuchaz/enigma/convert/ClassMatching.java b/src/main/java/cuchaz/enigma/convert/ClassMatching.java index af9ae01..b05df87 100644 --- a/src/main/java/cuchaz/enigma/convert/ClassMatching.java +++ b/src/main/java/cuchaz/enigma/convert/ClassMatching.java @@ -25,52 +25,52 @@ import cuchaz.enigma.mapping.ClassEntry; public class ClassMatching { - private ClassForest m_sourceClasses; - private ClassForest m_destClasses; - private BiMap m_knownMatches; + private ClassForest sourceClasses; + private ClassForest destClasses; + private BiMap knownMatches; public ClassMatching(ClassIdentifier sourceIdentifier, ClassIdentifier destIdentifier) { - m_sourceClasses = new ClassForest(sourceIdentifier); - m_destClasses = new ClassForest(destIdentifier); - m_knownMatches = HashBiMap.create(); + sourceClasses = new ClassForest(sourceIdentifier); + destClasses = new ClassForest(destIdentifier); + knownMatches = HashBiMap.create(); } public void addKnownMatches(BiMap knownMatches) { - m_knownMatches.putAll(knownMatches); + this.knownMatches.putAll(knownMatches); } public void match(Iterable sourceClasses, Iterable destClasses) { for (ClassEntry sourceClass : sourceClasses) { - if (!m_knownMatches.containsKey(sourceClass)) { - m_sourceClasses.add(sourceClass); + if (!knownMatches.containsKey(sourceClass)) { + this.sourceClasses.add(sourceClass); } } for (ClassEntry destClass : destClasses) { - if (!m_knownMatches.containsValue(destClass)) { - m_destClasses.add(destClass); + if (!knownMatches.containsValue(destClass)) { + this.destClasses.add(destClass); } } } public Collection matches() { List matches = Lists.newArrayList(); - for (Entry entry : m_knownMatches.entrySet()) { + for (Entry entry : knownMatches.entrySet()) { matches.add(new ClassMatch( entry.getKey(), entry.getValue() )); } - for (ClassIdentity identity : m_sourceClasses.identities()) { + for (ClassIdentity identity : sourceClasses.identities()) { matches.add(new ClassMatch( - m_sourceClasses.getClasses(identity), - m_destClasses.getClasses(identity) + sourceClasses.getClasses(identity), + destClasses.getClasses(identity) )); } - for (ClassIdentity identity : m_destClasses.identities()) { - if (!m_sourceClasses.containsIdentity(identity)) { + for (ClassIdentity identity : destClasses.identities()) { + if (!sourceClasses.containsIdentity(identity)) { matches.add(new ClassMatch( new ArrayList<>(), - m_destClasses.getClasses(identity) + destClasses.getClasses(identity) )); } } diff --git a/src/main/java/cuchaz/enigma/convert/FieldMatches.java b/src/main/java/cuchaz/enigma/convert/FieldMatches.java index 0899cd2..236cd4d 100644 --- a/src/main/java/cuchaz/enigma/convert/FieldMatches.java +++ b/src/main/java/cuchaz/enigma/convert/FieldMatches.java @@ -21,29 +21,29 @@ import cuchaz.enigma.mapping.FieldEntry; public class FieldMatches { - private BiMap m_matches; - private Multimap m_matchedSourceFields; - private Multimap m_unmatchedSourceFields; - private Multimap m_unmatchedDestFields; - private Multimap m_unmatchableSourceFields; + private BiMap matches; + private Multimap matchedSourceFields; + private Multimap unmatchedSourceFields; + private Multimap unmatchedDestFields; + private Multimap unmatchableSourceFields; public FieldMatches() { - m_matches = HashBiMap.create(); - m_matchedSourceFields = HashMultimap.create(); - m_unmatchedSourceFields = HashMultimap.create(); - m_unmatchedDestFields = HashMultimap.create(); - m_unmatchableSourceFields = HashMultimap.create(); + matches = HashBiMap.create(); + matchedSourceFields = HashMultimap.create(); + unmatchedSourceFields = HashMultimap.create(); + unmatchedDestFields = HashMultimap.create(); + unmatchableSourceFields = HashMultimap.create(); } public void addMatch(FieldEntry srcField, FieldEntry destField) { - boolean wasAdded = m_matches.put(srcField, destField) == null; + boolean wasAdded = matches.put(srcField, destField) == null; assert (wasAdded); - wasAdded = m_matchedSourceFields.put(srcField.getClassEntry(), srcField); + wasAdded = matchedSourceFields.put(srcField.getClassEntry(), srcField); assert (wasAdded); } public void addUnmatchedSourceField(FieldEntry fieldEntry) { - boolean wasAdded = m_unmatchedSourceFields.put(fieldEntry.getClassEntry(), fieldEntry); + boolean wasAdded = unmatchedSourceFields.put(fieldEntry.getClassEntry(), fieldEntry); assert (wasAdded); } @@ -54,7 +54,7 @@ public class FieldMatches { } public void addUnmatchedDestField(FieldEntry fieldEntry) { - boolean wasAdded = m_unmatchedDestFields.put(fieldEntry.getClassEntry(), fieldEntry); + boolean wasAdded = unmatchedDestFields.put(fieldEntry.getClassEntry(), fieldEntry); assert (wasAdded); } @@ -65,78 +65,78 @@ public class FieldMatches { } public void addUnmatchableSourceField(FieldEntry sourceField) { - boolean wasAdded = m_unmatchableSourceFields.put(sourceField.getClassEntry(), sourceField); + boolean wasAdded = unmatchableSourceFields.put(sourceField.getClassEntry(), sourceField); assert (wasAdded); } public Set getSourceClassesWithUnmatchedFields() { - return m_unmatchedSourceFields.keySet(); + return unmatchedSourceFields.keySet(); } public Collection getSourceClassesWithoutUnmatchedFields() { Set out = Sets.newHashSet(); - out.addAll(m_matchedSourceFields.keySet()); - out.removeAll(m_unmatchedSourceFields.keySet()); + out.addAll(matchedSourceFields.keySet()); + out.removeAll(unmatchedSourceFields.keySet()); return out; } public Collection getUnmatchedSourceFields() { - return m_unmatchedSourceFields.values(); + return unmatchedSourceFields.values(); } public Collection getUnmatchedSourceFields(ClassEntry sourceClass) { - return m_unmatchedSourceFields.get(sourceClass); + return unmatchedSourceFields.get(sourceClass); } public Collection getUnmatchedDestFields() { - return m_unmatchedDestFields.values(); + return unmatchedDestFields.values(); } public Collection getUnmatchedDestFields(ClassEntry destClass) { - return m_unmatchedDestFields.get(destClass); + return unmatchedDestFields.get(destClass); } public Collection getUnmatchableSourceFields() { - return m_unmatchableSourceFields.values(); + return unmatchableSourceFields.values(); } public boolean hasSource(FieldEntry fieldEntry) { - return m_matches.containsKey(fieldEntry) || m_unmatchedSourceFields.containsValue(fieldEntry); + return matches.containsKey(fieldEntry) || unmatchedSourceFields.containsValue(fieldEntry); } public boolean hasDest(FieldEntry fieldEntry) { - return m_matches.containsValue(fieldEntry) || m_unmatchedDestFields.containsValue(fieldEntry); + return matches.containsValue(fieldEntry) || unmatchedDestFields.containsValue(fieldEntry); } public BiMap matches() { - return m_matches; + return matches; } public boolean isMatchedSourceField(FieldEntry sourceField) { - return m_matches.containsKey(sourceField); + return matches.containsKey(sourceField); } public boolean isMatchedDestField(FieldEntry destField) { - return m_matches.containsValue(destField); + return matches.containsValue(destField); } public void makeMatch(FieldEntry sourceField, FieldEntry destField) { - boolean wasRemoved = m_unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField); + boolean wasRemoved = unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField); assert (wasRemoved); - wasRemoved = m_unmatchedDestFields.remove(destField.getClassEntry(), destField); + wasRemoved = unmatchedDestFields.remove(destField.getClassEntry(), destField); assert (wasRemoved); addMatch(sourceField, destField); } public boolean isMatched(FieldEntry sourceField, FieldEntry destField) { - FieldEntry match = m_matches.get(sourceField); + FieldEntry match = matches.get(sourceField); return match != null && match.equals(destField); } public void unmakeMatch(FieldEntry sourceField, FieldEntry destField) { - boolean wasRemoved = m_matches.remove(sourceField) != null; + boolean wasRemoved = matches.remove(sourceField) != null; assert (wasRemoved); - wasRemoved = m_matchedSourceFields.remove(sourceField.getClassEntry(), sourceField); + wasRemoved = matchedSourceFields.remove(sourceField.getClassEntry(), sourceField); assert (wasRemoved); addUnmatchedSourceField(sourceField); addUnmatchedDestField(destField); @@ -144,7 +144,7 @@ public class FieldMatches { public void makeSourceUnmatchable(FieldEntry sourceField) { assert (!isMatchedSourceField(sourceField)); - boolean wasRemoved = m_unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField); + boolean wasRemoved = unmatchedSourceFields.remove(sourceField.getClassEntry(), sourceField); assert (wasRemoved); addUnmatchableSourceField(sourceField); } diff --git a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java index 929c89f..a5ded67 100644 --- a/src/main/java/cuchaz/enigma/convert/MappingsConverter.java +++ b/src/main/java/cuchaz/enigma/convert/MappingsConverter.java @@ -11,7 +11,6 @@ package cuchaz.enigma.convert; import com.google.common.collect.*; -import cuchaz.enigma.Constants; import cuchaz.enigma.Deobfuscator; import cuchaz.enigma.TranslatingTypeLoader; import cuchaz.enigma.analysis.JarIndex; @@ -24,7 +23,6 @@ import javassist.NotFoundException; import javassist.bytecode.BadBytecode; import javassist.bytecode.CodeAttribute; import javassist.bytecode.CodeIterator; -import javassist.bytecode.MethodInfo; import java.util.*; import java.util.jar.JarFile; @@ -174,15 +172,13 @@ public class MappingsConverter { private static ClassMapping migrateClassMapping(ClassEntry newObfClass, ClassMapping oldClassMapping, final ClassMatches matches, boolean useSimpleName) { - ClassNameReplacer replacer = new ClassNameReplacer() { - @Override - public String replace(String className) { - ClassEntry newClassEntry = matches.getUniqueMatches().get(new ClassEntry(className)); - if (newClassEntry != null) { - return newClassEntry.getName(); - } - return null; + ClassNameReplacer replacer = className -> + { + ClassEntry newClassEntry = matches.getUniqueMatches().get(new ClassEntry(className)); + if (newClassEntry != null) { + return newClassEntry.getName(); } + return null; }; ClassMapping newClassMapping; @@ -434,13 +430,12 @@ public class MappingsConverter { // Empty method body, ignore! if (sourceAttribute == null) return null; - Iterator it = obfDestEntries.iterator(); - while (it.hasNext()) + for (BehaviorEntry desEntry : obfDestEntries) { - BehaviorEntry desEntry = it.next(); try { - CtMethod destCtClassMethod = destCtClass.getMethod(desEntry.getName(), desEntry.getSignature().toString()); + CtMethod destCtClassMethod = destCtClass + .getMethod(desEntry.getName(), desEntry.getSignature().toString()); CodeAttribute destAttribute = destCtClassMethod.getMethodInfo().getCodeAttribute(); // Ignore empty body methods @@ -533,7 +528,7 @@ public class MappingsConverter { public static MemberMatches computeMemberMatches(Deobfuscator destDeobfuscator, Mappings destMappings, ClassMatches classMatches, Doer doer) { - MemberMatches memberMatches = new MemberMatches(); + MemberMatches memberMatches = new MemberMatches<>(); // unmatched source fields are easy MappingsChecker checker = new MappingsChecker(destDeobfuscator.getJarIndex()); @@ -624,15 +619,13 @@ public class MappingsConverter { } private static Type translate(Type type, final BiMap map) { - return new Type(type, new ClassNameReplacer() { - @Override - public String replace(String inClassName) { - ClassEntry outClassEntry = map.get(new ClassEntry(inClassName)); - if (outClassEntry == null) { - return null; - } - return outClassEntry.getName(); + return new Type(type, inClassName -> + { + ClassEntry outClassEntry = map.get(new ClassEntry(inClassName)); + if (outClassEntry == null) { + return null; } + return outClassEntry.getName(); }); } @@ -640,15 +633,13 @@ public class MappingsConverter { if (signature == null) { return null; } - return new Signature(signature, new ClassNameReplacer() { - @Override - public String replace(String inClassName) { - ClassEntry outClassEntry = map.get(new ClassEntry(inClassName)); - if (outClassEntry == null) { - return null; - } - return outClassEntry.getName(); + return new Signature(signature, inClassName -> + { + ClassEntry outClassEntry = map.get(new ClassEntry(inClassName)); + if (outClassEntry == null) { + return null; } + return outClassEntry.getName(); }); } diff --git a/src/main/java/cuchaz/enigma/convert/MatchesReader.java b/src/main/java/cuchaz/enigma/convert/MatchesReader.java index 550da49..d86d6c2 100644 --- a/src/main/java/cuchaz/enigma/convert/MatchesReader.java +++ b/src/main/java/cuchaz/enigma/convert/MatchesReader.java @@ -34,8 +34,7 @@ public class MatchesReader { } } - private static ClassMatch readClassMatch(String line) - throws IOException { + private static ClassMatch readClassMatch(String line) { String[] sides = line.split(":", 2); return new ClassMatch(readClasses(sides[0]), readClasses(sides[1])); } @@ -54,7 +53,7 @@ public class MatchesReader { public static MemberMatches readMembers(File file) throws IOException { try (BufferedReader in = new BufferedReader(new InputStreamReader(new FileInputStream(file), Charset.forName("UTF-8")))) { - MemberMatches matches = new MemberMatches(); + MemberMatches matches = new MemberMatches<>(); String line; while ((line = in.readLine()) != null) { readMemberMatch(matches, line); diff --git a/src/main/java/cuchaz/enigma/convert/MemberMatches.java b/src/main/java/cuchaz/enigma/convert/MemberMatches.java index 25af2f8..51cee85 100644 --- a/src/main/java/cuchaz/enigma/convert/MemberMatches.java +++ b/src/main/java/cuchaz/enigma/convert/MemberMatches.java @@ -21,29 +21,29 @@ import java.util.Set; public class MemberMatches { - private BiMap m_matches; - private Multimap m_matchedSourceEntries; - private Multimap m_unmatchedSourceEntries; - private Multimap m_unmatchedDestEntries; - private Multimap m_unmatchableSourceEntries; + private BiMap matches; + private Multimap matchedSourceEntries; + private Multimap unmatchedSourceEntries; + private Multimap unmatchedDestEntries; + private Multimap unmatchableSourceEntries; public MemberMatches() { - m_matches = HashBiMap.create(); - m_matchedSourceEntries = HashMultimap.create(); - m_unmatchedSourceEntries = HashMultimap.create(); - m_unmatchedDestEntries = HashMultimap.create(); - m_unmatchableSourceEntries = HashMultimap.create(); + matches = HashBiMap.create(); + matchedSourceEntries = HashMultimap.create(); + unmatchedSourceEntries = HashMultimap.create(); + unmatchedDestEntries = HashMultimap.create(); + unmatchableSourceEntries = HashMultimap.create(); } public void addMatch(T srcEntry, T destEntry) { - boolean wasAdded = m_matches.put(srcEntry, destEntry) == null; + boolean wasAdded = matches.put(srcEntry, destEntry) == null; assert (wasAdded); - wasAdded = m_matchedSourceEntries.put(srcEntry.getClassEntry(), srcEntry); + wasAdded = matchedSourceEntries.put(srcEntry.getClassEntry(), srcEntry); assert (wasAdded); } public void addUnmatchedSourceEntry(T sourceEntry) { - boolean wasAdded = m_unmatchedSourceEntries.put(sourceEntry.getClassEntry(), sourceEntry); + boolean wasAdded = unmatchedSourceEntries.put(sourceEntry.getClassEntry(), sourceEntry); assert (wasAdded); } @@ -56,7 +56,7 @@ public class MemberMatches { public void addUnmatchedDestEntry(T destEntry) { if (destEntry.getName().equals("") || destEntry.getName().equals("")) return; - boolean wasAdded = m_unmatchedDestEntries.put(destEntry.getClassEntry(), destEntry); + boolean wasAdded = unmatchedDestEntries.put(destEntry.getClassEntry(), destEntry); assert (wasAdded); } @@ -67,63 +67,63 @@ public class MemberMatches { } public void addUnmatchableSourceEntry(T sourceEntry) { - boolean wasAdded = m_unmatchableSourceEntries.put(sourceEntry.getClassEntry(), sourceEntry); + boolean wasAdded = unmatchableSourceEntries.put(sourceEntry.getClassEntry(), sourceEntry); assert (wasAdded); } public Set getSourceClassesWithUnmatchedEntries() { - return m_unmatchedSourceEntries.keySet(); + return unmatchedSourceEntries.keySet(); } public Collection getSourceClassesWithoutUnmatchedEntries() { Set out = Sets.newHashSet(); - out.addAll(m_matchedSourceEntries.keySet()); - out.removeAll(m_unmatchedSourceEntries.keySet()); + out.addAll(matchedSourceEntries.keySet()); + out.removeAll(unmatchedSourceEntries.keySet()); return out; } public Collection getUnmatchedSourceEntries() { - return m_unmatchedSourceEntries.values(); + return unmatchedSourceEntries.values(); } public Collection getUnmatchedSourceEntries(ClassEntry sourceClass) { - return m_unmatchedSourceEntries.get(sourceClass); + return unmatchedSourceEntries.get(sourceClass); } public Collection getUnmatchedDestEntries() { - return m_unmatchedDestEntries.values(); + return unmatchedDestEntries.values(); } public Collection getUnmatchedDestEntries(ClassEntry destClass) { - return m_unmatchedDestEntries.get(destClass); + return unmatchedDestEntries.get(destClass); } public Collection getUnmatchableSourceEntries() { - return m_unmatchableSourceEntries.values(); + return unmatchableSourceEntries.values(); } public boolean hasSource(T sourceEntry) { - return m_matches.containsKey(sourceEntry) || m_unmatchedSourceEntries.containsValue(sourceEntry); + return matches.containsKey(sourceEntry) || unmatchedSourceEntries.containsValue(sourceEntry); } public boolean hasDest(T destEntry) { - return m_matches.containsValue(destEntry) || m_unmatchedDestEntries.containsValue(destEntry); + return matches.containsValue(destEntry) || unmatchedDestEntries.containsValue(destEntry); } public BiMap matches() { - return m_matches; + return matches; } public boolean isMatchedSourceEntry(T sourceEntry) { - return m_matches.containsKey(sourceEntry); + return matches.containsKey(sourceEntry); } public boolean isMatchedDestEntry(T destEntry) { - return m_matches.containsValue(destEntry); + return matches.containsValue(destEntry); } public boolean isUnmatchableSourceEntry(T sourceEntry) { - return m_unmatchableSourceEntries.containsEntry(sourceEntry.getClassEntry(), sourceEntry); + return unmatchableSourceEntries.containsEntry(sourceEntry.getClassEntry(), sourceEntry); } public void makeMatch(T sourceEntry, T destEntry) { makeMatch(sourceEntry, destEntry, null, null); @@ -136,15 +136,15 @@ public class MemberMatches { sourceEntry = (T) sourceEntry.cloneToNewClass(sourceDeobfuscator.getJarIndex().getTranslationIndex().resolveEntryClass(sourceEntry, true)); destEntry = (T) destEntry.cloneToNewClass(destDeobfuscator.getJarIndex().getTranslationIndex().resolveEntryClass(destEntry, true)); } - boolean wasRemoved = m_unmatchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry); + boolean wasRemoved = unmatchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry); assert (wasRemoved); - wasRemoved = m_unmatchedDestEntries.remove(destEntry.getClassEntry(), destEntry); + wasRemoved = unmatchedDestEntries.remove(destEntry.getClassEntry(), destEntry); assert (wasRemoved); addMatch(sourceEntry, destEntry); } public boolean isMatched(T sourceEntry, T destEntry) { - T match = m_matches.get(sourceEntry); + T match = matches.get(sourceEntry); return match != null && match.equals(destEntry); } @@ -159,9 +159,9 @@ public class MemberMatches { destDeobfuscator.getJarIndex().getTranslationIndex().resolveEntryClass(destEntry, true)); } - boolean wasRemoved = m_matches.remove(sourceEntry) != null; + boolean wasRemoved = matches.remove(sourceEntry) != null; assert (wasRemoved); - wasRemoved = m_matchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry); + wasRemoved = matchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry); assert (wasRemoved); addUnmatchedSourceEntry(sourceEntry); addUnmatchedDestEntry(destEntry); @@ -175,7 +175,7 @@ public class MemberMatches { sourceDeobfuscator.getJarIndex().getTranslationIndex().resolveEntryClass(sourceEntry, true)); } assert (!isMatchedSourceEntry(sourceEntry)); - boolean wasRemoved = m_unmatchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry); + boolean wasRemoved = unmatchedSourceEntries.remove(sourceEntry.getClassEntry(), sourceEntry); assert (wasRemoved); addUnmatchableSourceEntry(sourceEntry); } -- cgit v1.2.3