Fix build with OpenJDK 11

This commit is contained in:
Mikolaj Izdebski 2019-11-05 08:15:22 +01:00
parent 8b02a8f827
commit 954f612f87
2 changed files with 136 additions and 32 deletions

View File

@ -0,0 +1,131 @@
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

View File

@ -1,33 +1,3 @@
# Copyright (c) 2000-2008, JPackage Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the
# distribution.
# 3. Neither the name of the JPackage Project nor the names of its
# contributors may be used to endorse or promote products derived
# from this software without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
#
%global upstream_version %(echo %{version} | tr '~' '-')
Name: hamcrest
@ -36,14 +6,16 @@ Release: 1%{?dist}
Summary: Library of matchers for building test expressions
License: BSD
URL: https://github.com/hamcrest/JavaHamcrest
BuildArch: noarch
Source0: https://github.com/hamcrest/JavaHamcrest/archive/v%{upstream_version}.tar.gz#/%{name}-%{version}.tar.gz
Source1: https://repo1.maven.org/maven2/org/hamcrest/hamcrest/%{upstream_version}/hamcrest-%{upstream_version}.pom
Patch0: 0001-Fix-build-with-OpenJDK-11.patch
BuildRequires: maven-local
BuildRequires: mvn(junit:junit)
BuildArch: noarch
%description
Provides a library of matcher objects (also known as constraints or predicates)
allowing 'match' rules to be defined declaratively, to be used in other
@ -58,6 +30,7 @@ Javadoc for %{name}.
%prep
%setup -q -n JavaHamcrest-%{upstream_version}
%patch0 -p1
rm -rf docs
rm -rf *gradle*