From 4d71621216e653c2371cb6fbcd59abd06f37130b Mon Sep 17 00:00:00 2001 From: jochen Date: Tue, 13 Apr 1999 10:48:52 +0000 Subject: [PATCH] getIdentifier(ref) putClassName git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@585 379699f6-c40d-0410-875b-85095c16579e --- jode/jode/obfuscator/MethodIdentifier.java | 49 +++++++++------------- 1 file changed, 19 insertions(+), 30 deletions(-) diff --git a/jode/jode/obfuscator/MethodIdentifier.java b/jode/jode/obfuscator/MethodIdentifier.java index df9bf14..936c97d 100644 --- a/jode/jode/obfuscator/MethodIdentifier.java +++ b/jode/jode/obfuscator/MethodIdentifier.java @@ -145,7 +145,7 @@ public class MethodIdentifier extends Identifier implements Opcodes { } public void analyze() { - if (Obfuscator.isDebugging) + if (Obfuscator.verboseLevel > 1) Obfuscator.err.println("Analyze: "+this); String type = getType(); @@ -258,16 +258,14 @@ public class MethodIdentifier extends Identifier implements Opcodes { case opc_invokeinterface: case opc_invokevirtual: { Reference ref = (Reference) instr.objData; - ClassIdentifier ci = (ClassIdentifier) - clazz.bundle.getIdentifier(ref.getClazz()); + MethodIdentifier mi = (MethodIdentifier) + clazz.bundle.getIdentifier(ref); String newType = clazz.bundle.getTypeAlias(ref.getType()); - - if (ci != null) { - MethodIdentifier mi = (MethodIdentifier) - ci.getIdentifier(ref.getName(), ref.getType()); + if (mi != null) instr.objData = new Reference - (ci.getFullAlias(), mi.getAlias(), newType); - } else + ("L"+mi.clazz.getFullAlias().replace('.','/')+';', + mi.getAlias(), newType); + else instr.objData = new Reference (ref.getClazz(), ref.getName(), newType); break; @@ -278,13 +276,12 @@ public class MethodIdentifier extends Identifier implements Opcodes { case opc_getfield: { Reference ref = (Reference) instr.objData; String newType = clazz.bundle.getTypeAlias(ref.getType()); - ClassIdentifier ci = (ClassIdentifier) - clazz.bundle.getIdentifier(ref.getClazz()); - if (ci != null) { - FieldIdentifier fi = (FieldIdentifier) - ci.getIdentifier(ref.getName(), ref.getType()); + FieldIdentifier fi = (FieldIdentifier) + clazz.bundle.getIdentifier(ref); + if (fi != null) { instr.objData = new Reference - (ci.getFullAlias(), fi.getAlias(), newType); + ("L"+fi.clazz.getFullAlias().replace('.','/')+';', + fi.getAlias(), newType); } else instr.objData = new Reference (ref.getClazz(), ref.getName(), newType); @@ -292,19 +289,11 @@ public class MethodIdentifier extends Identifier implements Opcodes { break; } case opc_new: - case opc_anewarray: case opc_checkcast: case opc_instanceof: case opc_multianewarray: { String clName = (String) instr.objData; - if (clName.charAt(0) == '[') { - clName = clazz.bundle.getTypeAlias(clName); - } else { - ClassIdentifier ci = (ClassIdentifier) - clazz.bundle.getIdentifier(clName); - if (ci != null) - clName = ci.getFullAlias(); - } + clName = clazz.bundle.getTypeAlias(clName); instr.objData = clName; break; } @@ -314,8 +303,8 @@ public class MethodIdentifier extends Identifier implements Opcodes { Handler[] handlers = strippedBytecode.getExceptionHandlers(); for (int i=0; i< handlers.length; i++) { if (handlers[i].type != null) { - ClassIdentifier ci = (ClassIdentifier) - clazz.bundle.getIdentifier(handlers[i].type); + ClassIdentifier ci = + clazz.bundle.getClassIdentifier(handlers[i].type); if (ci != null) handlers[i].type = ci.getFullAlias(); } @@ -347,12 +336,12 @@ public class MethodIdentifier extends Identifier implements Opcodes { exceptionsIndex = gcp.putUTF("Exceptions"); excIndices = new int[exceptions.length]; for (int i=0; i< exceptions.length; i++) { - ClassIdentifier ci = (ClassIdentifier) - clazz.bundle.getIdentifier(exceptions[i]); + ClassIdentifier ci = + clazz.bundle.getClassIdentifier(exceptions[i]); if (ci != null) - excIndices[i] = gcp.putClassRef(ci.getFullAlias()); + excIndices[i] = gcp.putClassName(ci.getFullAlias()); else - excIndices[i] = gcp.putClassRef(exceptions[i]); + excIndices[i] = gcp.putClassName(exceptions[i]); } exceptions = null; }