diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java index 8ab8970299a..677b159c3ac 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/AggregateBinder.java @@ -60,7 +60,7 @@ abstract class AggregateBinder { if (result == null || value == null) { return result; } - return merge(value, (T) result); + return merge((Supplier) value, (T) result); } /** @@ -79,7 +79,7 @@ abstract class AggregateBinder { * @param additional the additional elements to merge * @return the merged result */ - protected abstract T merge(Supplier existing, T additional); + protected abstract T merge(Supplier existing, T additional); /** * Return the context being used by this binder. diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java index 057542fde3c..517438ea459 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/ArrayBinder.java @@ -56,7 +56,7 @@ class ArrayBinder extends IndexedElementsBinder { } @Override - protected Object merge(Supplier existing, Object additional) { + protected Object merge(Supplier existing, Object additional) { return additional; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java index ad735cf3149..cfd887dde2b 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/CollectionBinder.java @@ -55,10 +55,9 @@ class CollectionBinder extends IndexedElementsBinder> { } @Override - @SuppressWarnings("unchecked") - protected Collection merge(Supplier existing, + protected Collection merge(Supplier> existing, Collection additional) { - Collection existingCollection = (Collection) existing.get(); + Collection existingCollection = existing.get(); if (existingCollection == null) { return additional; } diff --git a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java index 7efdf055b48..01939e7666e 100644 --- a/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java +++ b/spring-boot-project/spring-boot/src/main/java/org/springframework/boot/context/properties/bind/MapBinder.java @@ -83,10 +83,9 @@ class MapBinder extends AggregateBinder> { } @Override - @SuppressWarnings("unchecked") - protected Map merge(Supplier existing, + protected Map merge(Supplier> existing, Map additional) { - Map existingMap = (Map) existing.get(); + Map existingMap = existing.get(); if (existingMap == null) { return additional; }