Fixed calculation of SerialVersionUID

git-svn-id: https://svn.code.sf.net/p/jode/code/trunk@1254 379699f6-c40d-0410-875b-85095c16579e
master
hoenicke 24 years ago
parent 96ef935ccc
commit 34081d2e06
  1. 19
      jode/jode/bytecode/ClassInfo.java

@ -1332,10 +1332,10 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
if (status < DECLARATIONS)
throw new IllegalStateException("status is "+status);
FieldInfo fi = findField("serialVersionUID", "J");
if (fi != null && fi.getConstant() != null)
/* We don't check for static final: if it has a constant it
* must be static final.
*/
if (fi != null
&& ((fi.getModifiers() & (Modifier.STATIC | Modifier.FINAL))
== (Modifier.STATIC | Modifier.FINAL))
&& fi.getConstant() != null)
return ((Long) fi.getConstant()).longValue();
final MessageDigest md = MessageDigest.getInstance("SHA");
@ -1378,19 +1378,24 @@ public final class ClassInfo extends BinaryInfo implements Comparable {
out.writeUTF(fields[i].getType());
}
FieldInfo[] methods = (FieldInfo[]) this.methods.clone();
MethodInfo[] methods = (MethodInfo[]) this.methods.clone();
Arrays.sort(methods);
for (int i=0; i < methods.length; i++) {
modifs = methods[i].getModifiers();
/* The modifiers of <clinit> should be just static,
* but jikes also marks it final.
*/
if (methods[i].getName().equals("<clinit>"))
modifs = Modifier.STATIC;
if ((modifs & Modifier.PRIVATE) != 0)
continue;
out.writeUTF(methods[i].getName());
out.writeInt(modifs);
// the replacement of '/' with '.' was needed to make computed
// SUID's agree with those computed by JDK.
// the replacement of '/' with '.' was needed to make
// computed SUID's agree with those computed by JDK.
out.writeUTF(methods[i].getType().replace('/', '.'));
}

Loading…
Cancel
Save