don't allow loading infos for a modified class

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@971 379699f6-c40d-0410-875b-85095c16579e
stable
jochen 26 years ago
parent f5749c46ea
commit e194a2c0ea
  1. 33
      jode/jode/bytecode/ClassInfo.java

@ -52,6 +52,8 @@ public class ClassInfo extends BinaryInfo {
private int status = 0; private int status = 0;
private boolean modified = false;
private int modifiers = -1; private int modifiers = -1;
private String name; private String name;
private ClassInfo superclass; private ClassInfo superclass;
@ -89,7 +91,7 @@ public class ClassInfo extends BinaryInfo {
ci.fields = null; ci.fields = null;
ci.interfaces = null; ci.interfaces = null;
ci.methods = null; ci.methods = null;
ci.unknownAttributes = null; ci.removeAllAttributes();
} }
} }
@ -125,6 +127,7 @@ public class ClassInfo extends BinaryInfo {
|| name.indexOf('[') != -1 || name.indexOf('[') != -1
|| name.indexOf('/') != -1) || name.indexOf('/') != -1)
throw new IllegalArgumentException("Illegal class name: "+name); throw new IllegalArgumentException("Illegal class name: "+name);
///#ifdef JDK12 ///#ifdef JDK12
/// java.lang.ref.Reference died; /// java.lang.ref.Reference died;
/// while ((died = queue.poll()) != null) { /// while ((died = queue.poll()) != null) {
@ -528,6 +531,16 @@ public class ClassInfo extends BinaryInfo {
} }
public void loadInfo(int howMuch) { public void loadInfo(int howMuch) {
if ((status & howMuch) == howMuch)
return;
if (modified) {
System.err.println("Allocating info 0x"
+ Integer.toHexString(howMuch)
+ " (status 0x" + Integer.toHexString(status)
+ ") in class " + this);
Thread.dumpStack();
return;
}
try { try {
DataInputStream input = DataInputStream input =
new DataInputStream(classpath.getFile(name.replace('.', '/') new DataInputStream(classpath.getFile(name.replace('.', '/')
@ -679,40 +692,58 @@ public class ClassInfo extends BinaryInfo {
return extraClasses; return extraClasses;
} }
public String getSourceFile() {
return sourceFile;
}
public void setName(String newName) { public void setName(String newName) {
name = newName; name = newName;
modified = true;
} }
public void setSuperclass(ClassInfo newSuper) { public void setSuperclass(ClassInfo newSuper) {
superclass = newSuper; superclass = newSuper;
modified = true;
} }
public void setInterfaces(ClassInfo[] newIfaces) { public void setInterfaces(ClassInfo[] newIfaces) {
interfaces = newIfaces; interfaces = newIfaces;
modified = true;
} }
public void setModifiers(int newModifiers) { public void setModifiers(int newModifiers) {
modifiers = newModifiers; modifiers = newModifiers;
modified = true;
} }
public void setMethods(MethodInfo[] mi) { public void setMethods(MethodInfo[] mi) {
methods = mi; methods = mi;
modified = true;
} }
public void setFields(FieldInfo[] fi) { public void setFields(FieldInfo[] fi) {
fields = fi; fields = fi;
modified = true;
} }
public void setOuterClasses(InnerClassInfo[] oc) { public void setOuterClasses(InnerClassInfo[] oc) {
outerClasses = oc; outerClasses = oc;
modified = true;
} }
public void setInnerClasses(InnerClassInfo[] ic) { public void setInnerClasses(InnerClassInfo[] ic) {
innerClasses = ic; innerClasses = ic;
modified = true;
} }
public void setExtraClasses(InnerClassInfo[] ec) { public void setExtraClasses(InnerClassInfo[] ec) {
extraClasses = ec; extraClasses = ec;
modified = true;
}
public void setSourceFile(String newSource) {
sourceFile = newSource;
modified = true;
} }
public boolean superClassOf(ClassInfo son) { public boolean superClassOf(ClassInfo son) {

Loading…
Cancel
Save