getIdentifier(ref)

putClassName


git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@585 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent a58ace28de
commit 4d71621216
  1. 49
      jode/jode/obfuscator/MethodIdentifier.java

@ -145,7 +145,7 @@ public class MethodIdentifier extends Identifier implements Opcodes {
} }
public void analyze() { public void analyze() {
if (Obfuscator.isDebugging) if (Obfuscator.verboseLevel > 1)
Obfuscator.err.println("Analyze: "+this); Obfuscator.err.println("Analyze: "+this);
String type = getType(); String type = getType();
@ -258,16 +258,14 @@ public class MethodIdentifier extends Identifier implements Opcodes {
case opc_invokeinterface: case opc_invokeinterface:
case opc_invokevirtual: { case opc_invokevirtual: {
Reference ref = (Reference) instr.objData; Reference ref = (Reference) instr.objData;
ClassIdentifier ci = (ClassIdentifier) MethodIdentifier mi = (MethodIdentifier)
clazz.bundle.getIdentifier(ref.getClazz()); clazz.bundle.getIdentifier(ref);
String newType = clazz.bundle.getTypeAlias(ref.getType()); String newType = clazz.bundle.getTypeAlias(ref.getType());
if (mi != null)
if (ci != null) {
MethodIdentifier mi = (MethodIdentifier)
ci.getIdentifier(ref.getName(), ref.getType());
instr.objData = new Reference instr.objData = new Reference
(ci.getFullAlias(), mi.getAlias(), newType); ("L"+mi.clazz.getFullAlias().replace('.','/')+';',
} else mi.getAlias(), newType);
else
instr.objData = new Reference instr.objData = new Reference
(ref.getClazz(), ref.getName(), newType); (ref.getClazz(), ref.getName(), newType);
break; break;
@ -278,13 +276,12 @@ public class MethodIdentifier extends Identifier implements Opcodes {
case opc_getfield: { case opc_getfield: {
Reference ref = (Reference) instr.objData; Reference ref = (Reference) instr.objData;
String newType = clazz.bundle.getTypeAlias(ref.getType()); String newType = clazz.bundle.getTypeAlias(ref.getType());
ClassIdentifier ci = (ClassIdentifier) FieldIdentifier fi = (FieldIdentifier)
clazz.bundle.getIdentifier(ref.getClazz()); clazz.bundle.getIdentifier(ref);
if (ci != null) { if (fi != null) {
FieldIdentifier fi = (FieldIdentifier)
ci.getIdentifier(ref.getName(), ref.getType());
instr.objData = new Reference instr.objData = new Reference
(ci.getFullAlias(), fi.getAlias(), newType); ("L"+fi.clazz.getFullAlias().replace('.','/')+';',
fi.getAlias(), newType);
} else } else
instr.objData = new Reference instr.objData = new Reference
(ref.getClazz(), ref.getName(), newType); (ref.getClazz(), ref.getName(), newType);
@ -292,19 +289,11 @@ public class MethodIdentifier extends Identifier implements Opcodes {
break; break;
} }
case opc_new: case opc_new:
case opc_anewarray:
case opc_checkcast: case opc_checkcast:
case opc_instanceof: case opc_instanceof:
case opc_multianewarray: { case opc_multianewarray: {
String clName = (String) instr.objData; String clName = (String) instr.objData;
if (clName.charAt(0) == '[') { clName = clazz.bundle.getTypeAlias(clName);
clName = clazz.bundle.getTypeAlias(clName);
} else {
ClassIdentifier ci = (ClassIdentifier)
clazz.bundle.getIdentifier(clName);
if (ci != null)
clName = ci.getFullAlias();
}
instr.objData = clName; instr.objData = clName;
break; break;
} }
@ -314,8 +303,8 @@ public class MethodIdentifier extends Identifier implements Opcodes {
Handler[] handlers = strippedBytecode.getExceptionHandlers(); Handler[] handlers = strippedBytecode.getExceptionHandlers();
for (int i=0; i< handlers.length; i++) { for (int i=0; i< handlers.length; i++) {
if (handlers[i].type != null) { if (handlers[i].type != null) {
ClassIdentifier ci = (ClassIdentifier) ClassIdentifier ci =
clazz.bundle.getIdentifier(handlers[i].type); clazz.bundle.getClassIdentifier(handlers[i].type);
if (ci != null) if (ci != null)
handlers[i].type = ci.getFullAlias(); handlers[i].type = ci.getFullAlias();
} }
@ -347,12 +336,12 @@ public class MethodIdentifier extends Identifier implements Opcodes {
exceptionsIndex = gcp.putUTF("Exceptions"); exceptionsIndex = gcp.putUTF("Exceptions");
excIndices = new int[exceptions.length]; excIndices = new int[exceptions.length];
for (int i=0; i< exceptions.length; i++) { for (int i=0; i< exceptions.length; i++) {
ClassIdentifier ci = (ClassIdentifier) ClassIdentifier ci =
clazz.bundle.getIdentifier(exceptions[i]); clazz.bundle.getClassIdentifier(exceptions[i]);
if (ci != null) if (ci != null)
excIndices[i] = gcp.putClassRef(ci.getFullAlias()); excIndices[i] = gcp.putClassName(ci.getFullAlias());
else else
excIndices[i] = gcp.putClassRef(exceptions[i]); excIndices[i] = gcp.putClassName(exceptions[i]);
} }
exceptions = null; exceptions = null;
} }

Loading…
Cancel
Save