void (StructClass cl, Map<String, String> names) { // all classes are already renamed String classOldFullName = cl.qualifiedName; String classNewFullName = interceptor.getName(classOldFullName); if (classNewFullName == null) { classNewFullName = classOldFullName; } // methods HashSet<String> setMethodNames = new HashSet<>(); for (StructMethod md : cl.getMethods()) { setMethodNames.add(md.getName()); } VBStyleCollection<StructMethod, String> methods = cl.getMethods(); for (int i = 0; i < methods.size(); i++) { StructMethod mt = methods.get(i); String key = methods.getKey(i); boolean isPrivate = mt.hasModifier(CodeConstants.ACC_PRIVATE); String name = mt.getName(); if (!cl.isOwn() || mt.hasModifier(CodeConstants.ACC_NATIVE)) { // external and native methods must not be renamed if (!isPrivate) { names.put(key, name); } } else if (helper.toBeRenamed(IIdentifierRenamer.Type.ELEMENT_METHOD, classOldFullName, name, mt.getDescriptor())) { if (isPrivate || !names.containsKey(key)) { do { name = helper.getNextMethodName(classOldFullName, name, mt.getDescriptor()); } while (setMethodNames.contains(name)); if (!isPrivate) { names.put(key, name); } } else { name = names.get(key); } interceptor.addName(classOldFullName + " " + mt.getName() + " " + mt.getDescriptor(), classNewFullName + " " + name + " " + buildNewDescriptor(false, mt.getDescriptor())); } } // external fields are not being renamed if (!cl.isOwn()) { return; } // fields // FIXME: should overloaded fields become the same name? HashSet<String> setFieldNames = new HashSet<>(); for (StructField fd : cl.getFields()) { setFieldNames.add(fd.getName()); } for (StructField fd : cl.getFields()) { if (helper.toBeRenamed(IIdentifierRenamer.Type.ELEMENT_FIELD, classOldFullName, fd.getName(), fd.getDescriptor())) { String newName; do { newName = helper.getNextFieldName(classOldFullName, fd.getName(), fd.getDescriptor()); } while (setFieldNames.contains(newName)); interceptor.addName(classOldFullName + " " + fd.getName() + " " + fd.getDescriptor(), classNewFullName + " " + newName + " " + buildNewDescriptor(true, fd.getDescriptor())); } } }