hamcrest/0001-Fix-build-with-OpenJDK-11.patch

132 lines
6.8 KiB
Diff
Raw Permalink Normal View History

2023-05-05 15:19:07 +00:00
From d33031924faa557bb43ba0471f74d942ddfeae50 Mon Sep 17 00:00:00 2001
From: Mikolaj Izdebski <mizdebsk@redhat.com>
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 <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) {
- return arrayContainingInAnyOrder(asList(itemMatchers));
+ Collection<Matcher<? super E>> 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<E> extends TypeSafeMatcher<E[]> {
* a list of matchers, each of which must be satisfied by an entry in an examined array
*/
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) {
- return arrayContainingInAnyOrder(Arrays.asList(itemMatchers));
+ return new IsArrayContainingInAnyOrder<E>(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<E> extends TypeSafeMatcher<E[]> {
* the matchers that must be satisfied by the items in the examined array
*/
public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers) {
- return arrayContaining(asList(itemMatchers));
+ return new IsArrayContainingInOrder<E>(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<T> extends TypeSafeDiagnosingMatcher
*/
@SafeVarargs
public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers) {
- return containsInAnyOrder(Arrays.asList(itemMatchers));
+ return new IsIterableContainingInAnyOrder<T>(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<E> extends TypeSafeDiagnosingMa
*/
@SafeVarargs
public static <E> Matcher<Iterable<? extends E>> containsInRelativeOrder(Matcher<? super E>... itemMatchers) {
- return containsInRelativeOrder(asList(itemMatchers));
+ return new IsIterableContainingInRelativeOrder<E>(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<T> extends DiagnosingMatcher<T> {
*/
@SafeVarargs
public static <T> Matcher<T> allOf(Matcher<? super T>... matchers) {
- return allOf(Arrays.asList(matchers));
+ return new AllOf<T>(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<T> extends ShortcutCombination<T> {
*/
@SafeVarargs
public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers) {
- return anyOf(Arrays.asList(matchers));
+ return new AnyOf<T>(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<T> extends TypeSafeDiagnosingMatcher<T> {
this.first = matcher;
}
public CombinableMatcher<X> and(Matcher<? super X> other) {
- return new CombinableMatcher<>(first).and(other);
+ return new CombinableMatcher<>(first).and((Matcher)other);
}
}
@@ -76,7 +76,7 @@ public class CombinableMatcher<T> extends TypeSafeDiagnosingMatcher<T> {
this.first = matcher;
}
public CombinableMatcher<X> or(Matcher<? super X> other) {
- return new CombinableMatcher<>(first).or(other);
+ return new CombinableMatcher<>(first).or((Matcher)other);
}
}
}
--
2.21.0