I'm trying to get my head around a generic-type problem. But it seems like eclipse is complaining while there isn't a valid complaint.
Consider the following methods
public static <FR extends FilterResult, T> List<? super WrappedFilterResult<? super T, FR>> filter(String check, Collection<T> elements, Function<? super T, String> converter, Filter<? extends FR> filter, ACComparator<? super WrappedFilterResult<? super T, ? super FR>> comparator)
{
// eclipse says 'filter' doesn't accept these arguments
return filter(check, elements, new ArrayList<>(), converter, filter, comparator);
// doing a self call will result in the same error?
// return filter(check, elements, converter, filter, comparator);
// calling without returning doesn't solve it either?
// filter(check, elements, converter, filter, comparator);
// return null;
}
// no complaints here
public static <FR extends FilterResult, T, C extends Collection<? super WrappedFilterResult<? super T, FR>>> C filter(String check, Collection<T> elements, C result, Function<? super T, String> converter, Filter<? extends FR> filter, ACComparator<? super WrappedFilterResult<? super T, ? super FR>> comparator)
{
// content
}
For the first method eclipse is complaining it cannot call the filter
method because the method is not applicable for the arguments
. But even if I do a self call it will complain.
Thinking it might be the return type I eliminated it by only calling and returning null
, but sadly that doesn't solve anything either.
Sorry for the complicated method declaration but I have more similar methods with the same kind/amount of parameters working with no problems. So I have no clue why this wouldn't work.
Info:
- Windows 10
- Eclipse oxygen.3a Release (4.7.3a)
I hope its something minor I fail to see atm, any help is appreciated.
Thanks in advance
Edit
The class declarations if someone needs them
public static class FilterResult {}
public interface Filter<FR extends FilterResult> {}
public static class WrappedFilterResult<T, FR extends FilterResult> extends FilterResult {}
public interface ACComparator<FR extends FilterResult> {}
Submitted to Bugzilla
- thread link 1 at the eclipse bugzilla forum
- thread link 2 at the eclipse bugzilla forum