new lvt handling, dumpStack on type errors

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@667 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent 247a51ba66
commit 5e56bf9770
  1. 31
      jode/jode/decompiler/LocalInfo.java

@ -39,11 +39,13 @@ public class LocalInfo {
private static int serialnr = 0;
private static int nextAnonymousSlot = -1;
private int slot;
private boolean nameIsGenerated;
private boolean isUnique;
private String name;
private Type type;
private LocalInfo shadow;
private Vector operators = new Vector();
private Vector hints = new Vector();
/**
* Create a new local info with an anonymous slot.
@ -68,6 +70,10 @@ public class LocalInfo {
getLocalInfo().operators.addElement(operator);
}
public void addHint(LocalVarEntry entry) {
getLocalInfo().hints.addElement(entry);
}
public int getUseCount() {
return getLocalInfo().operators.size();
}
@ -106,6 +112,13 @@ public class LocalInfo {
shadow.operators.addElement(lvo);
}
enum = hints.elements();
while (enum.hasMoreElements()) {
Object entry = enum.nextElement();
if (!shadow.hints.contains(entry))
shadow.hints.addElement(entry);
}
/* Clear unused fields, to allow garbage collection.
*/
type = null;
@ -147,6 +160,16 @@ public class LocalInfo {
return shadow.getName();
}
if (name == null) {
Enumeration enum = hints.elements();
while (enum.hasMoreElements()) {
LocalVarEntry entry = (LocalVarEntry) enum.nextElement();
if (type.isOfType(entry.getType())) {
name = entry.getName();
type = entry.getType();
return name;
}
}
nameIsGenerated = true;
if (jode.Decompiler.prettyLocals && type != null) {
name = type.getHint().getDefaultName();
} else {
@ -158,6 +181,10 @@ public class LocalInfo {
return name;
}
public boolean isNameGenerated() {
return nameIsGenerated;
}
/**
* Get the slot of this local.
*/
@ -203,9 +230,11 @@ public class LocalInfo {
LocalInfo li = getLocalInfo();
Type newType = li.type.intersection(otherType);
if (newType == Type.tError
&& otherType != Type.tError && li.type != Type.tError)
&& otherType != Type.tError && li.type != Type.tError) {
Decompiler.err.println("Type error in local " + getName()+": "
+ li.type + " and " + otherType);
Thread.dumpStack();
}
else if (Decompiler.isTypeDebugging)
Decompiler.err.println(getName()+" setType, new: "+newType
+ " old: "+li.type);

Loading…
Cancel
Save