From d33031924faa557bb43ba0471f74d942ddfeae50 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Tue, 5 Nov 2019 14:50:23 +0100 Subject: [PATCH] Fix build with OpenJDK 11 --- .../src/main/java/org/hamcrest/collection/ArrayMatching.java | 3 ++- .../org/hamcrest/collection/IsArrayContainingInAnyOrder.java | 2 +- .../org/hamcrest/collection/IsArrayContainingInOrder.java | 2 +- .../hamcrest/collection/IsIterableContainingInAnyOrder.java | 2 +- .../collection/IsIterableContainingInRelativeOrder.java | 2 +- hamcrest/src/main/java/org/hamcrest/core/AllOf.java | 2 +- hamcrest/src/main/java/org/hamcrest/core/AnyOf.java | 2 +- .../src/main/java/org/hamcrest/core/CombinableMatcher.java | 4 ++-- 8 files changed, 10 insertions(+), 9 deletions(-) diff --git a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java index fc968e0..baab775 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/ArrayMatching.java @@ -67,7 +67,8 @@ public class ArrayMatching { */ @SafeVarargs public static Matcher arrayContainingInAnyOrder(Matcher... itemMatchers) { - return arrayContainingInAnyOrder(asList(itemMatchers)); + Collection> itemMatchersList = asList(itemMatchers); + return new ArrayAsIterableMatcher<>(new IsIterableContainingInAnyOrder<>(itemMatchersList), itemMatchersList, "in any order"); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java index 7e72a62..c0c7efc 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java @@ -59,7 +59,7 @@ public class IsArrayContainingInAnyOrder extends TypeSafeMatcher { * a list of matchers, each of which must be satisfied by an entry in an examined array */ public static Matcher arrayContainingInAnyOrder(Matcher... itemMatchers) { - return arrayContainingInAnyOrder(Arrays.asList(itemMatchers)); + return new IsArrayContainingInAnyOrder(Arrays.asList(itemMatchers)); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java index c046914..2022f1a 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java @@ -73,7 +73,7 @@ public class IsArrayContainingInOrder extends TypeSafeMatcher { * the matchers that must be satisfied by the items in the examined array */ public static Matcher arrayContaining(Matcher... itemMatchers) { - return arrayContaining(asList(itemMatchers)); + return new IsArrayContainingInOrder(asList(itemMatchers)); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java index d6a9a33..9a7e6c0 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java @@ -98,7 +98,7 @@ public class IsIterableContainingInAnyOrder extends TypeSafeDiagnosingMatcher */ @SafeVarargs public static Matcher> containsInAnyOrder(Matcher... itemMatchers) { - return containsInAnyOrder(Arrays.asList(itemMatchers)); + return new IsIterableContainingInAnyOrder(Arrays.asList(itemMatchers)); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java index 0657768..06d6a57 100644 --- a/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java +++ b/hamcrest/src/main/java/org/hamcrest/collection/IsIterableContainingInRelativeOrder.java @@ -99,7 +99,7 @@ public class IsIterableContainingInRelativeOrder extends TypeSafeDiagnosingMa */ @SafeVarargs public static Matcher> containsInRelativeOrder(Matcher... itemMatchers) { - return containsInRelativeOrder(asList(itemMatchers)); + return new IsIterableContainingInRelativeOrder(asList(itemMatchers)); } /** diff --git a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java index b8c3faa..f8951bd 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/AllOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/AllOf.java @@ -56,6 +56,6 @@ public class AllOf extends DiagnosingMatcher { */ @SafeVarargs public static Matcher allOf(Matcher... matchers) { - return allOf(Arrays.asList(matchers)); + return new AllOf(Arrays.asList(matchers)); } } diff --git a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java index 7a22c22..5a63574 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java +++ b/hamcrest/src/main/java/org/hamcrest/core/AnyOf.java @@ -46,6 +46,6 @@ public class AnyOf extends ShortcutCombination { */ @SafeVarargs public static AnyOf anyOf(Matcher... matchers) { - return anyOf(Arrays.asList(matchers)); + return new AnyOf(Arrays.asList(matchers)); } } diff --git a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java index e37efce..6b44884 100644 --- a/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java +++ b/hamcrest/src/main/java/org/hamcrest/core/CombinableMatcher.java @@ -57,7 +57,7 @@ public class CombinableMatcher extends TypeSafeDiagnosingMatcher { this.first = matcher; } public CombinableMatcher and(Matcher other) { - return new CombinableMatcher<>(first).and(other); + return new CombinableMatcher<>(first).and((Matcher)other); } } @@ -76,7 +76,7 @@ public class CombinableMatcher extends TypeSafeDiagnosingMatcher { this.first = matcher; } public CombinableMatcher or(Matcher other) { - return new CombinableMatcher<>(first).or(other); + return new CombinableMatcher<>(first).or((Matcher)other); } } } -- 2.21.0