Menu

#16 SUID field should not be obfuscated

open-invalid
obfuscator (18)
5
2001-10-24
2001-10-24
Anonymous
No

"private static long serialVersionUID" field is used to override the serialVersionUID automatically created for a given class upon compilation and is of utter importance during serialization/deserialization of classes.
It should never be obfuscated by default.

If you want to learn more about the serialVersionUID field please go to
http://developer.java.sun.com/developer/technicalArticles/Programming/serialization/

and look under the "Version Control" section

BTW:

Great job you did with Jode :-)
It is the best/most configurable obfuscator I've ever found.

Discussion

  • Jochen Hoenicke

    Jochen Hoenicke - 2001-10-24

    Logged In: YES
    user_id=18252

    There is a special class suitable to add to the preserve
    option, the SerializePreserver. It is used like this:

    preserve = new SerializePreserver,
    new Wildcard {...

    Besides preserving the serialVersionUID field it will also
    preserve all nontransient nonstatic fields, the field
    serialPersistentFieldst, the write/readObject methods and
    the name of the class for all classes that have a
    serialVersionUID.

    I will update the documentation so that this feature is
    mentioned.

     
  • Jochen Hoenicke

    Jochen Hoenicke - 2001-10-24
    • assigned_to: nobody --> hoenicke
    • status: open --> open-invalid
     
  • Nobody/Anonymous

    Logged In: NO

    hi

    I'm facing the same problem. The obfuscated class files are
    having different serialVersionUID values. I tried the
    suggestion given below by hoenicke.
    But it did not work.
    Please help.
    Thanx
    Seema

     
  • Jochen Hoenicke

    Jochen Hoenicke - 2001-12-13

    Logged In: YES
    user_id=18252

    You can check what the SerializePreserver does by looking
    for the lines "preserving: ..."

    It should preserve most fields and methods in classes that
    have a serializeVersionUID constant.

    If you also want to preserve serializable classes that
    don't have the serialVersionUID field set, you need to set
    the option all:
    preserve = new SerializePreserver { all="true" },
    new Wildcard...

     
  • Jochen Hoenicke

    Jochen Hoenicke - 2002-01-16

    Logged In: YES
    user_id=18252

    as anonymous pointed out, the option all="true" doesn't
    work. You need to to change SerializePreserver.java to
    implement OptionHandler (the methods are there, just the
    implements is missing), and change
    ClassIdentifier.isSerializable() to check for
    "java.io.Serializable".

     

Log in to post a comment.