diff --git a/src/main/java/com/reandroid/dex/key/TypeKey.java b/src/main/java/com/reandroid/dex/key/TypeKey.java index 9a9deacd5..39423c9c1 100644 --- a/src/main/java/com/reandroid/dex/key/TypeKey.java +++ b/src/main/java/com/reandroid/dex/key/TypeKey.java @@ -241,6 +241,8 @@ public int compareInnerFirst(TypeKey other) { if(diff > 0 && name1.charAt(diff) == '$' && diff > name1.lastIndexOf('/') + 1){ return CompareUtil.compare(name2, name1); } + name1 = this.getTypeName(); + name2 = other.getTypeName(); return CompareUtil.compare(name1, name2); } @Override diff --git a/src/main/java/com/reandroid/dex/refactor/RenameTypes.java b/src/main/java/com/reandroid/dex/refactor/RenameTypes.java index 739f9b508..03f186cf9 100644 --- a/src/main/java/com/reandroid/dex/refactor/RenameTypes.java +++ b/src/main/java/com/reandroid/dex/refactor/RenameTypes.java @@ -50,11 +50,10 @@ public int apply(DexClassRepository classRepository) { while (iterator.hasNext()){ StringId stringId = iterator.next(); String text = map.get(stringId.getString()); - if(text == null){ - continue; + if(text != null){ + stringId.setString(text); + count ++; } - stringId.setString(text); - count ++; } return count; } @@ -83,7 +82,7 @@ private Map buildMap() { int estimatedSize = 1; if(renameSignatures){ - estimatedSize = estimatedSize + 1; + estimatedSize = estimatedSize + 2; } if(renameSource){ estimatedSize = estimatedSize + 1; @@ -109,14 +108,26 @@ private Map buildMap() { map.put(name1, name2); if(renameSignatures){ + name1 = first.getTypeName(); + name2 = second.getTypeName(); + name1 = name1.replace(';', '<'); name2 = name2.replace(';', '<'); + + map.put(name1, name2); + + name1 = first.getTypeName(); + name2 = second.getTypeName(); + + name1 = name1.substring(0, name1.length() - 1); + name2 = name2.substring(0, name2.length() - 1); + map.put(name1, name2); } for(int j = 1; j < arrayDepth; j++){ name1 = first.getArrayType(j); - name2 = first.getArrayType(j); + name2 = second.getArrayType(j); map.put(name1, name2); if(renameSignatures && j == 1){ name1 = name1.replace(';', '<');