From 349f40a6e758e338b3d5751149b6bd5c61d153f34268931601d2c26ad75321f5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Tom=C3=A1=C5=A1=20Chv=C3=A1tal?= Date: Tue, 28 Jul 2015 07:53:42 +0000 Subject: [PATCH] - Add patch to build with jdk8: * junit-jdk8.patch OBS-URL: https://build.opensuse.org/package/show/Java:packages/junit?expand=0&rev=10 --- junit-jdk8.patch | 41 +++++++++++++++++++++++++++++++++++++++++ junit.changes | 6 ++++++ junit.spec | 6 +++--- 3 files changed, 50 insertions(+), 3 deletions(-) create mode 100644 junit-jdk8.patch diff --git a/junit-jdk8.patch b/junit-jdk8.patch new file mode 100644 index 0000000..a44b70d --- /dev/null +++ b/junit-jdk8.patch @@ -0,0 +1,41 @@ +Index: junit-r4.11/src/main/java/org/junit/runners/model/FrameworkMethod.java +=================================================================== +--- junit-r4.11.orig/src/main/java/org/junit/runners/model/FrameworkMethod.java ++++ junit-r4.11/src/main/java/org/junit/runners/model/FrameworkMethod.java +@@ -83,14 +83,11 @@ public class FrameworkMethod extends Fra + *
  • is not static (given {@code isStatic is true}). + */ + public void validatePublicVoid(boolean isStatic, List errors) { +- if (Modifier.isStatic(fMethod.getModifiers()) != isStatic) { ++ if (isStatic() != isStatic) { + String state = isStatic ? "should" : "should not"; + errors.add(new Exception("Method " + fMethod.getName() + "() " + state + " be static")); + } +- if (!Modifier.isPublic(fMethod.getDeclaringClass().getModifiers())) { +- errors.add(new Exception("Class " + fMethod.getDeclaringClass().getName() + " should be public")); +- } +- if (!Modifier.isPublic(fMethod.getModifiers())) { ++ if (!isPublic()) { + errors.add(new Exception("Method " + fMethod.getName() + "() should be public")); + } + if (fMethod.getReturnType() != Void.TYPE) { +Index: junit-r4.11/src/test/java/org/junit/tests/AllTests.java +=================================================================== +--- junit-r4.11.orig/src/test/java/org/junit/tests/AllTests.java ++++ junit-r4.11/src/test/java/org/junit/tests/AllTests.java +@@ -77,7 +77,6 @@ import org.junit.tests.running.methods.T + import org.junit.tests.running.methods.TimeoutTest; + import org.junit.tests.validation.BadlyFormedClassesTest; + import org.junit.tests.validation.FailedConstructionTest; +-import org.junit.tests.validation.InaccessibleBaseClassTest; + import org.junit.tests.validation.ValidationTest; + + // These test files need to be cleaned. See +@@ -118,7 +117,6 @@ import org.junit.tests.validation.Valida + JUnit38ClassRunnerTest.class, + SystemExitTest.class, + JUnitCoreReturnsCorrectExitCodeTest.class, +- InaccessibleBaseClassTest.class, + SuiteMethodTest.class, + BadlyFormedClassesTest.class, + IgnoreClassTest.class, diff --git a/junit.changes b/junit.changes index 5ff4b4a..69522b5 100644 --- a/junit.changes +++ b/junit.changes @@ -1,3 +1,9 @@ +------------------------------------------------------------------- +Tue Jul 28 07:53:29 UTC 2015 - tchvatal@suse.com + +- Add patch to build with jdk8: + * junit-jdk8.patch + ------------------------------------------------------------------- Wed Mar 18 09:46:15 UTC 2015 - tchvatal@suse.com diff --git a/junit.spec b/junit.spec index c98a9be..30057b5 100644 --- a/junit.spec +++ b/junit.spec @@ -28,6 +28,8 @@ Source0: https://github.com/junit-team/junit/archive/r%{version}.tar.gz Source1: junit-4.11.pom #PATCH-FIX-OPENSUSE: do not use bundled hamcrest sources, which btw fixes hamcrest build with junit4 Patch0: junit-no-hamcrest-src.patch +#PATCH-FIX-UPSTREAM: build with jdk8 and newer, already in upstream repo +Patch1: junit-jdk8.patch BuildRequires: ant BuildRequires: hamcrest >= 1.3 BuildRequires: java-devel >= 1.6.0 @@ -79,15 +81,13 @@ Demos for %{name}. %prep %setup -q -n junit-r%{version} %patch0 -p1 +%patch1 -p1 find . -type f -name "*.jar" -or -name "*.class" | xargs -t rm -rf ln -s $(build-classpath hamcrest/core) lib/hamcrest-core-1.3.jar %build -#export CLASSPATH= -#export OPT_JAR_LIST=: -#ant -Dant.build.javac.source=1.5 dist ant dist -Dversion-status= %install