*** empty log message ***

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@121 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 27 years ago
parent 40f5786650
commit 68ab015b0d
  1. 27
      jode/jode/Decompiler.java
  2. 8
      jode/jode/decompiler/LocalInfo.java
  3. 10
      jode/jode/flow/StructuredBlock.java
  4. 4
      jode/jode/flow/TransformConstructors.java
  5. 10
      jode/jode/flow/VariableSet.java
  6. 4
      jode/jode/type/ArrayType.java
  7. 18
      jode/jode/type/ClassInterfacesType.java
  8. 7
      jode/jode/type/RangeType.java
  9. 25
      jode/jode/type/Type.java
  10. 11
      jode/jode/type/UnfoundClassType.java

@ -28,14 +28,15 @@ public class Decompiler {
public static boolean debugAnalyze = false;
public static boolean showLVT = false;
public static boolean doChecks = false;
public static boolean prettyLocals = false;
public static boolean immediateOutput = false;
public static int importPackageLimit = 3;
public static int importClassLimit = 3;
public static void usage() {
System.err.println("use: jode [-v][-imm][-debug][-analyze][-flow]"
+"[-type][-inout][-lvt][-check]"
+"[-import pkglimit clslimit]"
System.err.println("use: jode [-v][--imm][--debug][--analyze][--flow]"
+"[--type][--inout][--lvt][--check]"
+"[--import pkglimit clslimit]"
+" class1 [class2 ...]");
}
@ -45,23 +46,25 @@ public class Decompiler {
for (i=0; i<params.length && params[i].startsWith("-"); i++) {
if (params[i].equals("-v"))
isVerbose = true;
else if (params[i].equals("-imm"))
else if (params[i].equals("--imm"))
immediateOutput = true;
else if (params[i].equals("-debug"))
else if (params[i].equals("--debug"))
isDebugging = true;
else if (params[i].equals("-type"))
else if (params[i].equals("--type"))
isTypeDebugging = true;
else if (params[i].equals("-analyze"))
else if (params[i].equals("--analyze"))
debugAnalyze = true;
else if (params[i].equals("-flow"))
else if (params[i].equals("--flow"))
isFlowDebugging = true;
else if (params[i].equals("-inout"))
else if (params[i].equals("--inout"))
debugInOut = true;
else if (params[i].equals("-lvt"))
else if (params[i].equals("--lvt"))
showLVT = true;
else if (params[i].equals("-check"))
else if (params[i].equals("--check"))
doChecks = true;
else if (params[i].equals("-import")) {
else if (params[i].equals("--pretty"))
prettyLocals = true;
else if (params[i].equals("--import")) {
importPackageLimit = Integer.parseInt(params[++i]);
importClassLimit = Integer.parseInt(params[++i]);
} else if (params[i].equals("--")) {

@ -128,8 +128,12 @@ public class LocalInfo {
return shadow.getName();
}
if (name == null) {
name = "local_"+slot+"__"+serialnr+++"_";
isUnique = true;
if (jode.Decompiler.prettyLocals && type != null) {
name = type.getDefaultName();
} else {
name = "local_"+slot+"__"+serialnr+++"_";
isUnique = true;
}
}
return name;
}

@ -343,12 +343,14 @@ public abstract class StructuredBlock {
while (enum.hasMoreElements()) {
LocalInfo local = (LocalInfo) enum.nextElement();
LocalInfo previous = done.findLocal(local.getName());
if (previous == null)
declare.addElement(local);
else if (!previous.equals(local)) {
if (previous != null &&!previous.equals(local)) {
/* A name conflict happened. */
local.makeNameUnique();
declare.addElement(local);
/* try again. */
previous = done.findLocal(local.getName());
}
if (previous == null) {
declare.addElement(local);
}
}
done.unionExact(declare);

@ -78,7 +78,7 @@ public class TransformConstructors {
if (sb[i] instanceof SequentialBlock)
sb[i] = sb[i].getSubBlocks()[1];
else
sb[i] = new EmptyBlock();
sb[i] = null;
}
i++;
}
@ -151,6 +151,8 @@ public class TransformConstructors {
}
}
for (int i=0; i< constrCount; i++) {
if (start[i] == null)
continue;
if (sb[i] == null)
start[i].removeBlock();
else

@ -319,4 +319,14 @@ public class VariableSet implements Cloneable {
i++;
}
}
public String toString() {
StringBuffer result = new StringBuffer("[");
for (int i=0; i < count; i++) {
if (i>0)
result.append(", ");
result.append(locals[i].getName());
}
return result.append("]").toString();
}
}

@ -116,6 +116,10 @@ public class ArrayType extends Type {
return elementType.toString()+"[]";
}
public String getDefaultName() {
return "arr_"+elementType.getDefaultName();
}
public boolean equals(Object o) {
if (o == this)
return true;

@ -427,6 +427,24 @@ public class ClassInterfacesType extends Type {
return true;
}
public String getDefaultName() {
Class type;
if (clazz != null)
type = clazz;
else if (ifaces.length > 0)
type = ifaces[0];
else
type = cObject;
String name = type.getName();
int dot = name.lastIndexOf('.');
if (dot >= 0)
name = name.substring(dot+1);
if (Character.isUpperCase(name.charAt(0)))
return name.toLowerCase();
else
return name+"_var";
}
public boolean equals(Object o) {
if (o == this)
return true;

@ -98,6 +98,13 @@ public class RangeType extends Type {
return bottomType.toString();
}
public String getDefaultName() {
if (topType.isClassType() || bottomType == tUnknown)
return topType.getDefaultName();
else
return bottomType.getDefaultName();
}
public boolean equals(Object o) {
if (o instanceof RangeType) {
RangeType type = (RangeType) o;

@ -463,6 +463,31 @@ public class Type {
/* No action needed for simple types */
}
public String getDefaultName() {
switch (typecode) {
case TC_BOOLINT:
case TC_BOOLBYTE:
case TC_BOOLEAN:
return "bool";
case TC_BYTE:
return "i";
case TC_CHAR:
return "c";
case TC_SHORT:
return "i";
case TC_INT:
return "i";
case TC_LONG:
return "l";
case TC_FLOAT:
return "f";
case TC_DOUBLE:
return "d";
default:
return "local";
}
}
public String toString() {
switch (typecode) {
case TC_BOOLINT:

@ -106,6 +106,17 @@ public class UnfoundClassType extends Type {
return true;
}
public String getDefaultName() {
String name = clazzName;
int dot = name.lastIndexOf('.');
if (dot >= 0)
name = name.substring(dot+1);
if (Character.isUpperCase(name.charAt(0)))
return name.toLowerCase();
else
return name+"_var";
}
public boolean equals(Object o) {
return o == this
|| (o instanceof UnfoundClassType

Loading…
Cancel
Save