public void rename() { try { buildInheritanceTree(); renameAllClasses(); renameInterfaces(); renameClasses(); context.reloadContext(); } catch (IOException ex) { throw new RuntimeException("Renaming failed!"); } }
private void renameClasses() { List<ClassWrapperNode> lstClasses = getReversePostOrderListIterative(rootClasses); Map<String, Map<String, String>> classNameMaps = new HashMap<>(); StructClass clintr = context.getClass(ifName); if (clintr != null) { names.putAll(processExternalInterface(clintr)); renameClassIdentifiers(cl, names);
public void decompileContext() { if (converter != null) { converter.rename(); } classProcessor.loadClasses(helper); structContext.saveContext(); }
private void renameAllClasses() { // order not important List<ClassWrapperNode> lstAllClasses = new ArrayList<>(getReversePostOrderListIterative(rootInterfaces)); lstAllClasses.addAll(getReversePostOrderListIterative(rootClasses)); // rename all interfaces and classes for (ClassWrapperNode node : lstAllClasses) { renameClass(node.getClassStruct()); } }
private Map<String, String> processExternalInterface(StructClass cl) { Map<String, String> names = new HashMap<>(); for (String ifName : cl.getInterfaceNames()) { Map<String, String> mapInt = interfaceNameMaps.get(ifName); if (mapInt != null) { names.putAll(mapInt); } else { StructClass clintr = context.getClass(ifName); if (clintr != null) { names.putAll(processExternalInterface(clintr)); } } } renameClassIdentifiers(cl, names); return names; }
private void renameInterfaces() { List<ClassWrapperNode> lstInterfaces = getReversePostOrderListIterative(rootInterfaces); Map<String, Map<String, String>> interfaceNameMaps = new HashMap<>(); // rename methods and fields for (ClassWrapperNode node : lstInterfaces) { StructClass cl = node.getClassStruct(); Map<String, String> names = new HashMap<>(); // merge information on super interfaces for (String ifName : cl.getInterfaceNames()) { Map<String, String> mapInt = interfaceNameMaps.get(ifName); if (mapInt != null) { names.putAll(mapInt); } } renameClassIdentifiers(cl, names); interfaceNameMaps.put(cl.qualifiedName, names); } this.interfaceNameMaps = interfaceNameMaps; }
public void decompileContext() { if (DecompilerContext.getOption(IFernflowerPreferences.RENAME_ENTITIES)) { new IdentifierConverter().rename(structContext); } classesProcessor = new ClassesProcessor(structContext); DecompilerContext.setClassProcessor(classesProcessor); DecompilerContext.setStructContext(structContext); structContext.saveContext(); }
classNewFullName + " " + name + " " + buildNewDescriptor(false, mt.getDescriptor())); classNewFullName + " " + newName + " " + buildNewDescriptor(true, fd.getDescriptor()));
public Fernflower(IBytecodeProvider provider, IResultSaver saver, Map<String, Object> customProperties, IFernflowerLogger logger) { Map<String, Object> properties = new HashMap<>(IFernflowerPreferences.DEFAULTS); if (customProperties != null) { properties.putAll(customProperties); } String level = (String)properties.get(IFernflowerPreferences.LOG_LEVEL); if (level != null) { try { logger.setSeverity(IFernflowerLogger.Severity.valueOf(level.toUpperCase(Locale.US))); } catch (IllegalArgumentException ignore) { } } structContext = new StructContext(saver, this, new LazyLoader(provider)); classProcessor = new ClassesProcessor(structContext); PoolInterceptor interceptor = null; if ("1".equals(properties.get(IFernflowerPreferences.RENAME_ENTITIES))) { helper = loadHelper((String)properties.get(IFernflowerPreferences.USER_RENAMER_CLASS), logger); interceptor = new PoolInterceptor(); converter = new IdentifierConverter(structContext, helper, interceptor); } else { helper = null; converter = null; } DecompilerContext context = new DecompilerContext(properties, logger, structContext, classProcessor, interceptor); DecompilerContext.setCurrentContext(context); }
private void renameAllClasses() { // order not important List<ClassWrapperNode> lstAllClasses = new ArrayList<>(getReversePostOrderListIterative(rootInterfaces)); lstAllClasses.addAll(getReversePostOrderListIterative(rootClasses)); // rename all interfaces and classes for (ClassWrapperNode node : lstAllClasses) { renameClass(node.getClassStruct()); } }
private Map<String, String> processExternalInterface(StructClass cl) { Map<String, String> names = new HashMap<>(); for (String ifName : cl.getInterfaceNames()) { Map<String, String> mapInt = interfaceNameMaps.get(ifName); if (mapInt != null) { names.putAll(mapInt); } else { StructClass clintr = context.getClass(ifName); if (clintr != null) { names.putAll(processExternalInterface(clintr)); } } } renameClassIdentifiers(cl, names); return names; }
private void renameInterfaces() { List<ClassWrapperNode> lstInterfaces = getReversePostOrderListIterative(rootInterfaces); Map<String, Map<String, String>> interfaceNameMaps = new HashMap<>(); // rename methods and fields for (ClassWrapperNode node : lstInterfaces) { StructClass cl = node.getClassStruct(); Map<String, String> names = new HashMap<>(); // merge information on super interfaces for (String ifName : cl.getInterfaceNames()) { Map<String, String> mapInt = interfaceNameMaps.get(ifName); if (mapInt != null) { names.putAll(mapInt); } } renameClassIdentifiers(cl, names); interfaceNameMaps.put(cl.qualifiedName, names); } this.interfaceNameMaps = interfaceNameMaps; }
classNewFullName + " " + name + " " + buildNewDescriptor(false, mt.getDescriptor())); classNewFullName + " " + newName + " " + buildNewDescriptor(true, fd.getDescriptor()));
public void rename(StructContext context) { try { this.context = context; String user_class = (String)DecompilerContext.getProperty(IFernflowerPreferences.USER_RENAMER_CLASS); if (user_class != null) { try { helper = (IIdentifierRenamer)IdentifierConverter.class.getClassLoader().loadClass(user_class).newInstance(); } catch (Exception ignored) { } } if (helper == null) { helper = new ConverterHelper(); } interceptor = new PoolInterceptor(helper); buildInheritanceTree(); renameAllClasses(); renameInterfaces(); renameClasses(); DecompilerContext.setPoolInterceptor(interceptor); context.reloadContext(); } catch (IOException ex) { throw new RuntimeException("Renaming failed!"); } }
private void renameClasses() { List<ClassWrapperNode> lstClasses = getReversePostOrderListIterative(rootClasses); Map<String, Map<String, String>> classNameMaps = new HashMap<>(); StructClass clintr = context.getClass(ifName); if (clintr != null) { names.putAll(processExternalInterface(clintr)); renameClassIdentifiers(cl, names);