From bb244edcc3d5a2e8b0729a0092f924b700469c67 Mon Sep 17 00:00:00 2001 From: Mark Paluch Date: Wed, 11 Jun 2025 08:48:42 +0200 Subject: [PATCH] Polishing. Address compiler warnings. See #3309 --- .../data/convert/PropertyValueConverterFactories.java | 7 ++----- .../java/org/springframework/data/util/TypeScanner.java | 3 ++- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/src/main/java/org/springframework/data/convert/PropertyValueConverterFactories.java b/src/main/java/org/springframework/data/convert/PropertyValueConverterFactories.java index 3db744e03..261b722f4 100644 --- a/src/main/java/org/springframework/data/convert/PropertyValueConverterFactories.java +++ b/src/main/java/org/springframework/data/convert/PropertyValueConverterFactories.java @@ -116,7 +116,6 @@ final class PropertyValueConverterFactories { } @Override - @SuppressWarnings("unchecked") public > @Nullable PropertyValueConverter getConverter( Class> converterType) { @@ -125,8 +124,7 @@ final class PropertyValueConverterFactories { PropertyValueConverter converter = beanFactory.getBeanProvider(converterType).getIfAvailable(); if (converter == null && beanFactory instanceof AutowireCapableBeanFactory) { - return (PropertyValueConverter) ((AutowireCapableBeanFactory) beanFactory).createBean(converterType, - AutowireCapableBeanFactory.AUTOWIRE_CONSTRUCTOR, false); + return ((AutowireCapableBeanFactory) beanFactory).createBean(converterType); } return converter; @@ -227,8 +225,7 @@ final class PropertyValueConverterFactories { @Contract("_, null -> null;_, !null -> !null") > @Nullable PropertyValueConverter cache( - PersistentProperty property, - @Nullable PropertyValueConverter converter) { + PersistentProperty property, @Nullable PropertyValueConverter converter) { perPropertyCache.putIfAbsent(property, Optional.ofNullable(converter)); diff --git a/src/main/java/org/springframework/data/util/TypeScanner.java b/src/main/java/org/springframework/data/util/TypeScanner.java index 0758cf9c0..ae97b08a2 100644 --- a/src/main/java/org/springframework/data/util/TypeScanner.java +++ b/src/main/java/org/springframework/data/util/TypeScanner.java @@ -98,6 +98,7 @@ public interface TypeScanner { * @return new instance of {@link TypeScanner}. * @see #forTypesAnnotatedWith(Collection) */ + @SuppressWarnings("unchecked") default TypeScanner forTypesAnnotatedWith(Class... annotations) { return forTypesAnnotatedWith(Arrays.asList(annotations)); } @@ -114,7 +115,7 @@ public interface TypeScanner { * Define what happens in the case of a {@link ClassNotFoundException}. * * @param action must not be {@literal null}. - * @return + * @return new instance of {@link TypeScanner}. */ TypeScanner onClassNotFound(Consumer action);