- Add patch to build with jdk8:

* junit-jdk8.patch

OBS-URL: https://build.opensuse.org/package/show/Java:packages/junit?expand=0&rev=10
This commit is contained in:
Tomáš Chvátal 2015-07-28 07:53:42 +00:00 committed by Git OBS Bridge
parent d0c174ccce
commit 349f40a6e7
3 changed files with 50 additions and 3 deletions

41
junit-jdk8.patch Normal file
View File

@ -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
* <li>is not static (given {@code isStatic is true}).
*/
public void validatePublicVoid(boolean isStatic, List<Throwable> 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,

View File

@ -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

View File

@ -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