From 954f612f877119b3dd9ebe6845ced48c20a46ec0 Mon Sep 17 00:00:00 2001 From: Mikolaj Izdebski Date: Tue, 5 Nov 2019 08:15:22 +0100 Subject: [PATCH] Fix build with OpenJDK 11 --- 0001-Fix-build-with-OpenJDK-11.patch | 131 +++++++++++++++++++++++++++ hamcrest.spec | 37 +------- 2 files changed, 136 insertions(+), 32 deletions(-) create mode 100644 0001-Fix-build-with-OpenJDK-11.patch diff --git a/0001-Fix-build-with-OpenJDK-11.patch b/0001-Fix-build-with-OpenJDK-11.patch new file mode 100644 index 0000000..4e882e2 --- /dev/null +++ b/0001-Fix-build-with-OpenJDK-11.patch @@ -0,0 +1,131 @@ +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 + diff --git a/hamcrest.spec b/hamcrest.spec index cab78ba..9551f7a 100644 --- a/hamcrest.spec +++ b/hamcrest.spec @@ -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*