-
Notifications
You must be signed in to change notification settings - Fork 84
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Standardize serialVersionUID generation than random #264
Comments
Out of curiosity, why do you keep generated code in source control? |
This development scenario involves the same RAML being developed into multiple services - related, but disconnected. Client can consume multiple such services. If RAML file is being checked in to each such repository and generated code is built as a part of build process, it might lead to a case when one or few of the repos are out of sync. Thus, we maintain RAML and its documentation generated with raml2html in one repository, generated code is in a different repository and built artifacts pushed into the artifactory which is consumed as a maven dependency. |
Can you consider a PR? |
Will give it a try. |
I'm running into the same issue. Can't we simply skip writing the generated source file if only the |
It will be hard to detect if there are some other changes but |
If the class changes, so should the serialVersionUid. Vice versa, if the class does not have any changes, it should not be regenerated. I would suggest a bit of a "hacky" solution here:
|
That's a real "hacky" solution. |
I added the required code (see PR). Notes:
|
|
Actually it does, if you take a look at this stack overflow question: https://stackoverflow.com/questions/18294326/how-to-generate-serialversionuid-programmatically-in-java and this answer specifically https://stackoverflow.com/a/18294506/812272 However I have a feeling that the
For that reason I'd vote for removing the |
Still, some people prefer to have
Please consider a PR(s) if this makes sense for you. |
I have a project with multiple types and each time a minor change is made in the RAML and generate the code, all the POJOs get regenerated. Though the content of POJOs are same, it just comes up on the change list due to change in serialVersionUID forcing me to take an action - either commit or revert. It would be great if this can be handled by handing over the responsibility of serialVersionUID generation to standard Java packages rather than using a random long.
This can be done using the serialver command or objectStreamClass.getSerialVersionUID()
The text was updated successfully, but these errors were encountered: