Accepting request 962948 from Java:packages

Fix build with jdk 17

OBS-URL: https://build.opensuse.org/request/show/962948
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/hamcrest?expand=0&rev=28
This commit is contained in:
Dominique Leuenberger 2022-03-28 14:59:11 +00:00 committed by Git OBS Bridge
commit 517281107b
4 changed files with 86 additions and 5 deletions

View File

@ -24,15 +24,17 @@ index 1cfd4fb..5a7c740 100644
<javadoc packagenames="org.hamcrest.*" defaultexcludes="yes"
destdir="build/temp/hamcrest-all-${version}-javadoc.jar.contents" author="true" version="true" use="true"
- windowtitle="Hamcrest" source="1.6" failonerror="yes" overview="overview.html">
+ windowtitle="Hamcrest" source="1.6" failonerror="yes">
+ windowtitle="Hamcrest" source="1.8" failonerror="yes">
+ <arg value="-Xdoclint:none"/>
<classpath>
<fileset dir="lib/integration">
<include name="*.jar"/>
@@ -313,6 +314,7 @@
@@ -313,7 +314,8 @@
<sequential>
<javadoc packagenames="org.hamcrest.*" sourcepath="build/temp/@{modulename}-${version}-sources.jar.contents" defaultexcludes="yes"
destdir="build/temp/@{modulename}-${version}-javadoc.jar.contents" author="true" version="true" use="true"
windowtitle="Hamcrest" source="1.6" failonerror="yes">
- windowtitle="Hamcrest" source="1.6" failonerror="yes">
+ windowtitle="Hamcrest" source="1.8" failonerror="yes">
+ <arg value="-Xdoclint:none"/>
<classpath>
<fileset dir="lib/integration">

66
hamcrest-matchers.patch Normal file
View File

@ -0,0 +1,66 @@
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java 2022-03-18 20:35:38.293788586 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-core/src/main/java/org/hamcrest/core/AllOf.java 2022-03-18 20:46:34.534452749 +0100
@@ -57,7 +57,7 @@
*/
@Factory
public static <T> Matcher<T> allOf(Matcher<? super T>... matchers) {
- return allOf(Arrays.asList(matchers));
+ return new AllOf<T>(Arrays.asList(matchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java 2022-03-18 20:35:38.293788586 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-core/src/main/java/org/hamcrest/core/AnyOf.java 2022-03-18 20:39:13.031315993 +0100
@@ -47,7 +47,7 @@
*/
@Factory
public static <T> AnyOf<T> anyOf(Matcher<? super T>... matchers) {
- return anyOf(Arrays.asList(matchers));
+ return new AnyOf<T>(Arrays.asList(matchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java 2022-03-18 20:35:38.297788614 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInAnyOrder.java 2022-03-18 20:49:03.047502492 +0100
@@ -55,7 +55,7 @@
*/
@Factory
public static <E> Matcher<E[]> arrayContainingInAnyOrder(Matcher<? super E>... itemMatchers) {
- return arrayContainingInAnyOrder(Arrays.asList(itemMatchers));
+ return new IsArrayContainingInAnyOrder<E>(Arrays.asList(itemMatchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java 2022-03-18 20:35:38.297788614 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsArrayContainingInOrder.java 2022-03-18 20:49:57.623888266 +0100
@@ -69,7 +69,7 @@
*/
@Factory
public static <E> Matcher<E[]> arrayContaining(Matcher<? super E>... itemMatchers) {
- return arrayContaining(asList(itemMatchers));
+ return new IsArrayContainingInOrder<E>(asList(itemMatchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java 2022-03-18 20:35:38.297788614 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInAnyOrder.java 2022-03-18 20:56:50.738808383 +0100
@@ -122,7 +122,7 @@
*/
@Factory
public static <T> Matcher<Iterable<? extends T>> containsInAnyOrder(Matcher<? super T>... itemMatchers) {
- return containsInAnyOrder(Arrays.asList(itemMatchers));
+ return new IsIterableContainingInAnyOrder<T>(Arrays.asList(itemMatchers));
}
/**
--- JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java 2022-03-18 20:35:38.297788614 +0100
+++ JavaHamcrest-hamcrest-java-1.3/hamcrest-library/src/main/java/org/hamcrest/collection/IsIterableContainingInOrder.java 2022-03-18 21:21:22.189211465 +0100
@@ -138,7 +138,7 @@
*/
@Factory
public static <E> Matcher<Iterable<? extends E>> contains(Matcher<? super E>... itemMatchers) {
- return contains(asList(itemMatchers));
+ return new IsIterableContainingInOrder<E>(asList(itemMatchers));
}
/**

View File

@ -1,3 +1,13 @@
-------------------------------------------------------------------
Fri Mar 18 20:25:15 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Modified patch:
* hamcrest-1.3-build.patch
+ Build with source/target levels 8
- Added patch:
* hamcrest-matchers.patch
+ Fix build with jdk17
-------------------------------------------------------------------
Tue Jan 5 13:20:25 UTC 2021 - Pedro Monreal <pmonreal@suse.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package hamcrest
#
# Copyright (c) 2021 SUSE LLC
# Copyright (c) 2022 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -39,8 +39,10 @@ Patch6: %{name}-%{version}-javadoc9.patch
Patch7: %{name}-%{version}-javadoc10.patch
Patch8: %{name}-%{version}-random-build-crash.patch
Patch9: hamcrest-reproducible-builds.patch
Patch10: hamcrest-matchers.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
BuildRequires: qdox >= 2.0
Requires: %{name}-core = %{version}-%{release}
@ -114,12 +116,13 @@ rm -fr hamcrest-integration/src/main/java/org/hamcrest/EasyMock2Matchers.java
%patch7 -p1
%patch8 -p1
%patch9 -p1
%patch10 -p1
sed -i 's/\r//' LICENSE.txt
%build
export CLASSPATH=$(build-classpath qdox)
ant -Dant.build.javac.source=1.6 -Dant.build.javac.target=1.6 -Dversion=%{version} -Dbuild.sysclasspath=last clean core generator library bigjar javadoc
ant -Dant.build.javac.source=1.8 -Dant.build.javac.target=1.8 -Dversion=%{version} -Dbuild.sysclasspath=last clean core generator library bigjar javadoc
# inject OSGi manifests
jar ufm build/%{name}-core-%{version}.jar %{SOURCE8}