diff --git a/pom.xml b/pom.xml index 948e3fe57..19a20af67 100644 --- a/pom.xml +++ b/pom.xml @@ -243,6 +243,14 @@ true + + org.jetbrains + annotations + 26.0.2-1 + test + true + + org.slf4j log4j-over-slf4j diff --git a/src/main/java/org/springframework/data/elasticsearch/client/elc/ReactiveElasticsearchSqlClient.java b/src/main/java/org/springframework/data/elasticsearch/client/elc/ReactiveElasticsearchSqlClient.java index c14bb4865..07d607efc 100644 --- a/src/main/java/org/springframework/data/elasticsearch/client/elc/ReactiveElasticsearchSqlClient.java +++ b/src/main/java/org/springframework/data/elasticsearch/client/elc/ReactiveElasticsearchSqlClient.java @@ -27,7 +27,8 @@ import reactor.core.publisher.Mono; import java.io.IOException; import java.util.function.Function; -import org.jetbrains.annotations.Nullable; +import org.jspecify.annotations.Nullable; + /** * Reactive version of {@link co.elastic.clients.elasticsearch.sql.ElasticsearchSqlClient}. diff --git a/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java b/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java index 2c8ed24f2..2147e31a9 100644 --- a/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java +++ b/src/main/java/org/springframework/data/elasticsearch/client/elc/RequestConverter.java @@ -48,7 +48,6 @@ import co.elastic.clients.elasticsearch.core.search.Rescore; import co.elastic.clients.elasticsearch.core.search.SearchRequestBody; import co.elastic.clients.elasticsearch.core.search.SourceConfig; import co.elastic.clients.elasticsearch.indices.*; -import co.elastic.clients.elasticsearch.indices.ExistsIndexTemplateRequest; import co.elastic.clients.elasticsearch.indices.ExistsRequest; import co.elastic.clients.elasticsearch.indices.update_aliases.Action; import co.elastic.clients.elasticsearch.sql.query.SqlFormat; @@ -77,14 +76,16 @@ import java.util.stream.Stream; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.Nullable; + import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.data.domain.Sort; import org.springframework.data.elasticsearch.core.RefreshPolicy; import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter; import org.springframework.data.elasticsearch.core.document.Document; -import org.springframework.data.elasticsearch.core.index.*; +import org.springframework.data.elasticsearch.core.index.AliasAction; +import org.springframework.data.elasticsearch.core.index.AliasActionParameters; +import org.springframework.data.elasticsearch.core.index.AliasActions; import org.springframework.data.elasticsearch.core.index.DeleteIndexTemplateRequest; import org.springframework.data.elasticsearch.core.index.DeleteTemplateRequest; import org.springframework.data.elasticsearch.core.index.ExistsTemplateRequest; @@ -310,7 +311,6 @@ class RequestConverter extends AbstractQueryProcessor { return updateAliasRequestBuilder.build(); } - @NotNull private Action.Builder getBuilder(AliasAction aliasAction) { Action.Builder actionBuilder = new Action.Builder(); @@ -1897,7 +1897,6 @@ class RequestConverter extends AbstractQueryProcessor { }); } - @NotNull private Map getTemplateParams(Set> query) { Function, String> keyMapper = Map.Entry::getKey; Function, JsonData> valueMapper = entry -> JsonData.of(entry.getValue(), jsonpMapper); diff --git a/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java b/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java index d0d9c5278..d15903a01 100644 --- a/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java +++ b/src/main/java/org/springframework/data/elasticsearch/core/convert/MappingElasticsearchConverter.java @@ -23,8 +23,8 @@ import java.util.stream.Collectors; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; -import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.Nullable; + import org.springframework.beans.BeansException; import org.springframework.beans.factory.InitializingBean; import org.springframework.context.ApplicationContext; @@ -62,7 +62,16 @@ import org.springframework.data.mapping.Parameter; import org.springframework.data.mapping.PersistentPropertyAccessor; import org.springframework.data.mapping.SimplePropertyHandler; import org.springframework.data.mapping.context.MappingContext; -import org.springframework.data.mapping.model.*; +import org.springframework.data.mapping.model.CachingValueExpressionEvaluatorFactory; +import org.springframework.data.mapping.model.ConvertingPropertyAccessor; +import org.springframework.data.mapping.model.EntityInstantiator; +import org.springframework.data.mapping.model.EntityInstantiators; +import org.springframework.data.mapping.model.ParameterValueProvider; +import org.springframework.data.mapping.model.PersistentEntityParameterValueProvider; +import org.springframework.data.mapping.model.PropertyValueProvider; +import org.springframework.data.mapping.model.SpELContext; +import org.springframework.data.mapping.model.ValueExpressionEvaluator; +import org.springframework.data.mapping.model.ValueExpressionParameterValueProvider; import org.springframework.data.util.TypeInformation; import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.format.datetime.DateFormatterRegistrar; @@ -1339,7 +1348,6 @@ public class MappingElasticsearchConverter .collect(Collectors.toList()); } - @NotNull private String propertyToFieldName(ElasticsearchPersistentEntity persistentEntity, String propertyName) { ElasticsearchPersistentProperty persistentProperty = persistentEntity.getPersistentProperty(propertyName); return persistentProperty != null ? persistentProperty.getFieldName() : propertyName; diff --git a/src/main/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepository.java b/src/main/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepository.java index d48a3c80e..8bd074ada 100644 --- a/src/main/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepository.java +++ b/src/main/java/org/springframework/data/elasticsearch/repository/support/SimpleElasticsearchRepository.java @@ -21,7 +21,6 @@ import java.util.List; import java.util.Optional; import java.util.stream.Collectors; -import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.Nullable; import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; @@ -345,7 +344,6 @@ public class SimpleElasticsearchRepository implements ElasticsearchReposi deleteAllById(getEntityIds(entities), refreshPolicy); } - @NotNull private List getEntityIds(Iterable entities) { Assert.notNull(entities, "Cannot delete 'null' list."); diff --git a/src/test/java/org/springframework/data/elasticsearch/NestedObjectELCIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/NestedObjectELCIntegrationTests.java index e99b5e72f..e86005183 100644 --- a/src/test/java/org/springframework/data/elasticsearch/NestedObjectELCIntegrationTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/NestedObjectELCIntegrationTests.java @@ -20,7 +20,8 @@ import static org.springframework.data.elasticsearch.client.elc.Queries.*; import co.elastic.clients.elasticsearch._types.query_dsl.ChildScoreMode; -import org.jetbrains.annotations.NotNull; +import org.jspecify.annotations.NonNull; + import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; @@ -46,7 +47,7 @@ public class NestedObjectELCIntegrationTests extends NestedObjectIntegrationTest } @Override - protected @NotNull Query getNestedQuery1() { + protected @NonNull Query getNestedQuery1() { return NativeQuery.builder().withQuery( // nested(n -> n // .path("car") // @@ -61,7 +62,7 @@ public class NestedObjectELCIntegrationTests extends NestedObjectIntegrationTest } @Override - protected @NotNull Query getNestedQuery2() { + protected Query getNestedQuery2() { return NativeQuery.builder().withQuery( // bool(b -> b // .must(nested(n -> n // @@ -80,7 +81,7 @@ public class NestedObjectELCIntegrationTests extends NestedObjectIntegrationTest } @Override - protected @NotNull Query getNestedQuery3() { + protected Query getNestedQuery3() { return NativeQuery.builder().withQuery( // nested(n -> n // .path("books") // @@ -94,7 +95,7 @@ public class NestedObjectELCIntegrationTests extends NestedObjectIntegrationTest } @Override - protected @NotNull Query getNestedQuery4() { + protected Query getNestedQuery4() { return NativeQuery.builder().withQuery( // nested(n -> n // .path("buckets") // diff --git a/src/test/java/org/springframework/data/elasticsearch/NestedObjectIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/NestedObjectIntegrationTests.java index 268227455..7a878eff9 100644 --- a/src/test/java/org/springframework/data/elasticsearch/NestedObjectIntegrationTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/NestedObjectIntegrationTests.java @@ -28,7 +28,6 @@ import java.util.HashMap; import java.util.List; import java.util.Map; -import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -134,7 +133,7 @@ public abstract class NestedObjectIntegrationTests { assertThat(persons).hasSize(1); } - @NotNull + abstract protected Query getNestedQuery1(); @Test @@ -189,7 +188,7 @@ public abstract class NestedObjectIntegrationTests { assertThat(personIndexed.getSearchHit(0).getContent().getId()).isEqualTo("1"); } - @NotNull + abstract protected Query getNestedQuery2(); private List createPerson() { @@ -329,7 +328,7 @@ public abstract class NestedObjectIntegrationTests { return foo; } - @NotNull + abstract protected Query getNestedQuery3(); @Test // DATAES-73 @@ -413,7 +412,7 @@ public abstract class NestedObjectIntegrationTests { assertThat(nullResults.getSearchHits()).hasSize(1); } - @NotNull + abstract protected Query getNestedQuery4(); @Document(indexName = "#{@indexNameProvider.indexName()}-book") diff --git a/src/test/java/org/springframework/data/elasticsearch/core/query/scriptedandruntimefields/ReactiveScriptedAndRuntimeFieldsIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/core/query/scriptedandruntimefields/ReactiveScriptedAndRuntimeFieldsIntegrationTests.java index c17b4a8df..6859f8978 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/query/scriptedandruntimefields/ReactiveScriptedAndRuntimeFieldsIntegrationTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/query/scriptedandruntimefields/ReactiveScriptedAndRuntimeFieldsIntegrationTests.java @@ -24,7 +24,6 @@ import java.time.LocalDate; import java.util.List; import java.util.Map; -import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -158,7 +157,6 @@ public abstract class ReactiveScriptedAndRuntimeFieldsIntegrationTests { assertThat(foundEntity.getScriptedValue2()).isEqualTo(9); } - @NotNull private static org.springframework.data.elasticsearch.core.query.ScriptedField getScriptedField(String fieldName, int factor) { return org.springframework.data.elasticsearch.core.query.ScriptedField.of( @@ -214,7 +212,6 @@ public abstract class ReactiveScriptedAndRuntimeFieldsIntegrationTests { assertThat(foundEntity.getScriptedValue2()).isEqualTo(12); } - @NotNull private static RuntimeField getRuntimeField(String fieldName, int factor) { return new RuntimeField( fieldName, diff --git a/src/test/java/org/springframework/data/elasticsearch/core/query/scriptedandruntimefields/ScriptedAndRuntimeFieldsIntegrationTests.java b/src/test/java/org/springframework/data/elasticsearch/core/query/scriptedandruntimefields/ScriptedAndRuntimeFieldsIntegrationTests.java index d4b147d46..3cb4245f0 100644 --- a/src/test/java/org/springframework/data/elasticsearch/core/query/scriptedandruntimefields/ScriptedAndRuntimeFieldsIntegrationTests.java +++ b/src/test/java/org/springframework/data/elasticsearch/core/query/scriptedandruntimefields/ScriptedAndRuntimeFieldsIntegrationTests.java @@ -21,7 +21,6 @@ import java.time.LocalDate; import java.util.List; import java.util.Map; -import org.jetbrains.annotations.NotNull; import org.jspecify.annotations.Nullable; import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.DisplayName; @@ -307,7 +306,6 @@ public abstract class ScriptedAndRuntimeFieldsIntegrationTests { * build a {@link org.springframework.data.elasticsearch.core.query.ScriptedField} to return the product of the * document's value property and the given factor */ - @NotNull private static org.springframework.data.elasticsearch.core.query.ScriptedField buildScriptedField(String fieldName, int factor) { return org.springframework.data.elasticsearch.core.query.ScriptedField.of( @@ -320,7 +318,6 @@ public abstract class ScriptedAndRuntimeFieldsIntegrationTests { /** * build a {@link RuntimeField} to return the product of the document's value property and the given factor */ - @NotNull private static RuntimeField buildRuntimeField(String fieldName, int factor) { return new RuntimeField( fieldName,