diff options
| author | 2014-08-27 00:57:06 -0400 | |
|---|---|---|
| committer | 2014-08-27 00:57:06 -0400 | |
| commit | 88d6d655a022b8125355409bd88535da756e5c99 (patch) | |
| tree | 975913a72338eee8bc2c33ba1b62006cc96b8950 /src/cuchaz/enigma/mapping/ClassMapping.java | |
| parent | Added tag v0.4 beta for changeset 632874ba85da (diff) | |
| download | enigma-fork-88d6d655a022b8125355409bd88535da756e5c99.tar.gz enigma-fork-88d6d655a022b8125355409bd88535da756e5c99.tar.xz enigma-fork-88d6d655a022b8125355409bd88535da756e5c99.zip | |
add more checking to catch duplicate mappings on load
implemented more stable sort order for methods
repackaged as v0.4.1beta
Diffstat (limited to 'src/cuchaz/enigma/mapping/ClassMapping.java')
| -rw-r--r-- | src/cuchaz/enigma/mapping/ClassMapping.java | 25 |
1 files changed, 22 insertions, 3 deletions
diff --git a/src/cuchaz/enigma/mapping/ClassMapping.java b/src/cuchaz/enigma/mapping/ClassMapping.java index c7f930c..5936512 100644 --- a/src/cuchaz/enigma/mapping/ClassMapping.java +++ b/src/cuchaz/enigma/mapping/ClassMapping.java | |||
| @@ -129,10 +129,18 @@ public class ClassMapping implements Serializable, Comparable<ClassMapping> | |||
| 129 | 129 | ||
| 130 | protected void addFieldMapping( FieldMapping fieldMapping ) | 130 | protected void addFieldMapping( FieldMapping fieldMapping ) |
| 131 | { | 131 | { |
| 132 | if( m_fieldsByObf.containsKey( fieldMapping.getObfName() ) ) | ||
| 133 | { | ||
| 134 | throw new Error( "Already have mapping for " + m_obfName + "." + fieldMapping.getObfName() ); | ||
| 135 | } | ||
| 136 | if( m_fieldsByDeobf.containsKey( fieldMapping.getDeobfName() ) ) | ||
| 137 | { | ||
| 138 | throw new Error( "Already have mapping for " + m_deobfName + "." + fieldMapping.getDeobfName() ); | ||
| 139 | } | ||
| 132 | m_fieldsByObf.put( fieldMapping.getObfName(), fieldMapping ); | 140 | m_fieldsByObf.put( fieldMapping.getObfName(), fieldMapping ); |
| 133 | m_fieldsByDeobf.put( fieldMapping.getDeobfName(), fieldMapping ); | 141 | m_fieldsByDeobf.put( fieldMapping.getDeobfName(), fieldMapping ); |
| 142 | assert( m_fieldsByObf.size() == m_fieldsByDeobf.size() ); | ||
| 134 | } | 143 | } |
| 135 | |||
| 136 | 144 | ||
| 137 | public String getObfFieldName( String deobfName ) | 145 | public String getObfFieldName( String deobfName ) |
| 138 | { | 146 | { |
| @@ -179,8 +187,19 @@ public class ClassMapping implements Serializable, Comparable<ClassMapping> | |||
| 179 | 187 | ||
| 180 | protected void addMethodMapping( MethodMapping methodMapping ) | 188 | protected void addMethodMapping( MethodMapping methodMapping ) |
| 181 | { | 189 | { |
| 182 | m_methodsByObf.put( getMethodKey( methodMapping.getObfName(), methodMapping.getObfSignature() ), methodMapping ); | 190 | String obfKey = getMethodKey( methodMapping.getObfName(), methodMapping.getObfSignature() ); |
| 183 | m_methodsByDeobf.put( getMethodKey( methodMapping.getDeobfName(), methodMapping.getDeobfSignature() ), methodMapping ); | 191 | String deobfKey = getMethodKey( methodMapping.getDeobfName(), methodMapping.getDeobfSignature() ); |
| 192 | if( m_methodsByObf.containsKey( obfKey ) ) | ||
| 193 | { | ||
| 194 | throw new Error( "Already have mapping for " + m_obfName + "." + obfKey ); | ||
| 195 | } | ||
| 196 | if( m_methodsByDeobf.containsKey( deobfKey ) ) | ||
| 197 | { | ||
| 198 | throw new Error( "Already have mapping for " + m_deobfName + "." + deobfKey ); | ||
| 199 | } | ||
| 200 | m_methodsByObf.put( obfKey, methodMapping ); | ||
| 201 | m_methodsByDeobf.put( deobfKey, methodMapping ); | ||
| 202 | assert( m_methodsByObf.size() == m_methodsByDeobf.size() ); | ||
| 184 | } | 203 | } |
| 185 | 204 | ||
| 186 | public MethodMapping getMethodByObf( String obfName, String signature ) | 205 | public MethodMapping getMethodByObf( String obfName, String signature ) |