What algorithm does eclipse use to generate a validation identifier in the Serializable class?

Suppose here is my class:

class B implements Serializable {

    private static final long serialVersionUID = -5186261241138469827L; // what algo is used to generate this
     ..........
}

What algorithm serialVersionUID = -5186261241138469827Ldoes eclipse use to generate ?

+4
source share
2 answers

Eclipse implements the appropriate Java specification for computing the Serialization identifier.

In Eclipse, this is implemented by the calculateSerialVersionId method in org.eclipse.jdt.internal.ui.text.correction.SerialVersionHashOperation .

+1
source

Java object serialization specification docs , given that algo

32- SHA-1. , 32- H0 H1 H2 H3 H4, int sha, :

  long hash = ((sha[0] >>> 24) & 0xFF) |
              ((sha[0] >>> 16) & 0xFF) << 8 |
              ((sha[0] >>> 8) & 0xFF) << 16 |
              ((sha[0] >>> 0) & 0xFF) << 24 |
              ((sha[1] >>> 24) & 0xFF) << 32 |
              ((sha[1] >>> 16) & 0xFF) << 40 |
              ((sha[1] >>> 8) & 0xFF) << 48 |
              ((sha[1] >>> 0) & 0xFF) << 56;
+2

All Articles