Use type parameter for Supplier in AggregateBinder.merge()
Closes gh-13139
This commit is contained in:
parent
243023f2ad
commit
d72ba70cba
|
|
@ -60,7 +60,7 @@ abstract class AggregateBinder<T> {
|
|||
if (result == null || value == null) {
|
||||
return result;
|
||||
}
|
||||
return merge(value, (T) result);
|
||||
return merge((Supplier<T>) value, (T) result);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -79,7 +79,7 @@ abstract class AggregateBinder<T> {
|
|||
* @param additional the additional elements to merge
|
||||
* @return the merged result
|
||||
*/
|
||||
protected abstract T merge(Supplier<?> existing, T additional);
|
||||
protected abstract T merge(Supplier<T> existing, T additional);
|
||||
|
||||
/**
|
||||
* Return the context being used by this binder.
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ class ArrayBinder extends IndexedElementsBinder<Object> {
|
|||
}
|
||||
|
||||
@Override
|
||||
protected Object merge(Supplier<?> existing, Object additional) {
|
||||
protected Object merge(Supplier<Object> existing, Object additional) {
|
||||
return additional;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -55,10 +55,9 @@ class CollectionBinder extends IndexedElementsBinder<Collection<Object>> {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Collection<Object> merge(Supplier<?> existing,
|
||||
protected Collection<Object> merge(Supplier<Collection<Object>> existing,
|
||||
Collection<Object> additional) {
|
||||
Collection<Object> existingCollection = (Collection<Object>) existing.get();
|
||||
Collection<Object> existingCollection = existing.get();
|
||||
if (existingCollection == null) {
|
||||
return additional;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -83,10 +83,9 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
|
|||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
protected Map<Object, Object> merge(Supplier<?> existing,
|
||||
protected Map<Object, Object> merge(Supplier<Map<Object, Object>> existing,
|
||||
Map<Object, Object> additional) {
|
||||
Map<Object, Object> existingMap = (Map<Object, Object>) existing.get();
|
||||
Map<Object, Object> existingMap = existing.get();
|
||||
if (existingMap == null) {
|
||||
return additional;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue