Remove accidental org.jetbrains:annotations usage.

See spring-projects/spring-data-build#2670
This commit is contained in:
Mark Paluch 2025-10-10 09:25:09 +02:00
parent 0e1a97a27a
commit 16f3addaf6
No known key found for this signature in database
GPG Key ID: 55BC6374BAA9D973
9 changed files with 35 additions and 27 deletions

View File

@ -243,6 +243,14 @@
<optional>true</optional> <optional>true</optional>
</dependency> </dependency>
<dependency>
<groupId>org.jetbrains</groupId>
<artifactId>annotations</artifactId>
<version>26.0.2-1</version>
<scope>test</scope>
<optional>true</optional>
</dependency>
<dependency> <dependency>
<groupId>org.slf4j</groupId> <groupId>org.slf4j</groupId>
<artifactId>log4j-over-slf4j</artifactId> <artifactId>log4j-over-slf4j</artifactId>

View File

@ -27,7 +27,8 @@ import reactor.core.publisher.Mono;
import java.io.IOException; import java.io.IOException;
import java.util.function.Function; 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}. * Reactive version of {@link co.elastic.clients.elasticsearch.sql.ElasticsearchSqlClient}.

View File

@ -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.SearchRequestBody;
import co.elastic.clients.elasticsearch.core.search.SourceConfig; import co.elastic.clients.elasticsearch.core.search.SourceConfig;
import co.elastic.clients.elasticsearch.indices.*; 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.ExistsRequest;
import co.elastic.clients.elasticsearch.indices.update_aliases.Action; import co.elastic.clients.elasticsearch.indices.update_aliases.Action;
import co.elastic.clients.elasticsearch.sql.query.SqlFormat; 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.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import org.springframework.dao.InvalidDataAccessApiUsageException; import org.springframework.dao.InvalidDataAccessApiUsageException;
import org.springframework.data.domain.Sort; import org.springframework.data.domain.Sort;
import org.springframework.data.elasticsearch.core.RefreshPolicy; import org.springframework.data.elasticsearch.core.RefreshPolicy;
import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter; import org.springframework.data.elasticsearch.core.convert.ElasticsearchConverter;
import org.springframework.data.elasticsearch.core.document.Document; 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.DeleteIndexTemplateRequest;
import org.springframework.data.elasticsearch.core.index.DeleteTemplateRequest; import org.springframework.data.elasticsearch.core.index.DeleteTemplateRequest;
import org.springframework.data.elasticsearch.core.index.ExistsTemplateRequest; import org.springframework.data.elasticsearch.core.index.ExistsTemplateRequest;
@ -310,7 +311,6 @@ class RequestConverter extends AbstractQueryProcessor {
return updateAliasRequestBuilder.build(); return updateAliasRequestBuilder.build();
} }
@NotNull
private Action.Builder getBuilder(AliasAction aliasAction) { private Action.Builder getBuilder(AliasAction aliasAction) {
Action.Builder actionBuilder = new Action.Builder(); Action.Builder actionBuilder = new Action.Builder();
@ -1897,7 +1897,6 @@ class RequestConverter extends AbstractQueryProcessor {
}); });
} }
@NotNull
private Map<String, JsonData> getTemplateParams(Set<Map.Entry<String, Object>> query) { private Map<String, JsonData> getTemplateParams(Set<Map.Entry<String, Object>> query) {
Function<Map.Entry<String, Object>, String> keyMapper = Map.Entry::getKey; Function<Map.Entry<String, Object>, String> keyMapper = Map.Entry::getKey;
Function<Map.Entry<String, Object>, JsonData> valueMapper = entry -> JsonData.of(entry.getValue(), jsonpMapper); Function<Map.Entry<String, Object>, JsonData> valueMapper = entry -> JsonData.of(entry.getValue(), jsonpMapper);

View File

@ -23,8 +23,8 @@ import java.util.stream.Collectors;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import org.springframework.beans.BeansException; import org.springframework.beans.BeansException;
import org.springframework.beans.factory.InitializingBean; import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.ApplicationContext; 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.PersistentPropertyAccessor;
import org.springframework.data.mapping.SimplePropertyHandler; import org.springframework.data.mapping.SimplePropertyHandler;
import org.springframework.data.mapping.context.MappingContext; 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.data.util.TypeInformation;
import org.springframework.expression.spel.standard.SpelExpressionParser; import org.springframework.expression.spel.standard.SpelExpressionParser;
import org.springframework.format.datetime.DateFormatterRegistrar; import org.springframework.format.datetime.DateFormatterRegistrar;
@ -1339,7 +1348,6 @@ public class MappingElasticsearchConverter
.collect(Collectors.toList()); .collect(Collectors.toList());
} }
@NotNull
private String propertyToFieldName(ElasticsearchPersistentEntity<?> persistentEntity, String propertyName) { private String propertyToFieldName(ElasticsearchPersistentEntity<?> persistentEntity, String propertyName) {
ElasticsearchPersistentProperty persistentProperty = persistentEntity.getPersistentProperty(propertyName); ElasticsearchPersistentProperty persistentProperty = persistentEntity.getPersistentProperty(propertyName);
return persistentProperty != null ? persistentProperty.getFieldName() : propertyName; return persistentProperty != null ? persistentProperty.getFieldName() : propertyName;

View File

@ -21,7 +21,6 @@ import java.util.List;
import java.util.Optional; import java.util.Optional;
import java.util.stream.Collectors; import java.util.stream.Collectors;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageImpl;
@ -345,7 +344,6 @@ public class SimpleElasticsearchRepository<T, ID> implements ElasticsearchReposi
deleteAllById(getEntityIds(entities), refreshPolicy); deleteAllById(getEntityIds(entities), refreshPolicy);
} }
@NotNull
private List<ID> getEntityIds(Iterable<? extends T> entities) { private List<ID> getEntityIds(Iterable<? extends T> entities) {
Assert.notNull(entities, "Cannot delete 'null' list."); Assert.notNull(entities, "Cannot delete 'null' list.");

View File

@ -20,7 +20,8 @@ import static org.springframework.data.elasticsearch.client.elc.Queries.*;
import co.elastic.clients.elasticsearch._types.query_dsl.ChildScoreMode; 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.Bean;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Import;
@ -46,7 +47,7 @@ public class NestedObjectELCIntegrationTests extends NestedObjectIntegrationTest
} }
@Override @Override
protected @NotNull Query getNestedQuery1() { protected @NonNull Query getNestedQuery1() {
return NativeQuery.builder().withQuery( // return NativeQuery.builder().withQuery( //
nested(n -> n // nested(n -> n //
.path("car") // .path("car") //
@ -61,7 +62,7 @@ public class NestedObjectELCIntegrationTests extends NestedObjectIntegrationTest
} }
@Override @Override
protected @NotNull Query getNestedQuery2() { protected Query getNestedQuery2() {
return NativeQuery.builder().withQuery( // return NativeQuery.builder().withQuery( //
bool(b -> b // bool(b -> b //
.must(nested(n -> n // .must(nested(n -> n //
@ -80,7 +81,7 @@ public class NestedObjectELCIntegrationTests extends NestedObjectIntegrationTest
} }
@Override @Override
protected @NotNull Query getNestedQuery3() { protected Query getNestedQuery3() {
return NativeQuery.builder().withQuery( // return NativeQuery.builder().withQuery( //
nested(n -> n // nested(n -> n //
.path("books") // .path("books") //
@ -94,7 +95,7 @@ public class NestedObjectELCIntegrationTests extends NestedObjectIntegrationTest
} }
@Override @Override
protected @NotNull Query getNestedQuery4() { protected Query getNestedQuery4() {
return NativeQuery.builder().withQuery( // return NativeQuery.builder().withQuery( //
nested(n -> n // nested(n -> n //
.path("buckets") // .path("buckets") //

View File

@ -28,7 +28,6 @@ import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
@ -134,7 +133,7 @@ public abstract class NestedObjectIntegrationTests {
assertThat(persons).hasSize(1); assertThat(persons).hasSize(1);
} }
@NotNull
abstract protected Query getNestedQuery1(); abstract protected Query getNestedQuery1();
@Test @Test
@ -189,7 +188,7 @@ public abstract class NestedObjectIntegrationTests {
assertThat(personIndexed.getSearchHit(0).getContent().getId()).isEqualTo("1"); assertThat(personIndexed.getSearchHit(0).getContent().getId()).isEqualTo("1");
} }
@NotNull
abstract protected Query getNestedQuery2(); abstract protected Query getNestedQuery2();
private List<IndexQuery> createPerson() { private List<IndexQuery> createPerson() {
@ -329,7 +328,7 @@ public abstract class NestedObjectIntegrationTests {
return foo; return foo;
} }
@NotNull
abstract protected Query getNestedQuery3(); abstract protected Query getNestedQuery3();
@Test // DATAES-73 @Test // DATAES-73
@ -413,7 +412,7 @@ public abstract class NestedObjectIntegrationTests {
assertThat(nullResults.getSearchHits()).hasSize(1); assertThat(nullResults.getSearchHits()).hasSize(1);
} }
@NotNull
abstract protected Query getNestedQuery4(); abstract protected Query getNestedQuery4();
@Document(indexName = "#{@indexNameProvider.indexName()}-book") @Document(indexName = "#{@indexNameProvider.indexName()}-book")

View File

@ -24,7 +24,6 @@ import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.DisplayName;
@ -158,7 +157,6 @@ public abstract class ReactiveScriptedAndRuntimeFieldsIntegrationTests {
assertThat(foundEntity.getScriptedValue2()).isEqualTo(9); assertThat(foundEntity.getScriptedValue2()).isEqualTo(9);
} }
@NotNull
private static org.springframework.data.elasticsearch.core.query.ScriptedField getScriptedField(String fieldName, private static org.springframework.data.elasticsearch.core.query.ScriptedField getScriptedField(String fieldName,
int factor) { int factor) {
return org.springframework.data.elasticsearch.core.query.ScriptedField.of( return org.springframework.data.elasticsearch.core.query.ScriptedField.of(
@ -214,7 +212,6 @@ public abstract class ReactiveScriptedAndRuntimeFieldsIntegrationTests {
assertThat(foundEntity.getScriptedValue2()).isEqualTo(12); assertThat(foundEntity.getScriptedValue2()).isEqualTo(12);
} }
@NotNull
private static RuntimeField getRuntimeField(String fieldName, int factor) { private static RuntimeField getRuntimeField(String fieldName, int factor) {
return new RuntimeField( return new RuntimeField(
fieldName, fieldName,

View File

@ -21,7 +21,6 @@ import java.time.LocalDate;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import org.jetbrains.annotations.NotNull;
import org.jspecify.annotations.Nullable; import org.jspecify.annotations.Nullable;
import org.junit.jupiter.api.BeforeEach; import org.junit.jupiter.api.BeforeEach;
import org.junit.jupiter.api.DisplayName; 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 * build a {@link org.springframework.data.elasticsearch.core.query.ScriptedField} to return the product of the
* document's value property and the given factor * document's value property and the given factor
*/ */
@NotNull
private static org.springframework.data.elasticsearch.core.query.ScriptedField buildScriptedField(String fieldName, private static org.springframework.data.elasticsearch.core.query.ScriptedField buildScriptedField(String fieldName,
int factor) { int factor) {
return org.springframework.data.elasticsearch.core.query.ScriptedField.of( 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 * 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) { private static RuntimeField buildRuntimeField(String fieldName, int factor) {
return new RuntimeField( return new RuntimeField(
fieldName, fieldName,