public void processMethodMapping( String className, int firstLineNumber, int lastLineNumber, String methodReturnType, String methodName, String methodArguments, String newMethodName) { // Original class name -> obfuscated method names. Map methodMap = (Map) classMethodMap.get(className); if (methodMap == null) { methodMap = new HashMap(); classMethodMap.put(className, methodMap); } // Obfuscated method name -> methods. Set methodSet = (Set) methodMap.get(newMethodName); if (methodSet == null) { methodSet = new LinkedHashSet(); methodMap.put(newMethodName, methodSet); } // Add the method information. methodSet.add( new MethodInfo( firstLineNumber, lastLineNumber, methodReturnType, methodArguments, methodName)); }
/** * Finds the original field name(s), appending the first one to the out line, and any additional * alternatives to the extra lines. */ private void originalFieldName( String className, String obfuscatedFieldName, String type, StringBuffer outLine, List extraOutLines) { int extraIndent = -1; // Class name -> obfuscated field names. Map fieldMap = (Map) classFieldMap.get(className); if (fieldMap != null) { // Obfuscated field names -> fields. Set fieldSet = (Set) fieldMap.get(obfuscatedFieldName); if (fieldSet != null) { // Find all matching fields. Iterator fieldInfoIterator = fieldSet.iterator(); while (fieldInfoIterator.hasNext()) { FieldInfo fieldInfo = (FieldInfo) fieldInfoIterator.next(); if (fieldInfo.matches(type)) { // Is this the first matching field? if (extraIndent < 0) { extraIndent = outLine.length(); // Append the first original name. if (verbose) { outLine.append(fieldInfo.type).append(' '); } outLine.append(fieldInfo.originalName); } else { // Create an additional line with the proper // indentation. StringBuffer extraBuffer = new StringBuffer(); for (int counter = 0; counter < extraIndent; counter++) { extraBuffer.append(' '); } // Append the alternative name. if (verbose) { extraBuffer.append(fieldInfo.type).append(' '); } extraBuffer.append(fieldInfo.originalName); // Store the additional line. extraOutLines.add(extraBuffer); } } } } } // Just append the obfuscated name if we haven't found any matching // fields. if (extraIndent < 0) { outLine.append(obfuscatedFieldName); } }
public void processFieldMapping( String className, String fieldType, String fieldName, String newFieldName) { // Original class name -> obfuscated field names. Map fieldMap = (Map) classFieldMap.get(className); if (fieldMap == null) { fieldMap = new HashMap(); classFieldMap.put(className, fieldMap); } // Obfuscated field name -> fields. Set fieldSet = (Set) fieldMap.get(newFieldName); if (fieldSet == null) { fieldSet = new LinkedHashSet(); fieldMap.put(newFieldName, fieldSet); } // Add the field information. fieldSet.add(new FieldInfo(fieldType, fieldName)); }
/** * Finds the original method name(s), appending the first one to the out line, and any additional * alternatives to the extra lines. */ private void originalMethodName( String className, String obfuscatedMethodName, int lineNumber, String type, String arguments, StringBuffer outLine, List extraOutLines) { int extraIndent = -1; // Class name -> obfuscated method names. Map methodMap = (Map) classMethodMap.get(className); if (methodMap != null) { // Obfuscated method names -> methods. Set methodSet = (Set) methodMap.get(obfuscatedMethodName); if (methodSet != null) { // Find all matching methods. Iterator methodInfoIterator = methodSet.iterator(); while (methodInfoIterator.hasNext()) { MethodInfo methodInfo = (MethodInfo) methodInfoIterator.next(); if (methodInfo.matches(lineNumber, type, arguments)) { // Is this the first matching method? if (extraIndent < 0) { extraIndent = outLine.length(); // Append the first original name. if (verbose) { outLine.append(methodInfo.type).append(' '); } outLine.append(methodInfo.originalName); if (verbose) { outLine.append('(').append(methodInfo.arguments).append(')'); } } else { // Create an additional line with the proper // indentation. StringBuffer extraBuffer = new StringBuffer(); for (int counter = 0; counter < extraIndent; counter++) { extraBuffer.append(' '); } // Append the alternative name. if (verbose) { extraBuffer.append(methodInfo.type).append(' '); } extraBuffer.append(methodInfo.originalName); if (verbose) { extraBuffer.append('(').append(methodInfo.arguments).append(')'); } // Store the additional line. extraOutLines.add(extraBuffer); } } } } } // Just append the obfuscated name if we haven't found any matching // methods. if (extraIndent < 0) { outLine.append(obfuscatedMethodName); } }