diff options
| author | 2017-03-07 21:24:39 +0100 | |
|---|---|---|
| committer | 2017-03-07 21:30:02 +0100 | |
| commit | b4aaff683d78ab92b83f3a7257c33b8e27d1affa (patch) | |
| tree | f23c9bb0927d83cc7302881266b7df8fd37959c7 /src/main/java/cuchaz/enigma/convert/ClassIdentity.java | |
| parent | Avoid crash of the matcher when the obf name is invalid (set a deob it using ... (diff) | |
| download | enigma-fork-b4aaff683d78ab92b83f3a7257c33b8e27d1affa.tar.gz enigma-fork-b4aaff683d78ab92b83f3a7257c33b8e27d1affa.tar.xz enigma-fork-b4aaff683d78ab92b83f3a7257c33b8e27d1affa.zip | |
Drop unix case style and implement hashCode when equals is overrided
Also update Guava to version 21
Diffstat (limited to 'src/main/java/cuchaz/enigma/convert/ClassIdentity.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/convert/ClassIdentity.java | 19 |
1 files changed, 9 insertions, 10 deletions
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; | |||
| 20 | import java.util.Map; | 20 | import java.util.Map; |
| 21 | import java.util.Set; | 21 | import java.util.Set; |
| 22 | 22 | ||
| 23 | import cuchaz.enigma.Constants; | ||
| 24 | import cuchaz.enigma.analysis.ClassImplementationsTreeNode; | 23 | import cuchaz.enigma.analysis.ClassImplementationsTreeNode; |
| 25 | import cuchaz.enigma.analysis.EntryReference; | 24 | import cuchaz.enigma.analysis.EntryReference; |
| 26 | import cuchaz.enigma.analysis.JarIndex; | 25 | import cuchaz.enigma.analysis.JarIndex; |
| @@ -49,9 +48,9 @@ public class ClassIdentity { | |||
| 49 | private Multiset<String> references; | 48 | private Multiset<String> references; |
| 50 | private String outer; | 49 | private String outer; |
| 51 | 50 | ||
| 52 | private final ClassNameReplacer m_classNameReplacer = new ClassNameReplacer() { | 51 | private final ClassNameReplacer classNameReplacer = new ClassNameReplacer() { |
| 53 | 52 | ||
| 54 | private Map<String, String> m_classNames = Maps.newHashMap(); | 53 | private Map<String, String> classNames = Maps.newHashMap(); |
| 55 | 54 | ||
| 56 | @Override | 55 | @Override |
| 57 | public String replace(String className) { | 56 | public String replace(String className) { |
| @@ -76,14 +75,14 @@ public class ClassIdentity { | |||
| 76 | } | 75 | } |
| 77 | 76 | ||
| 78 | // otherwise, use local naming | 77 | // otherwise, use local naming |
| 79 | if (!m_classNames.containsKey(className)) { | 78 | if (!classNames.containsKey(className)) { |
| 80 | m_classNames.put(className, getNewClassName()); | 79 | classNames.put(className, getNewClassName()); |
| 81 | } | 80 | } |
| 82 | return m_classNames.get(className); | 81 | return classNames.get(className); |
| 83 | } | 82 | } |
| 84 | 83 | ||
| 85 | private String getNewClassName() { | 84 | private String getNewClassName() { |
| 86 | return String.format("C%03d", m_classNames.size()); | 85 | return String.format("C%03d", classNames.size()); |
| 87 | } | 86 | } |
| 88 | }; | 87 | }; |
| 89 | 88 | ||
| @@ -229,7 +228,7 @@ public class ClassIdentity { | |||
| 229 | } | 228 | } |
| 230 | 229 | ||
| 231 | private String scrubClassName(String className) { | 230 | private String scrubClassName(String className) { |
| 232 | return m_classNameReplacer.replace(className); | 231 | return classNameReplacer.replace(className); |
| 233 | } | 232 | } |
| 234 | 233 | ||
| 235 | private String scrubType(String typeName) { | 234 | private String scrubType(String typeName) { |
| @@ -238,7 +237,7 @@ public class ClassIdentity { | |||
| 238 | 237 | ||
| 239 | private Type scrubType(Type type) { | 238 | private Type scrubType(Type type) { |
| 240 | if (type.hasClass()) { | 239 | if (type.hasClass()) { |
| 241 | return new Type(type, m_classNameReplacer); | 240 | return new Type(type, classNameReplacer); |
| 242 | } else { | 241 | } else { |
| 243 | return type; | 242 | return type; |
| 244 | } | 243 | } |
| @@ -249,7 +248,7 @@ public class ClassIdentity { | |||
| 249 | } | 248 | } |
| 250 | 249 | ||
| 251 | private Signature scrubSignature(Signature signature) { | 250 | private Signature scrubSignature(Signature signature) { |
| 252 | return new Signature(signature, m_classNameReplacer); | 251 | return new Signature(signature, classNameReplacer); |
| 253 | } | 252 | } |
| 254 | 253 | ||
| 255 | private boolean isClassMatchedUniquely(String className) { | 254 | private boolean isClassMatchedUniquely(String className) { |