diff --git a/spring-data-jpa/pom.xml b/spring-data-jpa/pom.xml
index 13f0b1117..b6470bdc8 100644
--- a/spring-data-jpa/pom.xml
+++ b/spring-data-jpa/pom.xml
@@ -343,7 +343,7 @@
org.apache.maven.plugins
maven-compiler-plugin
-
+
com.querydsl
querydsl-apt
@@ -424,130 +424,4 @@
-
-
- all-dbs
-
-
-
- org.apache.maven.plugins
- maven-surefire-plugin
-
-
- mysql-test
- test
-
- test
-
-
-
- **/MySql*IntegrationTests.java
-
-
-
-
- postgres-test
- test
-
- test
-
-
-
- **/Postgres*IntegrationTests.java
-
-
-
-
-
-
-
-
-
-
-
-
-
- nullaway
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
-
-
-
- com.querydsl
- querydsl-apt
- ${querydsl}
- jakarta
-
-
- org.hibernate.orm
- hibernate-jpamodelgen
- ${hibernate}
-
-
- org.hibernate.orm
- hibernate-core
- ${hibernate}
-
-
- org.openjdk.jmh
- jmh-generator-annprocess
- ${jmh}
-
-
- jakarta.persistence
- jakarta.persistence-api
- ${jakarta-persistence-api}
-
-
- com.google.errorprone
- error_prone_core
- ${errorprone}
-
-
- com.uber.nullaway
- nullaway
- ${nullaway}
-
-
-
-
-
- default-compile
- none
-
-
- default-testCompile
- none
-
-
- java-compile
- compile
-
- compile
-
-
-
- -XDcompilePolicy=simple
- --should-stop=ifError=FLOW
- -Xplugin:ErrorProne -XepDisableAllChecks -Xep:NullAway:ERROR -XepOpt:NullAway:OnlyNullMarked=true -XepOpt:NullAway:TreatGeneratedAsUnannotated=true -XepOpt:NullAway:CustomContractAnnotations=org.springframework.lang.Contract
-
-
-
-
- java-test-compile
- test-compile
-
- testCompile
-
-
-
-
-
-
-
-
-
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/Specification.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/Specification.java
index f0c782d7a..b9994b79a 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/Specification.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/Specification.java
@@ -25,9 +25,9 @@ import java.io.Serializable;
import java.util.Arrays;
import java.util.stream.StreamSupport;
-import org.springframework.lang.CheckReturnValue;
-
import org.jspecify.annotations.Nullable;
+
+import org.springframework.lang.CheckReturnValue;
import org.springframework.lang.Contract;
import org.springframework.util.Assert;
@@ -232,6 +232,6 @@ public interface Specification extends Serializable {
* @return a {@link Predicate}, may be {@literal null}.
*/
@Nullable
- Predicate toPredicate(Root root, @Nullable CriteriaQuery> query, CriteriaBuilder criteriaBuilder);
+ Predicate toPredicate(Root root, CriteriaQuery> query, CriteriaBuilder criteriaBuilder);
}
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/SpecificationComposition.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/SpecificationComposition.java
index 5600b40f5..0c73627ba 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/SpecificationComposition.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/domain/SpecificationComposition.java
@@ -61,7 +61,7 @@ class SpecificationComposition {
}
private static @Nullable Predicate toPredicate(@Nullable Specification specification, Root root,
- @Nullable CriteriaQuery> query, CriteriaBuilder builder) {
+ CriteriaQuery> query, CriteriaBuilder builder) {
return specification == null ? null : specification.toPredicate(root, query, builder);
}
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigExtension.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigExtension.java
index 6366a8d5d..32b867080 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigExtension.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/config/JpaRepositoryConfigExtension.java
@@ -33,9 +33,9 @@ import java.util.Map;
import java.util.Optional;
import java.util.Set;
-import org.springframework.aot.generate.GenerationContext;
-
import org.jspecify.annotations.Nullable;
+
+import org.springframework.aot.generate.GenerationContext;
import org.springframework.beans.factory.aot.BeanRegistrationAotProcessor;
import org.springframework.beans.factory.config.BeanDefinition;
import org.springframework.beans.factory.support.AbstractBeanDefinition;
@@ -117,7 +117,7 @@ public class JpaRepositoryConfigExtension extends RepositoryConfigurationExtensi
Optional transactionManagerRef = source.getAttribute("transactionManagerRef");
builder.addPropertyValue("transactionManager", transactionManagerRef.orElse(DEFAULT_TRANSACTION_MANAGER_BEAN_NAME));
- if(entityManagerRefs.containsKey(source)) {
+ if (entityManagerRefs.containsKey(source)) {
builder.addPropertyReference("entityManager", entityManagerRefs.get(source));
}
builder.addPropertyValue(ESCAPE_CHARACTER_PROPERTY, getEscapeCharacter(source).orElse('\\'));
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java
index 6e9b672f9..141d61b5f 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JSqlParserQueryEnhancer.java
@@ -38,7 +38,6 @@ import net.sf.jsqlparser.statement.select.SelectItem;
import net.sf.jsqlparser.statement.select.SetOperationList;
import net.sf.jsqlparser.statement.select.Values;
import net.sf.jsqlparser.statement.update.Update;
-import org.jspecify.annotations.Nullable;
import java.io.ByteArrayInputStream;
import java.io.IOException;
@@ -52,6 +51,8 @@ import java.util.StringJoiner;
import java.util.function.Predicate;
import java.util.function.Supplier;
+import org.jspecify.annotations.Nullable;
+
import org.springframework.data.domain.Sort;
import org.springframework.data.util.Predicates;
import org.springframework.util.Assert;
@@ -81,7 +82,7 @@ public class JSqlParserQueryEnhancer implements QueryEnhancer {
private final String projection;
private final Set joinAliases;
private final Set selectAliases;
- private final byte @Nullable[] serialized;
+ private final byte @Nullable [] serialized;
/**
* @param query the query we want to enhance. Must not be {@literal null}.
@@ -98,7 +99,7 @@ public class JSqlParserQueryEnhancer implements QueryEnhancer {
this.selectAliases = Collections.unmodifiableSet(getSelectionAliases(this.statement));
this.joinAliases = Collections.unmodifiableSet(getJoinAliases(this.statement));
byte[] tmp = SerializationUtils.serialize(this.statement);
-// this.serialized = tmp != null ? tmp : new byte[0];
+ // this.serialized = tmp != null ? tmp : new byte[0];
this.serialized = SerializationUtils.serialize(this.statement);
}
@@ -374,7 +375,7 @@ public class JSqlParserQueryEnhancer implements QueryEnhancer {
return applySortingToSetOperationList(setOperationList, sort);
}
- doWithPlainSelect(selectStatement, it -> {
+ doWithPlainSelect (selectStatement , it -> {
List orderByElements = new ArrayList<>(16);
for (Sort.Order order : sort) {
@@ -572,8 +573,8 @@ public class JSqlParserQueryEnhancer implements QueryEnhancer {
* @param bytes a serialized object
* @return the result of deserializing the bytes
*/
- private static @Nullable Object deserialize(byte @Nullable[] bytes) {
- if(ObjectUtils.isEmpty(bytes)) {
+ private static @Nullable Object deserialize(byte @Nullable [] bytes) {
+ if (ObjectUtils.isEmpty(bytes)) {
return null;
}
try (ObjectInputStream ois = new ObjectInputStream(new ByteArrayInputStream(bytes))) {
@@ -585,9 +586,9 @@ public class JSqlParserQueryEnhancer implements QueryEnhancer {
}
}
- private static T deserializeRequired(byte @Nullable[] bytes, Class type) {
+ private static T deserializeRequired(byte @Nullable [] bytes, Class type) {
Object deserialize = deserialize(bytes);
- if(deserialize != null) {
+ if (deserialize != null) {
return type.cast(deserialize);
}
throw new IllegalStateException("Failed to deserialize object type");
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlCountQueryTransformer.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlCountQueryTransformer.java
index 480ec3426..6318d8acf 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlCountQueryTransformer.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlCountQueryTransformer.java
@@ -17,9 +17,9 @@ package org.springframework.data.jpa.repository.query;
import static org.springframework.data.jpa.repository.query.QueryTokens.*;
-import org.springframework.data.jpa.repository.query.QueryRenderer.QueryRendererBuilder;
-
import org.jspecify.annotations.Nullable;
+
+import org.springframework.data.jpa.repository.query.QueryRenderer.QueryRendererBuilder;
import org.springframework.data.jpa.repository.query.QueryTransformers.CountSelectionTokenStream;
import org.springframework.util.StringUtils;
@@ -82,7 +82,7 @@ class JpqlCountQueryTransformer extends JpqlQueryRenderer {
if (usesDistinct) {
nested.append(QueryTokens.expression(ctx.DISTINCT()));
nested.append(getDistinctCountSelection(QueryTokenStream.concat(ctx.select_item(), this::visit, TOKEN_COMMA)));
- } else if(StringUtils.hasText(primaryFromAlias)) {
+ } else if (StringUtils.hasText(primaryFromAlias)) {
nested.append(QueryTokens.token(primaryFromAlias));
} else {
throw new IllegalStateException("No primary alias present");
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlUtils.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlUtils.java
index f3e20a1d6..298b09591 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlUtils.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/JpqlUtils.java
@@ -25,23 +25,25 @@ import jakarta.persistence.metamodel.PluralAttribute;
import java.util.Objects;
-import org.springframework.data.mapping.PropertyPath;
-
import org.jspecify.annotations.Nullable;
+
+import org.springframework.data.mapping.PropertyPath;
import org.springframework.util.StringUtils;
/**
+ * Utilities to create JPQL expressions, derived from {@link QueryUtils}.
+ *
* @author Mark Paluch
*/
class JpqlUtils {
- static JpqlQueryBuilder.PathExpression toExpressionRecursively(@Nullable Metamodel metamodel, JpqlQueryBuilder.Origin source,
- Bindable> from, PropertyPath property) {
+ static JpqlQueryBuilder.PathExpression toExpressionRecursively(@Nullable Metamodel metamodel,
+ JpqlQueryBuilder.Origin source, Bindable> from, PropertyPath property) {
return toExpressionRecursively(metamodel, source, from, property, false);
}
- static JpqlQueryBuilder.PathExpression toExpressionRecursively(@Nullable Metamodel metamodel, JpqlQueryBuilder.Origin source,
- Bindable> from, PropertyPath property, boolean isForSelection) {
+ static JpqlQueryBuilder.PathExpression toExpressionRecursively(@Nullable Metamodel metamodel,
+ JpqlQueryBuilder.Origin source, Bindable> from, PropertyPath property, boolean isForSelection) {
return toExpressionRecursively(metamodel, source, from, property, isForSelection, false);
}
@@ -54,8 +56,9 @@ class JpqlUtils {
* @param hasRequiredOuterJoin has a parent already required an outer join?
* @return the expression
*/
- static JpqlQueryBuilder.PathExpression toExpressionRecursively(@Nullable Metamodel metamodel, JpqlQueryBuilder.Origin source,
- Bindable> from, PropertyPath property, boolean isForSelection, boolean hasRequiredOuterJoin) {
+ static JpqlQueryBuilder.PathExpression toExpressionRecursively(@Nullable Metamodel metamodel,
+ JpqlQueryBuilder.Origin source, Bindable> from, PropertyPath property, boolean isForSelection,
+ boolean hasRequiredOuterJoin) {
String segment = property.getSegment();
@@ -81,7 +84,7 @@ class JpqlUtils {
ManagedType> managedTypeForModel = QueryUtils.getManagedTypeForModel(from);
Attribute, ?> nextAttribute = getModelForPath(metamodel, property, managedTypeForModel, from);
- if(nextAttribute == null) {
+ if (nextAttribute == null) {
throw new IllegalStateException("Binding property is null");
}
@@ -144,7 +147,7 @@ class JpqlUtils {
}
}
- if(metamodel != null) {
+ if (metamodel != null) {
Class> fallbackType = fallback.getBindableJavaType();
try {
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/KeysetScrollSpecification.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/KeysetScrollSpecification.java
index f39505222..504658726 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/KeysetScrollSpecification.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/KeysetScrollSpecification.java
@@ -26,9 +26,9 @@ import jakarta.persistence.metamodel.Metamodel;
import java.util.List;
-import org.springframework.data.domain.KeysetScrollPosition;
-
import org.jspecify.annotations.Nullable;
+
+import org.springframework.data.domain.KeysetScrollPosition;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
import org.springframework.data.jpa.domain.Specification;
@@ -68,7 +68,8 @@ public record KeysetScrollSpecification(KeysetScrollPosition position, Sort s
}
@Override
- public @Nullable Predicate toPredicate(Root root, @Nullable CriteriaQuery> query, CriteriaBuilder criteriaBuilder) {
+ public @Nullable Predicate toPredicate(Root root, @Nullable CriteriaQuery> query,
+ CriteriaBuilder criteriaBuilder) {
return createPredicate(root, criteriaBuilder);
}
@@ -78,7 +79,6 @@ public record KeysetScrollSpecification(KeysetScrollPosition position, Sort s
return delegate.createPredicate(position, sort, new CriteriaBuilderStrategy(root, criteriaBuilder));
}
-
public JpqlQueryBuilder.@Nullable Predicate createJpqlPredicate(Bindable> from, JpqlQueryBuilder.Entity entity,
ParameterFactory factory) {
@@ -108,9 +108,9 @@ public record KeysetScrollSpecification(KeysetScrollPosition position, Sort s
@Override
public Predicate compare(Order order, Expression propertyExpression, @Nullable Object value) {
- if(value instanceof Comparable compareValue) {
+ if (value instanceof Comparable compareValue) {
return order.isAscending() ? cb.greaterThan(propertyExpression, compareValue)
- : cb.lessThan(propertyExpression, compareValue);
+ : cb.lessThan(propertyExpression, compareValue);
}
return order.isAscending() ? cb.isNull(propertyExpression) : cb.isNotNull(propertyExpression);
@@ -139,12 +139,13 @@ public record KeysetScrollSpecification(KeysetScrollPosition position, Sort s
private final ParameterFactory factory;
private final @Nullable Metamodel metamodel;
- public JpqlStrategy(@Nullable Metamodel metamodel, Bindable> from, JpqlQueryBuilder.Entity entity, ParameterFactory factory) {
+ public JpqlStrategy(@Nullable Metamodel metamodel, Bindable> from, JpqlQueryBuilder.Entity entity,
+ ParameterFactory factory) {
this.from = from;
this.entity = entity;
this.factory = factory;
- this.metamodel = metamodel;
+ this.metamodel = metamodel;
}
@Override
@@ -159,7 +160,7 @@ public record KeysetScrollSpecification(KeysetScrollPosition position, Sort s
@Nullable Object value) {
JpqlQueryBuilder.WhereStep where = JpqlQueryBuilder.where(propertyExpression);
- if(value == null) {
+ if (value == null) {
return order.isAscending() ? where.isNull() : where.isNotNull();
}
return order.isAscending() ? where.gt(factory.capture(value)) : where.lt(factory.capture(value));
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java
index 9b931a34e..41c572731 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/query/QueryUtils.java
@@ -46,9 +46,9 @@ import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
-import org.springframework.core.annotation.AnnotationUtils;
-
import org.jspecify.annotations.Nullable;
+
+import org.springframework.core.annotation.AnnotationUtils;
import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.domain.Sort;
import org.springframework.data.domain.Sort.Order;
@@ -875,7 +875,7 @@ public abstract class QueryUtils {
}
Annotation annotation = AnnotationUtils.getAnnotation(annotatedMember, associationAnnotation);
- if(annotation == null) {
+ if (annotation == null) {
return defaultValue;
}
diff --git a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/EntityGraphFactory.java b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/EntityGraphFactory.java
index 6a63a8260..266bd3e00 100644
--- a/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/EntityGraphFactory.java
+++ b/spring-data-jpa/src/main/java/org/springframework/data/jpa/repository/support/EntityGraphFactory.java
@@ -62,11 +62,13 @@ abstract class EntityGraphFactory {
if (path.hasNext()) {
- if(current == null) {
- current = existingSubgraphs.computeIfAbsent(currentFullPath, k -> entityGraph.addSubgraph(path.getSegment()));
+ if (current == null) {
+ current = existingSubgraphs.computeIfAbsent(currentFullPath,
+ k -> entityGraph.addSubgraph(path.getSegment()));
} else {
final Subgraph