deprecated flags for classinfo

git-svn-id: https://svn.code.sf.net/p/jode/code/branches/branch_1_1@1374 379699f6-c40d-0410-875b-85095c16579e
branch_1_1
hoenicke 22 years ago
parent f38c62b1cd
commit 97b5c5bb0f
  1. 11
      jode/ChangeLog
  2. 20
      jode/jode/bytecode/ClassInfo.java.in

@ -1,3 +1,14 @@
2002-11-24 Jochen Hoenicke <jochen@gnu.org>
* jode/bytecode/ClassInfo.java.in (deprecatedFlag): Added flag
for deprecated classes. Stuart Ballard noticed that this was
missing.
(readAttribute): Read deprecated attribute.
(prepareWriting): Prepare deprecated attribute.
(writeKnownAttributes): Write deprecated attribute.
(isDeprected): New function.
(setDeprecated): Likewise.
2002-06-11 Jochen Hoenicke <jochen@gnu.org> 2002-06-11 Jochen Hoenicke <jochen@gnu.org>
* configure.in: Set version number to 1.1.2. * configure.in: Set version number to 1.1.2.

@ -82,6 +82,7 @@ public class ClassInfo extends BinaryInfo {
private boolean modified = false; private boolean modified = false;
private int modifiers = -1; private int modifiers = -1;
private boolean deprecatedFlag;
private String name; private String name;
private ClassInfo superclass; private ClassInfo superclass;
private ClassInfo[] interfaces; private ClassInfo[] interfaces;
@ -272,6 +273,11 @@ public class ClassInfo extends BinaryInfo {
extraClasses[--extraCount] = ici; extraClasses[--extraCount] = ici;
} }
} }
} else if (name.equals("Deprecated")) {
deprecatedFlag = true;
if (length != 0)
throw new ClassFormatException
("Deprecated attribute has wrong length");
} else } else
super.readAttribute(name, length, cp, input, howMuch); super.readAttribute(name, length, cp, input, howMuch);
} }
@ -406,6 +412,8 @@ public class ClassInfo extends BinaryInfo {
gcp.putUTF8(extraClasses[i].name); gcp.putUTF8(extraClasses[i].name);
} }
} }
if (deprecatedFlag)
gcp.putUTF8("Deprecated");
prepareAttributes(gcp); prepareAttributes(gcp);
} }
@ -461,6 +469,10 @@ public class ClassInfo extends BinaryInfo {
output.writeShort(extraClasses[i].modifiers); output.writeShort(extraClasses[i].modifiers);
} }
} }
if (deprecatedFlag) {
output.writeShort(gcp.putUTF8("Deprecated"));
output.writeInt(0);
}
} }
public void write(DataOutputStream out) throws IOException { public void write(DataOutputStream out) throws IOException {
@ -749,6 +761,10 @@ public class ClassInfo extends BinaryInfo {
return Modifier.isInterface(getModifiers()); return Modifier.isInterface(getModifiers());
} }
public boolean isDeprecated() {
return deprecatedFlag;
}
public FieldInfo findField(String name, String typeSig) { public FieldInfo findField(String name, String typeSig) {
if ((status & FIELDS) == 0) if ((status & FIELDS) == 0)
loadInfo(FIELDS); loadInfo(FIELDS);
@ -823,6 +839,10 @@ public class ClassInfo extends BinaryInfo {
modified = true; modified = true;
} }
public void setDeprecated(boolean flag) {
deprecatedFlag = flag;
}
public void setMethods(MethodInfo[] mi) { public void setMethods(MethodInfo[] mi) {
methods = mi; methods = mi;
modified = true; modified = true;

Loading…
Cancel
Save