Skip to content

Commit 01110f6

Browse files
committed
Upgrade JiBX (and BCEL) towards support of 1.8 bytecode level
This commit also drops the now-unused CUSTOM_COMPILATION test group and the outdated JavaVersion class. Issue: SPR-10423
1 parent 0aeb306 commit 01110f6

File tree

8 files changed

+25
-138
lines changed

8 files changed

+25
-138
lines changed

build.gradle

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -514,13 +514,6 @@ project("spring-oxm") {
514514
description = "Spring Object/XML Marshalling"
515515
apply from: "oxm.gradle"
516516

517-
compileTestJava {
518-
// necessary to avoid java.lang.VerifyError on jibx compilation
519-
// see http://jira.codehaus.org/browse/JIBX-465
520-
sourceCompatibility = 1.8
521-
targetCompatibility = 1.8
522-
}
523-
524517
dependencies {
525518
compile(project(":spring-beans"))
526519
compile(project(":spring-core"))
@@ -539,10 +532,8 @@ project("spring-oxm") {
539532
testCompile("org.codehaus.jettison:jettison:1.3.7") {
540533
exclude group: 'stax', module: 'stax-api'
541534
}
542-
if (compileTestJava.enabled) {
543-
testCompile(files(genCastor.classesDir).builtBy(genCastor))
544-
testCompile(files(genJaxb.classesDir).builtBy(genJaxb))
545-
}
535+
testCompile(files(genCastor.classesDir).builtBy(genCastor))
536+
testCompile(files(genJaxb.classesDir).builtBy(genJaxb))
546537
testRuntime("xerces:xercesImpl:2.11.0") // for Castor
547538
testRuntime("javax.xml.bind:jaxb-api:${jaxbVersion}")
548539
testRuntime("com.sun.xml.bind:jaxb-core:${jaxbVersion}")

spring-core/src/test/java/org/springframework/tests/JavaVersion.java

Lines changed: 0 additions & 95 deletions
This file was deleted.

spring-core/src/test/java/org/springframework/tests/TestGroup.java

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -58,14 +58,7 @@ public enum TestGroup {
5858
/**
5959
* Tests that should only be run on the continuous integration server.
6060
*/
61-
CI,
62-
63-
/**
64-
* Tests that require custom compilation beyond that of the standard JDK. This helps to
65-
* allow running tests that will otherwise fail when using JDK > 1.8 b88. See
66-
* <a href="https://jira.spring.io/browse/SPR-10558">SPR-10558</a>
67-
*/
68-
CUSTOM_COMPILATION;
61+
CI;
6962

7063

7164
/**

spring-core/src/test/java/org/springframework/tests/TestGroupTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ public class TestGroupTests {
3838
@Rule
3939
public ExpectedException thrown = ExpectedException.none();
4040

41+
4142
@Test
4243
public void parseNull() throws Exception {
4344
assertThat(TestGroup.parse(null), equalTo(Collections.<TestGroup> emptySet()));
@@ -65,7 +66,7 @@ public void parseMissing() throws Exception {
6566
thrown.expect(IllegalArgumentException.class);
6667
thrown.expectMessage("Unable to find test group 'missing' when parsing " +
6768
"testGroups value: 'performance, missing'. Available groups include: " +
68-
"[LONG_RUNNING,PERFORMANCE,JMXMP,CI,CUSTOM_COMPILATION]");
69+
"[LONG_RUNNING,PERFORMANCE,JMXMP,CI]");
6970
TestGroup.parse("performance, missing");
7071
}
7172

@@ -77,9 +78,8 @@ public void parseAll() throws Exception {
7778
@Test
7879
public void parseAllExcept() throws Exception {
7980
Set<TestGroup> expected = new HashSet<>(EnumSet.allOf(TestGroup.class));
80-
expected.remove(TestGroup.CUSTOM_COMPILATION);
8181
expected.remove(TestGroup.PERFORMANCE);
82-
assertThat(TestGroup.parse("all-custom_compilation,performance"), equalTo(expected));
82+
assertThat(TestGroup.parse("all-performance"), equalTo(expected));
8383
}
8484

8585
}

spring-oxm/oxm.gradle

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ configurations {
66
dependencies {
77
castor "org.codehaus.castor:castor-anttasks:1.4.1"
88
jibx "org.jibx:jibx-bind:1.2.6"
9+
jibx "org.apache.bcel:bcel:6.0"
910
xjc 'com.sun.xml.bind:jaxb-xjc:2.2.11'
1011
xjc 'javax.xml.bind:jaxb-api:2.2.11'
1112
xjc 'com.sun.xml.bind:jaxb-core:2.2.11'
@@ -91,10 +92,8 @@ task genJaxb {
9192
}
9293
}
9394

94-
// add jibx binding to the normal test compilation process
95-
// INCOMPATIBLE WITH OPENJDK 8 b89+
96-
def jibxEnabled = project.properties.get("testGroups")?.toLowerCase()?.split(",")?.contains("custom_compilation")
97-
if (jibxEnabled) {
95+
// JiBX compiler is currently not compatible with JDK 9
96+
if (JavaVersion.current() == JavaVersion.VERSION_1_8) {
9897
compileTestJava {
9998
def bindingXml = "${projectDir}/src/test/resources/org/springframework/oxm/jibx/binding.xml"
10099

spring-oxm/src/test/java/org/springframework/oxm/jibx/Flights.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,10 @@
1717
package org.springframework.oxm.jibx;
1818

1919
import java.util.ArrayList;
20-
import java.util.List;
2120

2221
public class Flights {
2322

24-
protected List<FlightType> flightList = new ArrayList<>();
23+
protected ArrayList<FlightType> flightList = new ArrayList<>();
2524

2625
public void addFlight(FlightType flight) {
2726
flightList.add(flight);

spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxMarshallerTests.java

Lines changed: 10 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -16,19 +16,17 @@
1616

1717
package org.springframework.oxm.jibx;
1818

19+
import java.io.StringWriter;
20+
import javax.xml.transform.stream.StreamResult;
21+
22+
import org.junit.Assume;
1923
import org.junit.BeforeClass;
2024
import org.junit.Test;
21-
import org.springframework.oxm.AbstractMarshallerTests;
22-
import org.springframework.tests.Assume;
23-
import org.springframework.tests.TestGroup;
2425

25-
import javax.xml.transform.stream.StreamResult;
26-
import java.io.StringWriter;
26+
import org.springframework.oxm.AbstractMarshallerTests;
2727

28-
import static org.junit.Assert.assertFalse;
29-
import static org.junit.Assert.assertThat;
30-
import static org.junit.Assert.assertTrue;
31-
import static org.xmlunit.matchers.CompareMatcher.isSimilarTo;
28+
import static org.junit.Assert.*;
29+
import static org.xmlunit.matchers.CompareMatcher.*;
3230

3331
/**
3432
* NOTE: These tests fail under Eclipse/IDEA because JiBX binding does not occur by
@@ -41,7 +39,8 @@ public class JibxMarshallerTests extends AbstractMarshallerTests<JibxMarshaller>
4139

4240
@BeforeClass
4341
public static void compilerAssumptions() {
44-
Assume.group(TestGroup.CUSTOM_COMPILATION);
42+
// JiBX compiler is currently not compatible with JDK 9
43+
Assume.assumeTrue(System.getProperty("java.version").startsWith("1.8."));
4544
}
4645

4746
@Override

spring-oxm/src/test/java/org/springframework/oxm/jibx/JibxUnmarshallerTests.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2002-2015 the original author or authors.
2+
* Copyright 2002-2016 the original author or authors.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -19,12 +19,11 @@
1919
import java.io.ByteArrayInputStream;
2020
import javax.xml.transform.stream.StreamSource;
2121

22+
import org.junit.Assume;
2223
import org.junit.BeforeClass;
2324
import org.junit.Test;
2425

2526
import org.springframework.oxm.AbstractUnmarshallerTests;
26-
import org.springframework.tests.Assume;
27-
import org.springframework.tests.TestGroup;
2827

2928
import static org.junit.Assert.*;
3029

@@ -41,9 +40,11 @@ public class JibxUnmarshallerTests extends AbstractUnmarshallerTests<JibxMarshal
4140
"<tns:flights xmlns:tns=\"http://samples.springframework.org/flight\">" +
4241
"<tns:flight><tns:airline>Air Libert\u00e9</tns:airline><tns:number>42</tns:number></tns:flight></tns:flights>";
4342

43+
4444
@BeforeClass
4545
public static void compilerAssumptions() {
46-
Assume.group(TestGroup.CUSTOM_COMPILATION);
46+
// JiBX compiler is currently not compatible with JDK 9
47+
Assume.assumeTrue(System.getProperty("java.version").startsWith("1.8."));
4748
}
4849

4950

0 commit comments

Comments
 (0)