JavaHamcrest
JavaHamcrest copied to clipboard
Allow Iterables in AllOf/AnyOf that are typed to an extension of `Mat……cher`
Currently the following code won't compile:
List<Matcher<String>> submatchers = new ArrayList<>();
new AllOf<String>(submatchers);
This is because AllOf expects an Iterable<Matcher<? super String>> and not a Iterable<Matcher<String>> the I tried to supply above.
As a workaround this works:
List<Matcher<? super String>> submatchers = new ArrayList<>();
new AllOf<String>(submatchers);
But depending on where this list comes from it may be impracticable to change the type like that.
This also works, but generates a compile warning and right so...:
List<Matcher<String>> submatchers = new ArrayList<>();
new AllOf<String>((Iterable)submatchers);
This PR proposes a slight change in the method signature of AllOf, AnyOf and ShortcutCombination which eliminates the problem. The change in signature is compatible to the old API, because only the generics are changed.
@yankee42 wanting to kick start getting pr's getting reviewed and then merged, can you rebase from master, as hamcrest-core and hamcrest-library have been refactored a lot and also deprecated, so that everything is just in hamcrest.
@nhojpatrick : I rebased it.
Going to try and kick start hamcrest, so if you want to get it merged, please rebase from the branch v2.3-candidates.
Still trying to understand how has permissions to perform a release.