Add @Serial annotation to all serialVersionUID fields.
- Enhance code readability and maintainability - Improve static analysis capabilities - Ensure proper declaration of serialVersionUID fields Closes #3584
This commit is contained in:
@@ -23,6 +23,8 @@ import com.querydsl.core.types.dsl.StringPath;
|
||||
|
||||
import static com.querydsl.core.types.PathMetadataFactory.forVariable;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* Query class for Country domain.
|
||||
*
|
||||
@@ -30,7 +32,7 @@ import static com.querydsl.core.types.PathMetadataFactory.forVariable;
|
||||
*/
|
||||
public class QCountry extends EntityPathBase<Country> {
|
||||
|
||||
private static final long serialVersionUID = -936338527;
|
||||
@Serial private static final long serialVersionUID = -936338527;
|
||||
|
||||
private static final PathInits INITS = PathInits.DIRECT2;
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.data.domain.Sort;
|
||||
import org.springframework.lang.Nullable;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
@@ -45,7 +46,7 @@ import java.util.List;
|
||||
*/
|
||||
public class JpaSort extends Sort {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
|
||||
private JpaSort(Direction direction, List<Path<?, ?>> paths) {
|
||||
this(Collections.<Order>emptyList(), direction, paths);
|
||||
@@ -322,7 +323,7 @@ public class JpaSort extends Sort {
|
||||
*/
|
||||
public static class JpaOrder extends Order {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
|
||||
private final boolean unsafe;
|
||||
|
||||
|
||||
@@ -21,6 +21,7 @@ import jakarta.persistence.criteria.CriteriaQuery;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Arrays;
|
||||
import java.util.stream.StreamSupport;
|
||||
@@ -41,7 +42,7 @@ import org.springframework.lang.Nullable;
|
||||
*/
|
||||
public interface Specification<T> extends Serializable {
|
||||
|
||||
long serialVersionUID = 1L;
|
||||
@Serial long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Negates the given {@link Specification}.
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.repository.query;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
/**
|
||||
* Signals that we encountered an invalid query method.
|
||||
*
|
||||
@@ -23,7 +25,7 @@ package org.springframework.data.jpa.repository.query;
|
||||
*/
|
||||
public class InvalidJpaQueryMethodException extends RuntimeException {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* Creates a new {@link InvalidJpaQueryMethodException} with the given message.
|
||||
|
||||
@@ -31,6 +31,7 @@ import jakarta.persistence.criteria.Path;
|
||||
import jakarta.persistence.criteria.Predicate;
|
||||
import jakarta.persistence.criteria.Root;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collection;
|
||||
import java.util.Collections;
|
||||
@@ -932,7 +933,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
@SuppressWarnings("rawtypes")
|
||||
private static final class ByIdsSpecification<T> implements Specification<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
|
||||
private final JpaEntityInformation<T, ?> entityInformation;
|
||||
|
||||
@@ -961,7 +962,7 @@ public class SimpleJpaRepository<T, ID> implements JpaRepositoryImplementation<T
|
||||
*/
|
||||
private static class ExampleSpecification<T> implements Specification<T> {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
|
||||
private final Example<T> example;
|
||||
private final EscapeCharacter escapeCharacter;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
|
||||
import org.springframework.data.jpa.domain.AbstractPersistable;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
@@ -25,7 +26,7 @@ import jakarta.persistence.Embeddable;
|
||||
*/
|
||||
@Embeddable
|
||||
public class EmbeddedIdExampleEmployeePK implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
|
||||
@Column(nullable = false) private Long employeeId;
|
||||
|
||||
|
||||
@@ -15,13 +15,14 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* @author Thomas Darimont
|
||||
*/
|
||||
public class IdClassExampleEmployeePK implements Serializable {
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
|
||||
private long empId;
|
||||
private long department;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class ItemId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -2986871112875450036L;
|
||||
@Serial private static final long serialVersionUID = -2986871112875450036L;
|
||||
|
||||
private Integer id;
|
||||
private Integer manufacturerId;
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class ItemSiteId implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1822540289216799357L;
|
||||
@Serial private static final long serialVersionUID = 1822540289216799357L;
|
||||
|
||||
private ItemId item;
|
||||
private Integer site;
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import static org.springframework.util.ObjectUtils.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -25,7 +26,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class PersistableWithIdClassPK implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 23126782341L;
|
||||
@Serial private static final long serialVersionUID = 23126782341L;
|
||||
|
||||
private Long first;
|
||||
private Long second;
|
||||
|
||||
@@ -17,6 +17,7 @@ package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import static org.springframework.util.ObjectUtils.*;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@@ -24,7 +25,7 @@ import java.io.Serializable;
|
||||
*/
|
||||
public class PersistableWithSingleIdClassPK implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 23126782341L;
|
||||
@Serial private static final long serialVersionUID = 23126782341L;
|
||||
|
||||
private Long first;
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
|
||||
import jakarta.persistence.Column;
|
||||
@@ -25,7 +26,7 @@ import org.springframework.util.Assert;
|
||||
@Embeddable
|
||||
public class SampleEntityPK implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 231060947L;
|
||||
@Serial private static final long serialVersionUID = 231060947L;
|
||||
|
||||
@Column(nullable = false)
|
||||
private String first;
|
||||
|
||||
@@ -15,6 +15,8 @@
|
||||
*/
|
||||
package org.springframework.data.jpa.domain.sample;
|
||||
|
||||
import java.io.Serial;
|
||||
|
||||
import jakarta.persistence.Entity;
|
||||
import jakarta.persistence.GeneratedValue;
|
||||
import jakarta.persistence.Id;
|
||||
@@ -31,7 +33,7 @@ import jakarta.persistence.Table;
|
||||
@Table
|
||||
public class Site implements java.io.Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@Serial private static final long serialVersionUID = 1L;
|
||||
|
||||
@Id @GeneratedValue Integer id;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user