We are preparing to move this Jira installation to codehaus. Please wait and don't use this version for some days.

The AndroMDA project

add default serialVersionUID to all serializable classes

Details

  • Type: Improvement Improvement
  • Status: Closed Closed
  • Priority: Trivial Trivial
  • Resolution: Fixed
  • Affects Version/s: None
  • Fix Version/s: None
  • Component/s: None
  • Labels:
    None

Description

I've got a lot of warnings regarding the lack of the serialVersionUID variable in serializable classes. If possible please add the default value in all generated serializable classes, like this:

private static final long serialVersionUID = 1L;

Issue Links

Activity

Hide
Wouter Zoons added a comment - 28/Oct/05 3:07 PM
which classes would that be ? ClassifierFacade has a serialVersionUID property you can call: http://galaxy.andromda.org/docs/andromda-metafacades-uml/apidocs/org/andromda/metafacades/uml/ClassifierFacade.html#getSerialVersionUID()
Show
Wouter Zoons added a comment - 28/Oct/05 3:07 PM which classes would that be ? ClassifierFacade has a serialVersionUID property you can call: http://galaxy.andromda.org/docs/andromda-metafacades-uml/apidocs/org/andromda/metafacades/uml/ClassifierFacade.html#getSerialVersionUID()
Hide
Chad Brandon added a comment - 28/Oct/05 3:09 PM
You can also turn off your compiler warnings (if that's what you're worried about).
Show
Chad Brandon added a comment - 28/Oct/05 3:09 PM You can also turn off your compiler warnings (if that's what you're worried about).
Hide
Chad Brandon added a comment - 28/Oct/05 3:11 PM
About that serialVersionUID on classifier facade (that really shouldn't even be in the UML metafacades, its to Java specific).
Show
Chad Brandon added a comment - 28/Oct/05 3:11 PM About that serialVersionUID on classifier facade (that really shouldn't even be in the UML metafacades, its to Java specific).
Hide
Walter Itamar Mourão added a comment - 28/Oct/05 3:21 PM
Sample classes with the warnings:
HibernateStringClobType, StrutsValidator, bpm4struts forms, bpm4struts controllers.

Really I just realize some other warnings in bpm4struts:
The local variable specificForm is never read
The local variable previousFormObject is never read

Of course I can turn the warning off in the compiler, but unfortunately my hand made code will not be checked too.
Show
Walter Itamar Mourão added a comment - 28/Oct/05 3:21 PM Sample classes with the warnings: HibernateStringClobType, StrutsValidator, bpm4struts forms, bpm4struts controllers. Really I just realize some other warnings in bpm4struts: The local variable specificForm is never read The local variable previousFormObject is never read Of course I can turn the warning off in the compiler, but unfortunately my hand made code will not be checked too.
Hide
Peter Friese added a comment - 28/Oct/05 11:31 PM
I once introduced the SUIDD stuff, because I needed it for Spring remoting. Of course, ClassifierFacade is a little too generic for this Java feature - back then I was looking for the most generic place to put this logic, to be honest.

Having the SUID on all serializable objects would satisfy the compiler, but one has to be careful: I am using a simplified algorithm to calculate the SUID and this algorithm does indeed return other results than the serial version generator of the JDK! In order to give users the chance to lock the SUID, I have introduced a tagged value (@andromda.serialVersionUID), so that you can define the SUID to be used.

Having the SUID in all serializable classes would be a clear plus in my point of view.
Show
Peter Friese added a comment - 28/Oct/05 11:31 PM I once introduced the SUIDD stuff, because I needed it for Spring remoting. Of course, ClassifierFacade is a little too generic for this Java feature - back then I was looking for the most generic place to put this logic, to be honest. Having the SUID on all serializable objects would satisfy the compiler, but one has to be careful: I am using a simplified algorithm to calculate the SUID and this algorithm does indeed return other results than the serial version generator of the JDK! In order to give users the chance to lock the SUID, I have introduced a tagged value (@andromda.serialVersionUID), so that you can define the SUID to be used. Having the SUID in all serializable classes would be a clear plus in my point of view.
Hide
Wouter Zoons added a comment - 05/Nov/05 4:02 PM
fixed these occurrences: HibernateStringClobType, StrutsValidator, bpm4struts forms, bpm4struts controllers.
for the former two the serial uid will need to be updated manually when those classes' signatures change
Show
Wouter Zoons added a comment - 05/Nov/05 4:02 PM fixed these occurrences: HibernateStringClobType, StrutsValidator, bpm4struts forms, bpm4struts controllers. for the former two the serial uid will need to be updated manually when those classes' signatures change

People

Vote (0)
Watch (1)

Dates

  • Created:
    28/Oct/05 2:26 PM
    Updated:
    13/Aug/11 10:41 AM
    Resolved:
    05/Nov/05 4:02 PM