-
-
Notifications
You must be signed in to change notification settings - Fork 114
Add serialVersionUID to generated classes that implement Serializable #811
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
Conversation
|
@rolevinks please change target branch to develop |
|
@kobylynskyi Yes, sorry! Target branch is now develop |
| public class ${className} implements java.io.Serializable<#if implements?has_content><#list implements as interface>, ${interface}<#if interface_has_next></#if></#list></#if> { | ||
|
|
||
| @java.io.Serial | ||
| private static final long serialVersionUID = 1L; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
welcome to create pr.
I only have one questions.
- The library is based on 1.8, and the annotation comes from Java 11.
So It is not appropriate to introduce this annotation directly. With configuration, placeholders can be more generic for compatibility with Java 1.8 and other languages.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://docs.oracle.com/en/java/javase/14/docs/api/java.base/java/io/Serial.html
Add: officially introduced in the Java 14.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes, I removed the annotation. It is not really needed anyway
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi,
Is there any update on this issue?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe we can check the JDK version in the template.
<#assign MapperUtil=statics["com.kobylynskyi.graphql.codegen.java.Utils"]>
and <# if checkJdk /> ? @kobylynskyi
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need that annotation anyway.
Sorry for a long delay in reply!
This pull request adds a serialVersionUID to the java template type.ftl. This prevent warnings from for example the maven-compiler-plugin, that are raised when a class that implements Serializable does not has a serialVersionUID field.
Related to #810
Changes were made to: