Add serialVersionUID to generated classes that implement Serializable#811
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.
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.
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.
Ah yes, I removed the annotation. It is not really needed anyway
There was a problem hiding this comment.
Hi,
Is there any update on this issue?
There was a problem hiding this comment.
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.
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: