diff options
Diffstat (limited to 'src/cuchaz/enigma/mapping/MappingsRenamer.java')
| -rw-r--r-- | src/cuchaz/enigma/mapping/MappingsRenamer.java | 308 |
1 files changed, 127 insertions, 181 deletions
diff --git a/src/cuchaz/enigma/mapping/MappingsRenamer.java b/src/cuchaz/enigma/mapping/MappingsRenamer.java index 3e5f1a4..cb95f42 100644 --- a/src/cuchaz/enigma/mapping/MappingsRenamer.java +++ b/src/cuchaz/enigma/mapping/MappingsRenamer.java | |||
| @@ -19,272 +19,218 @@ import java.util.zip.GZIPOutputStream; | |||
| 19 | import cuchaz.enigma.Constants; | 19 | import cuchaz.enigma.Constants; |
| 20 | import cuchaz.enigma.analysis.JarIndex; | 20 | import cuchaz.enigma.analysis.JarIndex; |
| 21 | 21 | ||
| 22 | public class MappingsRenamer | 22 | public class MappingsRenamer { |
| 23 | { | 23 | |
| 24 | private JarIndex m_index; | 24 | private JarIndex m_index; |
| 25 | private Mappings m_mappings; | 25 | private Mappings m_mappings; |
| 26 | 26 | ||
| 27 | public MappingsRenamer( JarIndex index, Mappings mappings ) | 27 | public MappingsRenamer(JarIndex index, Mappings mappings) { |
| 28 | { | ||
| 29 | m_index = index; | 28 | m_index = index; |
| 30 | m_mappings = mappings; | 29 | m_mappings = mappings; |
| 31 | } | 30 | } |
| 32 | 31 | ||
| 33 | public void setClassName( ClassEntry obf, String deobfName ) | 32 | public void setClassName(ClassEntry obf, String deobfName) { |
| 34 | { | 33 | deobfName = NameValidator.validateClassName(deobfName, !obf.isInnerClass()); |
| 35 | deobfName = NameValidator.validateClassName( deobfName, !obf.isInnerClass() ); | 34 | ClassEntry targetEntry = new ClassEntry(deobfName); |
| 36 | ClassEntry targetEntry = new ClassEntry( deobfName ); | 35 | if (m_mappings.containsDeobfClass(deobfName) || m_index.containsObfClass(targetEntry)) { |
| 37 | if( m_mappings.containsDeobfClass( deobfName ) || m_index.containsObfClass( targetEntry ) ) | 36 | throw new IllegalNameException(deobfName, "There is already a class with that name"); |
| 38 | { | ||
| 39 | throw new IllegalNameException( deobfName, "There is already a class with that name" ); | ||
| 40 | } | 37 | } |
| 41 | 38 | ||
| 42 | ClassMapping classMapping = getOrCreateClassMapping( obf ); | 39 | ClassMapping classMapping = getOrCreateClassMapping(obf); |
| 43 | 40 | ||
| 44 | if( obf.isInnerClass() ) | 41 | if (obf.isInnerClass()) { |
| 45 | { | 42 | classMapping.setInnerClassName(obf.getInnerClassName(), deobfName); |
| 46 | classMapping.setInnerClassName( obf.getInnerClassName(), deobfName ); | 43 | } else { |
| 47 | } | 44 | if (classMapping.getDeobfName() != null) { |
| 48 | else | 45 | boolean wasRemoved = m_mappings.m_classesByDeobf.remove(classMapping.getDeobfName()) != null; |
| 49 | { | 46 | assert (wasRemoved); |
| 50 | if( classMapping.getDeobfName() != null ) | ||
| 51 | { | ||
| 52 | boolean wasRemoved = m_mappings.m_classesByDeobf.remove( classMapping.getDeobfName() ) != null; | ||
| 53 | assert( wasRemoved ); | ||
| 54 | } | 47 | } |
| 55 | classMapping.setDeobfName( deobfName ); | 48 | classMapping.setDeobfName(deobfName); |
| 56 | boolean wasAdded = m_mappings.m_classesByDeobf.put( deobfName, classMapping ) == null; | 49 | boolean wasAdded = m_mappings.m_classesByDeobf.put(deobfName, classMapping) == null; |
| 57 | assert( wasAdded ); | 50 | assert (wasAdded); |
| 58 | } | 51 | } |
| 59 | } | 52 | } |
| 60 | 53 | ||
| 61 | public void removeClassMapping( ClassEntry obf ) | 54 | public void removeClassMapping(ClassEntry obf) { |
| 62 | { | 55 | ClassMapping classMapping = getClassMapping(obf); |
| 63 | ClassMapping classMapping = getClassMapping( obf ); | 56 | if (obf.isInnerClass()) { |
| 64 | if( obf.isInnerClass() ) | 57 | classMapping.setInnerClassName(obf.getName(), null); |
| 65 | { | 58 | } else { |
| 66 | classMapping.setInnerClassName( obf.getName(), null ); | 59 | boolean wasRemoved = m_mappings.m_classesByDeobf.remove(classMapping.getDeobfName()) != null; |
| 67 | } | 60 | assert (wasRemoved); |
| 68 | else | 61 | classMapping.setDeobfName(null); |
| 69 | { | ||
| 70 | boolean wasRemoved = m_mappings.m_classesByDeobf.remove( classMapping.getDeobfName() ) != null; | ||
| 71 | assert( wasRemoved ); | ||
| 72 | classMapping.setDeobfName( null ); | ||
| 73 | } | 62 | } |
| 74 | } | 63 | } |
| 75 | 64 | ||
| 76 | public void markClassAsDeobfuscated( ClassEntry obf ) | 65 | public void markClassAsDeobfuscated(ClassEntry obf) { |
| 77 | { | 66 | ClassMapping classMapping = getOrCreateClassMapping(obf); |
| 78 | ClassMapping classMapping = getOrCreateClassMapping( obf ); | 67 | if (obf.isInnerClass()) { |
| 79 | if( obf.isInnerClass() ) | ||
| 80 | { | ||
| 81 | String innerClassName = Constants.NonePackage + "/" + obf.getInnerClassName(); | 68 | String innerClassName = Constants.NonePackage + "/" + obf.getInnerClassName(); |
| 82 | classMapping.setInnerClassName( innerClassName, innerClassName ); | 69 | classMapping.setInnerClassName(innerClassName, innerClassName); |
| 83 | } | 70 | } else { |
| 84 | else | 71 | classMapping.setDeobfName(obf.getName()); |
| 85 | { | 72 | boolean wasAdded = m_mappings.m_classesByDeobf.put(obf.getName(), classMapping) == null; |
| 86 | classMapping.setDeobfName( obf.getName() ); | 73 | assert (wasAdded); |
| 87 | boolean wasAdded = m_mappings.m_classesByDeobf.put( obf.getName(), classMapping ) == null; | ||
| 88 | assert( wasAdded ); | ||
| 89 | } | 74 | } |
| 90 | } | 75 | } |
| 91 | 76 | ||
| 92 | public void setFieldName( FieldEntry obf, String deobfName ) | 77 | public void setFieldName(FieldEntry obf, String deobfName) { |
| 93 | { | 78 | deobfName = NameValidator.validateFieldName(deobfName); |
| 94 | deobfName = NameValidator.validateFieldName( deobfName ); | 79 | FieldEntry targetEntry = new FieldEntry(obf.getClassEntry(), deobfName); |
| 95 | FieldEntry targetEntry = new FieldEntry( obf.getClassEntry(), deobfName ); | 80 | if (m_mappings.containsDeobfField(obf.getClassEntry(), deobfName) || m_index.containsObfField(targetEntry)) { |
| 96 | if( m_mappings.containsDeobfField( obf.getClassEntry(), deobfName ) || m_index.containsObfField( targetEntry ) ) | 81 | throw new IllegalNameException(deobfName, "There is already a field with that name"); |
| 97 | { | ||
| 98 | throw new IllegalNameException( deobfName, "There is already a field with that name" ); | ||
| 99 | } | 82 | } |
| 100 | 83 | ||
| 101 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 84 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 102 | classMapping.setFieldName( obf.getName(), deobfName ); | 85 | classMapping.setFieldName(obf.getName(), deobfName); |
| 103 | } | 86 | } |
| 104 | 87 | ||
| 105 | public void removeFieldMapping( FieldEntry obf ) | 88 | public void removeFieldMapping(FieldEntry obf) { |
| 106 | { | 89 | ClassMapping classMapping = getClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 107 | ClassMapping classMapping = getClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 90 | classMapping.setFieldName(obf.getName(), null); |
| 108 | classMapping.setFieldName( obf.getName(), null ); | ||
| 109 | } | 91 | } |
| 110 | 92 | ||
| 111 | public void markFieldAsDeobfuscated( FieldEntry obf ) | 93 | public void markFieldAsDeobfuscated(FieldEntry obf) { |
| 112 | { | 94 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 113 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 95 | classMapping.setFieldName(obf.getName(), obf.getName()); |
| 114 | classMapping.setFieldName( obf.getName(), obf.getName() ); | ||
| 115 | } | 96 | } |
| 116 | 97 | ||
| 117 | public void setMethodTreeName( MethodEntry obf, String deobfName ) | 98 | public void setMethodTreeName(MethodEntry obf, String deobfName) { |
| 118 | { | 99 | Set<MethodEntry> implementations = m_index.getRelatedMethodImplementations(obf); |
| 119 | Set<MethodEntry> implementations = m_index.getRelatedMethodImplementations( obf ); | ||
| 120 | 100 | ||
| 121 | deobfName = NameValidator.validateMethodName( deobfName ); | 101 | deobfName = NameValidator.validateMethodName(deobfName); |
| 122 | for( MethodEntry entry : implementations ) | 102 | for (MethodEntry entry : implementations) { |
| 123 | { | 103 | String deobfSignature = m_mappings.getTranslator(TranslationDirection.Deobfuscating).translateSignature(obf.getSignature()); |
| 124 | String deobfSignature = m_mappings.getTranslator( TranslationDirection.Deobfuscating ).translateSignature( obf.getSignature() ); | 104 | MethodEntry targetEntry = new MethodEntry(entry.getClassEntry(), deobfName, deobfSignature); |
| 125 | MethodEntry targetEntry = new MethodEntry( entry.getClassEntry(), deobfName, deobfSignature ); | 105 | if (m_mappings.containsDeobfMethod(entry.getClassEntry(), deobfName, entry.getSignature()) || m_index.containsObfBehavior(targetEntry)) { |
| 126 | if( m_mappings.containsDeobfMethod( entry.getClassEntry(), deobfName, entry.getSignature() ) || m_index.containsObfBehavior( targetEntry ) ) | 106 | String deobfClassName = m_mappings.getTranslator(TranslationDirection.Deobfuscating).translateClass(entry.getClassName()); |
| 127 | { | 107 | throw new IllegalNameException(deobfName, "There is already a method with that name and signature in class " + deobfClassName); |
| 128 | String deobfClassName = m_mappings.getTranslator( TranslationDirection.Deobfuscating ).translateClass( entry.getClassName() ); | ||
| 129 | throw new IllegalNameException( deobfName, "There is already a method with that name and signature in class " + deobfClassName ); | ||
| 130 | } | 108 | } |
| 131 | } | 109 | } |
| 132 | 110 | ||
| 133 | for( MethodEntry entry : implementations ) | 111 | for (MethodEntry entry : implementations) { |
| 134 | { | 112 | setMethodName(entry, deobfName); |
| 135 | setMethodName( entry, deobfName ); | ||
| 136 | } | 113 | } |
| 137 | } | 114 | } |
| 138 | 115 | ||
| 139 | public void setMethodName( MethodEntry obf, String deobfName ) | 116 | public void setMethodName(MethodEntry obf, String deobfName) { |
| 140 | { | 117 | deobfName = NameValidator.validateMethodName(deobfName); |
| 141 | deobfName = NameValidator.validateMethodName( deobfName ); | 118 | MethodEntry targetEntry = new MethodEntry(obf.getClassEntry(), deobfName, obf.getSignature()); |
| 142 | MethodEntry targetEntry = new MethodEntry( obf.getClassEntry(), deobfName, obf.getSignature() ); | 119 | if (m_mappings.containsDeobfMethod(obf.getClassEntry(), deobfName, obf.getSignature()) || m_index.containsObfBehavior(targetEntry)) { |
| 143 | if( m_mappings.containsDeobfMethod( obf.getClassEntry(), deobfName, obf.getSignature() ) || m_index.containsObfBehavior( targetEntry ) ) | 120 | String deobfClassName = m_mappings.getTranslator(TranslationDirection.Deobfuscating).translateClass(obf.getClassName()); |
| 144 | { | 121 | throw new IllegalNameException(deobfName, "There is already a method with that name and signature in class " + deobfClassName); |
| 145 | String deobfClassName = m_mappings.getTranslator( TranslationDirection.Deobfuscating ).translateClass( obf.getClassName() ); | ||
| 146 | throw new IllegalNameException( deobfName, "There is already a method with that name and signature in class " + deobfClassName ); | ||
| 147 | } | 122 | } |
| 148 | 123 | ||
| 149 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 124 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 150 | classMapping.setMethodName( obf.getName(), obf.getSignature(), deobfName ); | 125 | classMapping.setMethodName(obf.getName(), obf.getSignature(), deobfName); |
| 151 | } | 126 | } |
| 152 | 127 | ||
| 153 | public void removeMethodTreeMapping( MethodEntry obf ) | 128 | public void removeMethodTreeMapping(MethodEntry obf) { |
| 154 | { | 129 | for (MethodEntry implementation : m_index.getRelatedMethodImplementations(obf)) { |
| 155 | for( MethodEntry implementation : m_index.getRelatedMethodImplementations( obf ) ) | 130 | removeMethodMapping(implementation); |
| 156 | { | ||
| 157 | removeMethodMapping( implementation ); | ||
| 158 | } | 131 | } |
| 159 | } | 132 | } |
| 160 | 133 | ||
| 161 | public void removeMethodMapping( MethodEntry obf ) | 134 | public void removeMethodMapping(MethodEntry obf) { |
| 162 | { | 135 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 163 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 136 | classMapping.setMethodName(obf.getName(), obf.getSignature(), null); |
| 164 | classMapping.setMethodName( obf.getName(), obf.getSignature(), null ); | ||
| 165 | } | 137 | } |
| 166 | 138 | ||
| 167 | public void markMethodTreeAsDeobfuscated( MethodEntry obf ) | 139 | public void markMethodTreeAsDeobfuscated(MethodEntry obf) { |
| 168 | { | 140 | for (MethodEntry implementation : m_index.getRelatedMethodImplementations(obf)) { |
| 169 | for( MethodEntry implementation : m_index.getRelatedMethodImplementations( obf ) ) | 141 | markMethodAsDeobfuscated(implementation); |
| 170 | { | ||
| 171 | markMethodAsDeobfuscated( implementation ); | ||
| 172 | } | 142 | } |
| 173 | } | 143 | } |
| 174 | 144 | ||
| 175 | public void markMethodAsDeobfuscated( MethodEntry obf ) | 145 | public void markMethodAsDeobfuscated(MethodEntry obf) { |
| 176 | { | 146 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 177 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 147 | classMapping.setMethodName(obf.getName(), obf.getSignature(), obf.getName()); |
| 178 | classMapping.setMethodName( obf.getName(), obf.getSignature(), obf.getName() ); | ||
| 179 | } | 148 | } |
| 180 | 149 | ||
| 181 | public void setArgumentName( ArgumentEntry obf, String deobfName ) | 150 | public void setArgumentName(ArgumentEntry obf, String deobfName) { |
| 182 | { | 151 | deobfName = NameValidator.validateArgumentName(deobfName); |
| 183 | deobfName = NameValidator.validateArgumentName( deobfName ); | ||
| 184 | // NOTE: don't need to check arguments for name collisions with names determined by Procyon | 152 | // NOTE: don't need to check arguments for name collisions with names determined by Procyon |
| 185 | if( m_mappings.containsArgument( obf.getBehaviorEntry(), deobfName ) ) | 153 | if (m_mappings.containsArgument(obf.getBehaviorEntry(), deobfName)) { |
| 186 | { | 154 | throw new IllegalNameException(deobfName, "There is already an argument with that name"); |
| 187 | throw new IllegalNameException( deobfName, "There is already an argument with that name" ); | ||
| 188 | } | 155 | } |
| 189 | 156 | ||
| 190 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 157 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 191 | classMapping.setArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), deobfName ); | 158 | classMapping.setArgumentName(obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), deobfName); |
| 192 | } | 159 | } |
| 193 | 160 | ||
| 194 | public void removeArgumentMapping( ArgumentEntry obf ) | 161 | public void removeArgumentMapping(ArgumentEntry obf) { |
| 195 | { | 162 | ClassMapping classMapping = getClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 196 | ClassMapping classMapping = getClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 163 | classMapping.removeArgumentName(obf.getMethodName(), obf.getMethodSignature(), obf.getIndex()); |
| 197 | classMapping.removeArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex() ); | ||
| 198 | } | 164 | } |
| 199 | 165 | ||
| 200 | public void markArgumentAsDeobfuscated( ArgumentEntry obf ) | 166 | public void markArgumentAsDeobfuscated(ArgumentEntry obf) { |
| 201 | { | 167 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping(obf.getClassEntry()); |
| 202 | ClassMapping classMapping = getOrCreateClassMappingOrInnerClassMapping( obf.getClassEntry() ); | 168 | classMapping.setArgumentName(obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), obf.getName()); |
| 203 | classMapping.setArgumentName( obf.getMethodName(), obf.getMethodSignature(), obf.getIndex(), obf.getName() ); | ||
| 204 | } | 169 | } |
| 205 | 170 | ||
| 206 | public boolean moveFieldToObfClass( ClassMapping classMapping, FieldMapping fieldMapping, ClassEntry obfClass ) | 171 | public boolean moveFieldToObfClass(ClassMapping classMapping, FieldMapping fieldMapping, ClassEntry obfClass) { |
| 207 | { | 172 | classMapping.removeFieldMapping(fieldMapping); |
| 208 | classMapping.removeFieldMapping( fieldMapping ); | 173 | ClassMapping targetClassMapping = getOrCreateClassMapping(obfClass); |
| 209 | ClassMapping targetClassMapping = getOrCreateClassMapping( obfClass ); | 174 | if (!targetClassMapping.containsObfField(fieldMapping.getObfName())) { |
| 210 | if( !targetClassMapping.containsObfField( fieldMapping.getObfName() ) ) | 175 | if (!targetClassMapping.containsDeobfField(fieldMapping.getDeobfName())) { |
| 211 | { | 176 | targetClassMapping.addFieldMapping(fieldMapping); |
| 212 | if( !targetClassMapping.containsDeobfField( fieldMapping.getDeobfName() ) ) | ||
| 213 | { | ||
| 214 | targetClassMapping.addFieldMapping( fieldMapping ); | ||
| 215 | return true; | 177 | return true; |
| 216 | } | 178 | } else { |
| 217 | else | 179 | System.err.println("WARNING: deobf field was already there: " + obfClass + "." + fieldMapping.getDeobfName()); |
| 218 | { | ||
| 219 | System.err.println( "WARNING: deobf field was already there: " + obfClass + "." + fieldMapping.getDeobfName() ); | ||
| 220 | } | 180 | } |
| 221 | } | 181 | } |
| 222 | return false; | 182 | return false; |
| 223 | } | 183 | } |
| 224 | 184 | ||
| 225 | public boolean moveMethodToObfClass( ClassMapping classMapping, MethodMapping methodMapping, ClassEntry obfClass ) | 185 | public boolean moveMethodToObfClass(ClassMapping classMapping, MethodMapping methodMapping, ClassEntry obfClass) { |
| 226 | { | 186 | classMapping.removeMethodMapping(methodMapping); |
| 227 | classMapping.removeMethodMapping( methodMapping ); | 187 | ClassMapping targetClassMapping = getOrCreateClassMapping(obfClass); |
| 228 | ClassMapping targetClassMapping = getOrCreateClassMapping( obfClass ); | 188 | if (!targetClassMapping.containsObfMethod(methodMapping.getObfName(), methodMapping.getObfSignature())) { |
| 229 | if( !targetClassMapping.containsObfMethod( methodMapping.getObfName(), methodMapping.getObfSignature() ) ) | 189 | if (!targetClassMapping.containsDeobfMethod(methodMapping.getDeobfName(), methodMapping.getObfSignature())) { |
| 230 | { | 190 | targetClassMapping.addMethodMapping(methodMapping); |
| 231 | if( !targetClassMapping.containsDeobfMethod( methodMapping.getDeobfName(), methodMapping.getObfSignature() ) ) | ||
| 232 | { | ||
| 233 | targetClassMapping.addMethodMapping( methodMapping ); | ||
| 234 | return true; | 191 | return true; |
| 235 | } | 192 | } else { |
| 236 | else | 193 | System.err.println("WARNING: deobf method was already there: " + obfClass + "." + methodMapping.getDeobfName() + methodMapping.getObfSignature()); |
| 237 | { | ||
| 238 | System.err.println( "WARNING: deobf method was already there: " + obfClass + "." + methodMapping.getDeobfName() + methodMapping.getObfSignature() ); | ||
| 239 | } | 194 | } |
| 240 | } | 195 | } |
| 241 | return false; | 196 | return false; |
| 242 | } | 197 | } |
| 243 | 198 | ||
| 244 | public void write( OutputStream out ) | 199 | public void write(OutputStream out) throws IOException { |
| 245 | throws IOException | ||
| 246 | { | ||
| 247 | // TEMP: just use the object output for now. We can find a more efficient storage format later | 200 | // TEMP: just use the object output for now. We can find a more efficient storage format later |
| 248 | GZIPOutputStream gzipout = new GZIPOutputStream( out ); | 201 | GZIPOutputStream gzipout = new GZIPOutputStream(out); |
| 249 | ObjectOutputStream oout = new ObjectOutputStream( gzipout ); | 202 | ObjectOutputStream oout = new ObjectOutputStream(gzipout); |
| 250 | oout.writeObject( this ); | 203 | oout.writeObject(this); |
| 251 | gzipout.finish(); | 204 | gzipout.finish(); |
| 252 | } | 205 | } |
| 253 | 206 | ||
| 254 | private ClassMapping getClassMapping( ClassEntry obfClassEntry ) | 207 | private ClassMapping getClassMapping(ClassEntry obfClassEntry) { |
| 255 | { | 208 | return m_mappings.m_classesByObf.get(obfClassEntry.getOuterClassName()); |
| 256 | return m_mappings.m_classesByObf.get( obfClassEntry.getOuterClassName() ); | ||
| 257 | } | 209 | } |
| 258 | 210 | ||
| 259 | private ClassMapping getOrCreateClassMapping( ClassEntry obfClassEntry ) | 211 | private ClassMapping getOrCreateClassMapping(ClassEntry obfClassEntry) { |
| 260 | { | ||
| 261 | String obfClassName = obfClassEntry.getOuterClassName(); | 212 | String obfClassName = obfClassEntry.getOuterClassName(); |
| 262 | ClassMapping classMapping = m_mappings.m_classesByObf.get( obfClassName ); | 213 | ClassMapping classMapping = m_mappings.m_classesByObf.get(obfClassName); |
| 263 | if( classMapping == null ) | 214 | if (classMapping == null) { |
| 264 | { | 215 | classMapping = new ClassMapping(obfClassName); |
| 265 | classMapping = new ClassMapping( obfClassName ); | 216 | boolean obfWasAdded = m_mappings.m_classesByObf.put(classMapping.getObfName(), classMapping) == null; |
| 266 | boolean obfWasAdded = m_mappings.m_classesByObf.put( classMapping.getObfName(), classMapping ) == null; | 217 | assert (obfWasAdded); |
| 267 | assert( obfWasAdded ); | ||
| 268 | } | 218 | } |
| 269 | return classMapping; | 219 | return classMapping; |
| 270 | } | 220 | } |
| 271 | 221 | ||
| 272 | private ClassMapping getClassMappingOrInnerClassMapping( ClassEntry obfClassEntry ) | 222 | private ClassMapping getClassMappingOrInnerClassMapping(ClassEntry obfClassEntry) { |
| 273 | { | 223 | ClassMapping classMapping = getClassMapping(obfClassEntry); |
| 274 | ClassMapping classMapping = getClassMapping( obfClassEntry ); | 224 | if (obfClassEntry.isInDefaultPackage()) { |
| 275 | if( obfClassEntry.isInDefaultPackage() ) | 225 | classMapping = classMapping.getInnerClassByObf(obfClassEntry.getInnerClassName()); |
| 276 | { | ||
| 277 | classMapping = classMapping.getInnerClassByObf( obfClassEntry.getInnerClassName() ); | ||
| 278 | } | 226 | } |
| 279 | return classMapping; | 227 | return classMapping; |
| 280 | } | 228 | } |
| 281 | 229 | ||
| 282 | private ClassMapping getOrCreateClassMappingOrInnerClassMapping( ClassEntry obfClassEntry ) | 230 | private ClassMapping getOrCreateClassMappingOrInnerClassMapping(ClassEntry obfClassEntry) { |
| 283 | { | 231 | ClassMapping classMapping = getOrCreateClassMapping(obfClassEntry); |
| 284 | ClassMapping classMapping = getOrCreateClassMapping( obfClassEntry ); | 232 | if (obfClassEntry.isInnerClass()) { |
| 285 | if( obfClassEntry.isInnerClass() ) | 233 | classMapping = classMapping.getOrCreateInnerClass(obfClassEntry.getInnerClassName()); |
| 286 | { | ||
| 287 | classMapping = classMapping.getOrCreateInnerClass( obfClassEntry.getInnerClassName() ); | ||
| 288 | } | 234 | } |
| 289 | return classMapping; | 235 | return classMapping; |
| 290 | } | 236 | } |