Commit d72ba70c authored by Johnny Lim's avatar Johnny Lim Committed by Stephane Nicoll

Use type parameter for Supplier in AggregateBinder.merge()

Closes gh-13139
parent 243023f2
...@@ -60,7 +60,7 @@ abstract class AggregateBinder<T> { ...@@ -60,7 +60,7 @@ abstract class AggregateBinder<T> {
if (result == null || value == null) { if (result == null || value == null) {
return result; return result;
} }
return merge(value, (T) result); return merge((Supplier<T>) value, (T) result);
} }
/** /**
...@@ -79,7 +79,7 @@ abstract class AggregateBinder<T> { ...@@ -79,7 +79,7 @@ abstract class AggregateBinder<T> {
* @param additional the additional elements to merge * @param additional the additional elements to merge
* @return the merged result * @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. * Return the context being used by this binder.
......
...@@ -56,7 +56,7 @@ class ArrayBinder extends IndexedElementsBinder<Object> { ...@@ -56,7 +56,7 @@ class ArrayBinder extends IndexedElementsBinder<Object> {
} }
@Override @Override
protected Object merge(Supplier<?> existing, Object additional) { protected Object merge(Supplier<Object> existing, Object additional) {
return additional; return additional;
} }
......
...@@ -55,10 +55,9 @@ class CollectionBinder extends IndexedElementsBinder<Collection<Object>> { ...@@ -55,10 +55,9 @@ class CollectionBinder extends IndexedElementsBinder<Collection<Object>> {
} }
@Override @Override
@SuppressWarnings("unchecked") protected Collection<Object> merge(Supplier<Collection<Object>> existing,
protected Collection<Object> merge(Supplier<?> existing,
Collection<Object> additional) { Collection<Object> additional) {
Collection<Object> existingCollection = (Collection<Object>) existing.get(); Collection<Object> existingCollection = existing.get();
if (existingCollection == null) { if (existingCollection == null) {
return additional; return additional;
} }
......
...@@ -83,10 +83,9 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> { ...@@ -83,10 +83,9 @@ class MapBinder extends AggregateBinder<Map<Object, Object>> {
} }
@Override @Override
@SuppressWarnings("unchecked") protected Map<Object, Object> merge(Supplier<Map<Object, Object>> existing,
protected Map<Object, Object> merge(Supplier<?> existing,
Map<Object, Object> additional) { Map<Object, Object> additional) {
Map<Object, Object> existingMap = (Map<Object, Object>) existing.get(); Map<Object, Object> existingMap = existing.get();
if (existingMap == null) { if (existingMap == null) {
return additional; return additional;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment