diff options
| author | 2016-09-06 12:11:50 +0200 | |
|---|---|---|
| committer | 2016-09-06 12:11:50 +0200 | |
| commit | e0e3141619cecd54c087d964654e6c35511c48f9 (patch) | |
| tree | 9d7750f6abe26b4ca08cc9ffb516222569ebfd0b /src/main/java/cuchaz/enigma/bytecode/ClassRenamer.java | |
| parent | Avoid Engima converter detecting <init> and <clinit> as matchable token (diff) | |
| download | enigma-fork-e0e3141619cecd54c087d964654e6c35511c48f9.tar.gz enigma-fork-e0e3141619cecd54c087d964654e6c35511c48f9.tar.xz enigma-fork-e0e3141619cecd54c087d964654e6c35511c48f9.zip | |
A little bit of clean up
Diffstat (limited to 'src/main/java/cuchaz/enigma/bytecode/ClassRenamer.java')
| -rw-r--r-- | src/main/java/cuchaz/enigma/bytecode/ClassRenamer.java | 22 |
1 files changed, 9 insertions, 13 deletions
diff --git a/src/main/java/cuchaz/enigma/bytecode/ClassRenamer.java b/src/main/java/cuchaz/enigma/bytecode/ClassRenamer.java index c13aae4..eb7e9a1 100644 --- a/src/main/java/cuchaz/enigma/bytecode/ClassRenamer.java +++ b/src/main/java/cuchaz/enigma/bytecode/ClassRenamer.java | |||
| @@ -278,9 +278,8 @@ public class ClassRenamer { | |||
| 278 | } | 278 | } |
| 279 | } | 279 | } |
| 280 | 280 | ||
| 281 | private static ClassSignature renameType(ClassSignature type, ReplacerClassMap map) { | 281 | private static TypeParameter[] renameTypeParameter(TypeParameter[] typeParamTypes, ReplacerClassMap map) |
| 282 | 282 | { | |
| 283 | TypeParameter[] typeParamTypes = type.getParameters(); | ||
| 284 | if (typeParamTypes != null) { | 283 | if (typeParamTypes != null) { |
| 285 | typeParamTypes = Arrays.copyOf(typeParamTypes, typeParamTypes.length); | 284 | typeParamTypes = Arrays.copyOf(typeParamTypes, typeParamTypes.length); |
| 286 | for (int i = 0; i < typeParamTypes.length; i++) { | 285 | for (int i = 0; i < typeParamTypes.length; i++) { |
| @@ -290,6 +289,12 @@ public class ClassRenamer { | |||
| 290 | } | 289 | } |
| 291 | } | 290 | } |
| 292 | } | 291 | } |
| 292 | return typeParamTypes; | ||
| 293 | } | ||
| 294 | |||
| 295 | private static ClassSignature renameType(ClassSignature type, ReplacerClassMap map) { | ||
| 296 | |||
| 297 | TypeParameter[] typeParamTypes = renameTypeParameter(type.getParameters(), map); | ||
| 293 | 298 | ||
| 294 | ClassType superclassType = type.getSuperClass(); | 299 | ClassType superclassType = type.getSuperClass(); |
| 295 | if (superclassType != ClassType.OBJECT) { | 300 | if (superclassType != ClassType.OBJECT) { |
| @@ -315,16 +320,7 @@ public class ClassRenamer { | |||
| 315 | 320 | ||
| 316 | private static MethodSignature renameType(MethodSignature type, ReplacerClassMap map) { | 321 | private static MethodSignature renameType(MethodSignature type, ReplacerClassMap map) { |
| 317 | 322 | ||
| 318 | TypeParameter[] typeParamTypes = type.getTypeParameters(); | 323 | TypeParameter[] typeParamTypes = renameTypeParameter(type.getTypeParameters(), map); |
| 319 | if (typeParamTypes != null) { | ||
| 320 | typeParamTypes = Arrays.copyOf(typeParamTypes, typeParamTypes.length); | ||
| 321 | for (int i = 0; i < typeParamTypes.length; i++) { | ||
| 322 | TypeParameter newParamType = renameType(typeParamTypes[i], map); | ||
| 323 | if (newParamType != null) { | ||
| 324 | typeParamTypes[i] = newParamType; | ||
| 325 | } | ||
| 326 | } | ||
| 327 | } | ||
| 328 | 324 | ||
| 329 | Type[] paramTypes = type.getParameterTypes(); | 325 | Type[] paramTypes = type.getParameterTypes(); |
| 330 | if (paramTypes != null) { | 326 | if (paramTypes != null) { |