Update test source and target JDK compatibility
"test" source and target compatibility has been upgraded to 1.7 except where noted, allowing us to use 1.7 language features such as diamond-style (<>) generics declarations, automatic resource management and multi-catch. More importantly, we will be able to upgrade to 1.8 once it is available in order to make use of lambda expressions, etc in our test cases. IDE configurations must be relaxed to allow 1.7 across the board, as neither Eclipse nor IDEA are clever enough to allow for different language levels across production and test resources. See [1] for a feature request on that front. spring-oxm is a special case here, and has been pinned at 1.6 compatibility even for its test sources in order to avoid a class verification error that JibX throws when encountering 1.7-level bytecode [2]. Likewise with spring-orm, toplink encounters a similar class verification error, so has been pinned to 1.6 for the time being. When we remove the (already deprecated since 3.2) Toplink support we can restore compatibility to 1.7. [1]: http://youtrack.jetbrains.com/issue/IDEA-97814 [2]: http://jira.codehaus.org/browse/JIBX-465 Issue: SPR-10129
This commit is contained in:
26
build.gradle
26
build.gradle
@@ -32,8 +32,14 @@ configure(allprojects) {
|
||||
|
||||
group = "org.springframework"
|
||||
|
||||
sourceCompatibility=1.5
|
||||
targetCompatibility=1.5
|
||||
compileJava {
|
||||
sourceCompatibility=1.5
|
||||
targetCompatibility=1.5
|
||||
}
|
||||
compileTestJava {
|
||||
sourceCompatibility=1.7
|
||||
targetCompatibility=1.7
|
||||
}
|
||||
|
||||
[compileJava, compileTestJava]*.options*.compilerArgs = [
|
||||
"-Xlint:serial",
|
||||
@@ -333,6 +339,14 @@ project("spring-tx") {
|
||||
project("spring-oxm") {
|
||||
description = "Spring Object/XML Marshalling"
|
||||
apply from: "oxm.gradle"
|
||||
|
||||
compileTestJava {
|
||||
// necessary to avoid java.lang.VerifyError on jibx compilation
|
||||
// see http://jira.codehaus.org/browse/JIBX-465
|
||||
sourceCompatibility=1.6
|
||||
targetCompatibility=1.6
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile(project(":spring-beans"))
|
||||
compile(project(":spring-core"))
|
||||
@@ -458,6 +472,14 @@ project("spring-web") {
|
||||
|
||||
project("spring-orm") {
|
||||
description = "Spring Object/Relational Mapping"
|
||||
|
||||
compileTestJava {
|
||||
// necessary to avoid java.lang.VerifyError on toplink compilation
|
||||
// TODO: remove this block when we remove toplink
|
||||
sourceCompatibility=1.6
|
||||
targetCompatibility=1.6
|
||||
}
|
||||
|
||||
dependencies {
|
||||
compile("aopalliance:aopalliance:1.0")
|
||||
optional("org.hibernate:hibernate-core:3.3.2.GA")
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2011 the original author or authors.
|
||||
* Copyright 2002-2012 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
@@ -29,6 +29,8 @@ import org.springframework.oxm.AbstractUnmarshallerTests;
|
||||
import org.springframework.oxm.MarshallingException;
|
||||
import org.springframework.oxm.Unmarshaller;
|
||||
|
||||
import static org.hamcrest.CoreMatchers.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
@@ -66,7 +68,7 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
|
||||
protected void testFlight(Object o) {
|
||||
Flight flight = (Flight) o;
|
||||
assertNotNull("Flight is null", flight);
|
||||
assertEquals("Number is invalid", 42L, flight.getNumber());
|
||||
assertThat("Number is invalid", flight.getNumber(), equalTo(42L));
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -104,10 +106,10 @@ public class CastorUnmarshallerTests extends AbstractUnmarshallerTests {
|
||||
assertEquals("Invalid amount of items", 2, order.getOrderItemCount());
|
||||
OrderItem item = order.getOrderItem(0);
|
||||
assertEquals("Invalid items", "1", item.getId());
|
||||
assertEquals("Invalid items", 15, item.getQuantity());
|
||||
assertThat("Invalid items", item.getQuantity(), equalTo(15));
|
||||
item = order.getOrderItem(1);
|
||||
assertEquals("Invalid items", "3", item.getId());
|
||||
assertEquals("Invalid items", 20, item.getQuantity());
|
||||
assertThat("Invalid items", item.getQuantity(), equalTo(20));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
Reference in New Issue
Block a user