diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/package-info.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/package-info.java index 272125bbe2..798e688cbe 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/package-info.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/config/xml/package-info.java @@ -1,4 +1,5 @@ /** * Provides parser classes to provide Xml namespace support for the Jpa components. */ +@org.jspecify.annotations.NullMarked package org.springframework.integration.jpa.config.xml; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/AbstractJpaOperations.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/AbstractJpaOperations.java index b5a19e1a9c..8d691f584e 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/AbstractJpaOperations.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/AbstractJpaOperations.java @@ -16,8 +16,11 @@ package org.springframework.integration.jpa.core; +import java.util.Objects; + import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; +import org.jspecify.annotations.Nullable; import org.springframework.beans.factory.InitializingBean; import org.springframework.orm.jpa.SharedEntityManagerCreator; @@ -32,9 +35,9 @@ */ abstract class AbstractJpaOperations implements JpaOperations, InitializingBean { - private EntityManager entityManager; + private @Nullable EntityManager entityManager; - private EntityManagerFactory entityManagerFactory; + private @Nullable EntityManagerFactory entityManagerFactory; public void setEntityManager(EntityManager entityManager) { Assert.notNull(entityManager, "The provided entityManager must not be null."); @@ -42,7 +45,7 @@ public void setEntityManager(EntityManager entityManager) { } protected EntityManager getEntityManager() { - return this.entityManager; + return Objects.requireNonNull(this.entityManager); } public void setEntityManagerFactory(EntityManagerFactory entityManagerFactory) { @@ -72,7 +75,7 @@ protected void onInit() { @Override public void flush() { - this.entityManager.flush(); + Objects.requireNonNull(this.entityManager).flush(); } } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java index 76e29354ee..830da0fc68 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/DefaultJpaOperations.java @@ -25,12 +25,12 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.Parameter; import jakarta.persistence.Query; +import org.jspecify.annotations.Nullable; import org.springframework.core.log.LogAccessor; import org.springframework.integration.jpa.support.JpaUtils; import org.springframework.integration.jpa.support.parametersource.ParameterSource; import org.springframework.integration.jpa.support.parametersource.PositionSupportingParameterSource; -import org.springframework.lang.Nullable; import org.springframework.util.Assert; import org.springframework.util.StringUtils; @@ -74,7 +74,7 @@ public void deleteInBatch(Iterable entities) { } } } - + Assert.state(entityClass != null, "'entityClass' must not be null"); EntityManager entityManager = getEntityManager(); final String entityName = JpaUtils.getEntityName(entityManager, entityClass); final String queryString = JpaUtils.getQueryString(JpaUtils.DELETE_ALL_QUERY_STRING, entityName); @@ -85,21 +85,21 @@ public void deleteInBatch(Iterable entities) { } @Override - public int executeUpdate(String updateQuery, ParameterSource source) { + public int executeUpdate(String updateQuery, @Nullable ParameterSource source) { Query query = getEntityManager().createQuery(updateQuery); setParametersIfRequired(updateQuery, source, query); return query.executeUpdate(); } @Override - public int executeUpdateWithNamedQuery(String updateQuery, ParameterSource source) { + public int executeUpdateWithNamedQuery(String updateQuery, @Nullable ParameterSource source) { Query query = getEntityManager().createNamedQuery(updateQuery); setParametersIfRequired(updateQuery, source, query); return query.executeUpdate(); } @Override - public int executeUpdateWithNativeQuery(String updateQuery, ParameterSource source) { + public int executeUpdateWithNativeQuery(String updateQuery, @Nullable ParameterSource source) { Query query = getEntityManager().createNativeQuery(updateQuery); setParametersIfRequired(updateQuery, source, query); return query.executeUpdate(); @@ -110,7 +110,7 @@ public T find(Class entityType, Object id) { return getEntityManager().find(entityType, id); } - private Query getQuery(String queryString, ParameterSource source) { + private Query getQuery(String queryString, @Nullable ParameterSource source) { Query query = getEntityManager().createQuery(queryString); setParametersIfRequired(queryString, source, query); return query; @@ -134,7 +134,7 @@ public List getResultListForClass(Class entityClass, int firstResult, int @Override public List getResultListForNamedQuery(String selectNamedQuery, - ParameterSource parameterSource, int firstResult, int maxNumberOfResults) { + @Nullable ParameterSource parameterSource, int firstResult, int maxNumberOfResults) { final Query query = getEntityManager().createNamedQuery(selectNamedQuery); setParametersIfRequired(selectNamedQuery, parameterSource, query); @@ -152,7 +152,7 @@ public List getResultListForNamedQuery(String selectNamedQuery, @Override public List getResultListForNativeQuery(String selectQuery, @Nullable Class entityClass, - ParameterSource parameterSource, int firstResult, int maxNumberOfResults) { + @Nullable ParameterSource parameterSource, int firstResult, int maxNumberOfResults) { final Query query; @@ -181,7 +181,7 @@ public List getResultListForQuery(String query, ParameterSource source) { } @Override - public List getResultListForQuery(String queryString, ParameterSource source, + public List getResultListForQuery(String queryString, @Nullable ParameterSource source, int firstResult, int maxNumberOfResults) { Query query = getQuery(queryString, source); @@ -266,7 +266,7 @@ private Object persistOrMergeIterable(Object entity, boolean isMerge, int flushS List mergedEntities = new ArrayList<>(); EntityManager entityManager = getEntityManager(); - for (Object iteratedEntity : entities) { + for (@Nullable Object iteratedEntity : entities) { if (iteratedEntity == null) { nullEntities.incrementAndGet(); } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java index 6930aa1719..e9fc1fd3a8 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaExecutor.java @@ -20,6 +20,7 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.EntityManagerFactory; +import org.jspecify.annotations.Nullable; import org.springframework.beans.BeansException; import org.springframework.beans.factory.BeanFactory; @@ -35,7 +36,6 @@ import org.springframework.integration.jpa.support.parametersource.ExpressionEvaluatingParameterSourceFactory; import org.springframework.integration.jpa.support.parametersource.ParameterSource; import org.springframework.integration.jpa.support.parametersource.ParameterSourceFactory; -import org.springframework.lang.Nullable; import org.springframework.messaging.Message; import org.springframework.messaging.MessagingException; import org.springframework.util.Assert; @@ -71,27 +71,27 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { private final JpaOperations jpaOperations; - private List jpaParameters; + private @Nullable List jpaParameters; - private Class entityClass; + private @Nullable Class entityClass; - private String jpaQuery; + private @Nullable String jpaQuery; - private String nativeQuery; + private @Nullable String nativeQuery; - private String namedQuery; + private @Nullable String namedQuery; - private Expression maxResultsExpression; + private @Nullable Expression maxResultsExpression; - private Expression firstResultExpression; + private @Nullable Expression firstResultExpression; - private Expression idExpression; + private @Nullable Expression idExpression; private PersistMode persistMode = PersistMode.MERGE; - private ParameterSourceFactory parameterSourceFactory = null; + private @Nullable ParameterSourceFactory parameterSourceFactory = null; - private ParameterSource parameterSource; + private @Nullable ParameterSource parameterSource; private boolean flush = false; @@ -111,10 +111,12 @@ public class JpaExecutor implements InitializingBean, BeanFactoryAware { * default a {@link BeanPropertyParameterSourceFactory} implementation is * used for the sqlParameterSourceFactory property. */ - private Boolean usePayloadAsParameterSource = null; + private @Nullable Boolean usePayloadAsParameterSource = null; + @SuppressWarnings("NullAway.Init") private BeanFactory beanFactory; + @SuppressWarnings("NullAway.Init") private EvaluationContext evaluationContext; /** @@ -157,6 +159,10 @@ public JpaExecutor(JpaOperations jpaOperations) { this.jpaOperations = jpaOperations; } + /** + * @deprecated in favor of the one obtained from the application context. + */ + @Deprecated(since = "7.0", forRemoval = true) public void setIntegrationEvaluationContext(EvaluationContext evaluationContext) { this.evaluationContext = evaluationContext; } @@ -398,10 +404,7 @@ public void afterPropertiesSet() { else if (this.flush) { this.flushSize = 1; } - - if (this.evaluationContext == null) { - this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.beanFactory); - } + this.evaluationContext = ExpressionUtils.createStandardEvaluationContext(this.beanFactory); } /** @@ -414,7 +417,7 @@ else if (this.flush) { * @return Either the number of affected entities when using a JPQL query. * When using a merge/persist the updated/inserted itself is returned. */ - public Object executeOutboundJpaOperation(Message message) { + public @Nullable Object executeOutboundJpaOperation(Message message) { ParameterSource paramSource = null; if (this.jpaQuery != null || this.nativeQuery != null || this.namedQuery != null) { paramSource = determineParameterSource(message); @@ -433,7 +436,7 @@ else if (this.namedQuery != null) { } } - private Object executeOutboundJpaOperationOnPersistentMode(Message message) { + private @Nullable Object executeOutboundJpaOperationOnPersistentMode(Message message) { Object payload = message.getPayload(); switch (this.persistMode) { case PERSIST -> { @@ -511,8 +514,9 @@ public Object poll(@Nullable final Message requestMessage) { payload = result.iterator().next(); } else { - throw new MessagingException(requestMessage, // NOSONAR - "The Jpa operation returned more than 1 result for expectSingleResult mode."); + String description = "The Jpa operation returned more than 1 result for expectSingleResult mode."; + throw requestMessage == null ? new MessagingException(description) + : new MessagingException(requestMessage, description); } } else { @@ -546,7 +550,7 @@ private void checkDelete(@Nullable Object payload) { } } - protected List doPoll(ParameterSource jpaQLParameterSource, int firstResult, int maxNumberOfResults) { + protected List doPoll(@Nullable ParameterSource jpaQLParameterSource, int firstResult, int maxNumberOfResults) { List payload; if (this.jpaQuery != null) { payload = @@ -609,7 +613,8 @@ else if (evaluationResult instanceof String) { } private ParameterSource determineParameterSource(final Message requestMessage) { - if (this.usePayloadAsParameterSource) { + Assert.state(this.parameterSourceFactory != null, "'parameterSourceFactory' must not be null"); + if (Boolean.TRUE.equals(this.usePayloadAsParameterSource)) { return this.parameterSourceFactory.createParameterSource(requestMessage.getPayload()); } else { diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaOperations.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaOperations.java index 7621acc9ad..3708a1e8cf 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaOperations.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/JpaOperations.java @@ -18,8 +18,9 @@ import java.util.List; +import org.jspecify.annotations.Nullable; + import org.springframework.integration.jpa.support.parametersource.ParameterSource; -import org.springframework.lang.Nullable; /** * The Interface containing all the JpaOperations those will be executed by @@ -51,10 +52,10 @@ public interface JpaOperations { * Executes the given update statement and uses the given parameter source to * set the required query parameters. * @param updateQuery Must Not be empty. - * @param source Must Not be null. + * @param source Can be null. * @return The number of entities updated */ - int executeUpdate(String updateQuery, ParameterSource source); + int executeUpdate(String updateQuery, @Nullable ParameterSource source); /** * @@ -62,7 +63,7 @@ public interface JpaOperations { * @param source The parameter source. * @return The number of entities updated. */ - int executeUpdateWithNamedQuery(String updateQuery, ParameterSource source); + int executeUpdateWithNamedQuery(String updateQuery, @Nullable ParameterSource source); /** * @@ -70,7 +71,7 @@ public interface JpaOperations { * @param source The parameter source. * @return The number of entities updated */ - int executeUpdateWithNativeQuery(String updateQuery, ParameterSource source); + int executeUpdateWithNativeQuery(String updateQuery, @Nullable ParameterSource source); /** * Find an Entity of given type with the given primary key type. @@ -100,7 +101,7 @@ List getResultListForClass(Class entityClass, * @param maxNumberOfResults The number of objects to return. * @return The list of found entities. */ - List getResultListForNamedQuery(String selectNamedQuery, ParameterSource jpaQLParameterSource, + List getResultListForNamedQuery(String selectNamedQuery, @Nullable ParameterSource jpaQLParameterSource, int firstResult, int maxNumberOfResults); @@ -115,7 +116,7 @@ List getResultListForNamedQuery(String selectNamedQuery, ParameterSource jpaQ */ List getResultListForNativeQuery(String selectQuery, @Nullable Class entityClass, - ParameterSource jpaQLParameterSource, + @Nullable ParameterSource jpaQLParameterSource, int firstResult, int maxNumberOfResults); @@ -135,7 +136,8 @@ List getResultListForNativeQuery(String selectQuery, * @param source the Parameter source for this query to be executed, if none then set null. * @return The list of found entities. */ - List getResultListForQuery(String query, ParameterSource source, int firstResult, int maxNumberOfResults); + List getResultListForQuery(String query, @Nullable ParameterSource source, int firstResult, + int maxNumberOfResults); /** * Execute the provided query to return a single element. @@ -155,7 +157,7 @@ List getResultListForNativeQuery(String selectQuery, * @param entity Must not be null. * @return The merged managed instance of the entity. */ - Object merge(Object entity); + @Nullable Object merge(Object entity); /** * The entity to be merged with the {@link jakarta.persistence.EntityManager}. @@ -174,7 +176,7 @@ List getResultListForNativeQuery(String selectQuery, * @return The merged object. */ - Object merge(Object entity, int flushSize, boolean clearOnFlush); + @Nullable Object merge(Object entity, int flushSize, boolean clearOnFlush); /** * Persists the entity. The provided object can also be an {@link Iterable} diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/package-info.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/package-info.java index 67b7215137..4b2749b754 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/package-info.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/core/package-info.java @@ -1,5 +1,5 @@ /** * Provides core classes of the JPA module. */ -@org.springframework.lang.NonNullApi +@org.jspecify.annotations.NullMarked package org.springframework.integration.jpa.core; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/package-info.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/package-info.java index 0c03315749..8cb4944aec 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/package-info.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/dsl/package-info.java @@ -1,6 +1,5 @@ /** * Provides JPA Components support for Java DSL. */ -@org.springframework.lang.NonNullApi -@org.springframework.lang.NonNullFields +@org.jspecify.annotations.NullMarked package org.springframework.integration.jpa.dsl; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapter.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapter.java index 6b641f4e07..2ef05c1f5b 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapter.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/JpaPollingChannelAdapter.java @@ -16,6 +16,8 @@ package org.springframework.integration.jpa.inbound; +import org.jspecify.annotations.Nullable; + import org.springframework.integration.endpoint.AbstractMessageSource; import org.springframework.integration.jpa.core.JpaExecutor; import org.springframework.util.Assert; @@ -76,7 +78,7 @@ protected void onInit() { * no reason to emit an empty message from this message source. */ @Override - protected Object doReceive() { + protected @Nullable Object doReceive() { Object result = this.jpaExecutor.poll(); return ObjectUtils.isEmpty(result) ? null : result; } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/package-info.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/package-info.java index 878e0a1833..2a34cbec45 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/package-info.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/inbound/package-info.java @@ -1,4 +1,5 @@ /** * Provides inbound Spring Integration Jpa components. */ +@org.jspecify.annotations.NullMarked package org.springframework.integration.jpa.inbound; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGateway.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGateway.java index 39bb67a9b8..6fcf400b2d 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGateway.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGateway.java @@ -16,6 +16,8 @@ package org.springframework.integration.jpa.outbound; +import org.jspecify.annotations.Nullable; + import org.springframework.integration.handler.AbstractReplyProducingMessageHandler; import org.springframework.integration.jpa.core.JpaExecutor; import org.springframework.integration.jpa.support.OutboundGatewayType; @@ -69,7 +71,7 @@ public String getComponentType() { } @Override - protected Object handleRequestMessage(Message requestMessage) { + protected @Nullable Object handleRequestMessage(Message requestMessage) { final Object result; if (OutboundGatewayType.RETRIEVING.equals(this.gatewayType)) { result = this.jpaExecutor.poll(requestMessage); diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayFactoryBean.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayFactoryBean.java index ac8b0c46ca..dd6a8c586a 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayFactoryBean.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/JpaOutboundGatewayFactoryBean.java @@ -16,10 +16,12 @@ package org.springframework.integration.jpa.outbound; +import org.jspecify.annotations.Nullable; + import org.springframework.integration.config.AbstractSimpleMessageHandlerFactoryBean; import org.springframework.integration.jpa.core.JpaExecutor; import org.springframework.integration.jpa.support.OutboundGatewayType; -import org.springframework.lang.Nullable; +import org.springframework.util.Assert; /** * The {@link JpaOutboundGatewayFactoryBean} creates instances of the @@ -38,7 +40,7 @@ */ public class JpaOutboundGatewayFactoryBean extends AbstractSimpleMessageHandlerFactoryBean { - private JpaExecutor jpaExecutor; + private @Nullable JpaExecutor jpaExecutor; private OutboundGatewayType gatewayType = OutboundGatewayType.UPDATING; @@ -77,6 +79,7 @@ public void setRequiresReply(boolean requiresReply) { @Override protected JpaOutboundGateway createHandler() { + Assert.state(this.jpaExecutor != null, "'jpaExecutor' must not be null"); JpaOutboundGateway jpaOutboundGateway = new JpaOutboundGateway(this.jpaExecutor); jpaOutboundGateway.setGatewayType(this.gatewayType); jpaOutboundGateway.setProducesReply(this.producesReply); diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/package-info.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/package-info.java index f384362c2d..0d00879e4d 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/package-info.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/outbound/package-info.java @@ -1,4 +1,5 @@ /** * Provides Spring Integration components for doing outbound operations. */ +@org.jspecify.annotations.NullMarked package org.springframework.integration.jpa.outbound; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/package-info.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/package-info.java index 2f6ad82524..fdb71ea859 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/package-info.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/package-info.java @@ -1,4 +1,5 @@ /** * Root package of the JPA Module. */ +@org.jspecify.annotations.NullMarked package org.springframework.integration.jpa; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java index 8f5af84e95..89a9dab9e5 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaParameter.java @@ -16,10 +16,11 @@ package org.springframework.integration.jpa.support; +import org.jspecify.annotations.Nullable; + import org.springframework.expression.Expression; import org.springframework.expression.ExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser; -import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** @@ -37,15 +38,15 @@ public class JpaParameter { private static final ExpressionParser PARSER = new SpelExpressionParser(); - private String name; + private @Nullable String name; - private Object value; + private @Nullable Object value; - private String expression; + private @Nullable String expression; - private Expression spelExpression; + private @Nullable Expression spelExpression; - private Expression projectionExpression; + private @Nullable Expression projectionExpression; /** * Default constructor. @@ -77,7 +78,7 @@ public JpaParameter(@Nullable Object value, @Nullable String expression) { setExpression(expression); } - public String getName() { + public @Nullable String getName() { return this.name; } diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaUtils.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaUtils.java index 7766bf050e..434d6b329e 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaUtils.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/JpaUtils.java @@ -22,6 +22,7 @@ import jakarta.persistence.EntityManager; import jakarta.persistence.Query; +import org.jspecify.annotations.Nullable; import org.springframework.util.Assert; @@ -84,7 +85,7 @@ private JpaUtils() { * @return The alias, or null. * */ - public static String detectAlias(String query) { + public static @Nullable String detectAlias(String query) { Matcher matcher = ALIAS_MATCH.matcher(query); diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/package-info.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/package-info.java index 8d5eeba52e..de551e4a04 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/package-info.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/package-info.java @@ -1,4 +1,5 @@ /** * Provides various support classes used across Spring Integration Jpa Components. */ +@org.jspecify.annotations.NullMarked package org.springframework.integration.jpa.support; diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceFactory.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceFactory.java index b43c44c342..d6212888e4 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceFactory.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceFactory.java @@ -24,13 +24,13 @@ import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; +import org.jspecify.annotations.Nullable; import org.springframework.beans.factory.BeanFactory; import org.springframework.expression.Expression; import org.springframework.expression.ExpressionException; import org.springframework.integration.jpa.support.JpaParameter; import org.springframework.integration.jpa.support.parametersource.ExpressionEvaluatingParameterSourceUtils.ParameterExpressionEvaluator; -import org.springframework.lang.Nullable; import org.springframework.util.Assert; /** diff --git a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceUtils.java b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceUtils.java index 2ce24c49cb..45ad821328 100644 --- a/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceUtils.java +++ b/spring-integration-jpa/src/main/java/org/springframework/integration/jpa/support/parametersource/ExpressionEvaluatingParameterSourceUtils.java @@ -20,11 +20,12 @@ import java.util.HashMap; import java.util.Map; +import org.jspecify.annotations.Nullable; + import org.springframework.expression.EvaluationContext; import org.springframework.expression.Expression; import org.springframework.integration.jpa.support.JpaParameter; import org.springframework.integration.util.AbstractExpressionEvaluator; -import org.springframework.lang.Nullable; import org.springframework.util.Assert; /**