From 2b81983f7c890aceee69fc8b5af5f8ff359100ec Mon Sep 17 00:00:00 2001 From: Joe Grandja Date: Mon, 20 Mar 2017 15:38:03 -0400 Subject: [PATCH] Update to Java 8 compatibility * Spring IO Athens-BUILD-SNAPSHOT -> Cairo-BUILD-SNAPSHOT * CGLib 3.1 -> 3.2.5 latest release Issue related to ASM https://github.com/cglib/cglib/issues/20 * AssertJ 2.2.0 -> 3.6.2 latest release * PowerMock 1.6.2 -> 1.6.5 latest release is 1.6.6 but has regression Issue https://github.com/powermock/powermock/issues/717 * Update maven-compiler-plugin source/target to 1.8 --- .../security/core/JavaVersionTests.java | 8 ++++---- gradle/javaprojects.gradle | 11 ++++++----- gradle/maven-deployment.gradle | 11 ++++++++--- ...SecurityContextHolderAwareRequestFilterTests.java | 12 ++++++------ 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/core/src/test/java/org/springframework/security/core/JavaVersionTests.java b/core/src/test/java/org/springframework/security/core/JavaVersionTests.java index f825c975916..71764407520 100644 --- a/core/src/test/java/org/springframework/security/core/JavaVersionTests.java +++ b/core/src/test/java/org/springframework/security/core/JavaVersionTests.java @@ -15,11 +15,11 @@ */ package org.springframework.security.core; +import org.junit.Test; + import java.io.DataInputStream; import java.io.InputStream; -import org.junit.Test; - import static org.assertj.core.api.Assertions.assertThat; /** @@ -29,7 +29,7 @@ */ public class JavaVersionTests { - private static final int JDK6_CLASS_VERSION = 50; + private static final int JDK8_CLASS_VERSION = 52; @Test public void authenticationCorrectJdkCompatibility() throws Exception { @@ -45,7 +45,7 @@ private void assertClassVersion(Class clazz) throws Exception { data.readInt(); data.readShort(); // minor int major = data.readShort(); - assertThat(major).isEqualTo(JDK6_CLASS_VERSION); + assertThat(major).isEqualTo(JDK8_CLASS_VERSION); } finally { try { diff --git a/gradle/javaprojects.gradle b/gradle/javaprojects.gradle index 12e100510f7..8c9db93a278 100644 --- a/gradle/javaprojects.gradle +++ b/gradle/javaprojects.gradle @@ -5,13 +5,13 @@ apply plugin: 'javadocHotfix' apply plugin: 'propdeps' apply plugin: 'propdeps-maven' -sourceCompatibility = 1.6 -targetCompatibility = 1.6 +sourceCompatibility = 1.8 +targetCompatibility = 1.8 ext.apacheDsVersion = '1.5.5' ext.aspectjVersion = '1.8.4' ext.casClientVersion = '3.4.1' -ext.cglibVersion = '3.1' +ext.cglibVersion = '3.2.5' ext.commonsCodecVersion = '1.10' ext.commonsCollectionsVersion = '3.2.2' ext.commonsLoggingVersion = '1.2' @@ -27,7 +27,7 @@ ext.jettyVersion = '6.1.26' ext.jstlVersion = '1.2.1' ext.junitVersion = '4.12' ext.logbackVersion = '1.1.2' -ext.powerMockVersion = '1.6.2' +ext.powerMockVersion = '1.6.5' ext.seleniumVersion = '2.44.0' ext.servletApiVersion = '3.1.0' ext.slf4jVersion = '1.7.7' @@ -41,6 +41,7 @@ ext.thymeleafVersion = '3.0.2.RELEASE' ext.jsonassertVersion = '1.3.0' ext.validationApiVersion = '1.1.0.Final' + ext.spockDependencies = [ dependencies.create("org.spockframework:spock-spring:$spockVersion") { exclude group: 'junit', module: 'junit-dep' @@ -148,7 +149,7 @@ dependencies { testCompile "junit:junit:$junitVersion", 'org.mockito:mockito-core:1.10.19', "org.springframework:spring-test:$springVersion", - 'org.assertj:assertj-core:2.2.0' + 'org.assertj:assertj-core:3.6.2' // Use slf4j/logback for logging testRuntime "org.slf4j:jcl-over-slf4j:$slf4jVersion", diff --git a/gradle/maven-deployment.gradle b/gradle/maven-deployment.gradle index c637eb01659..1d0e9cde8a1 100644 --- a/gradle/maven-deployment.gradle +++ b/gradle/maven-deployment.gradle @@ -67,7 +67,12 @@ def customizePom(pom, gradleProject) { developer { id = 'rwinch' name = 'Rob Winch' - email = 'rwinch@gopivotal.com' + email = 'rwinch@pivotal.io' + } + developer { + id = 'jgrandja' + name = 'Joe Grandja' + email = 'jgrandja@pivotal.io' } } @@ -113,8 +118,8 @@ def customizePom(pom, gradleProject) { .appendNode('plugin') .appendNode('artifactId','maven-compiler-plugin').parent() .appendNode('configuration') - .appendNode('source','1.7').parent() - .appendNode('target','1.7') + .appendNode('source','1.8').parent() + .appendNode('target','1.8') if(isWar) { plugins .appendNode('plugin') diff --git a/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java b/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java index 339e4d42aa3..59611c2c354 100644 --- a/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java +++ b/web/src/test/java/org/springframework/security/web/servletapi/SecurityContextHolderAwareRequestFilterTests.java @@ -331,9 +331,9 @@ public void run() { DelegatingSecurityContextRunnable wrappedRunnable = (DelegatingSecurityContextRunnable) runnableCaptor .getValue(); assertThat( - WhiteboxImpl.getInternalState(wrappedRunnable, "delegateSecurityContext")) + WhiteboxImpl.getInternalState(wrappedRunnable, "delegateSecurityContext")) .isEqualTo(context); - assertThat(WhiteboxImpl.getInternalState(wrappedRunnable, "delegate")) + assertThat(WhiteboxImpl.getInternalState(wrappedRunnable, "delegate")) .isEqualTo(runnable); } @@ -361,9 +361,9 @@ public void run() { DelegatingSecurityContextRunnable wrappedRunnable = (DelegatingSecurityContextRunnable) runnableCaptor .getValue(); assertThat( - WhiteboxImpl.getInternalState(wrappedRunnable, "delegateSecurityContext")) + WhiteboxImpl.getInternalState(wrappedRunnable, "delegateSecurityContext")) .isEqualTo(context); - assertThat(WhiteboxImpl.getInternalState(wrappedRunnable, "delegate")) + assertThat(WhiteboxImpl.getInternalState(wrappedRunnable, "delegate")) .isEqualTo(runnable); } @@ -392,9 +392,9 @@ public void run() { DelegatingSecurityContextRunnable wrappedRunnable = (DelegatingSecurityContextRunnable) runnableCaptor .getValue(); assertThat( - WhiteboxImpl.getInternalState(wrappedRunnable, "delegateSecurityContext")) + WhiteboxImpl.getInternalState(wrappedRunnable, "delegateSecurityContext")) .isEqualTo(context); - assertThat(WhiteboxImpl.getInternalState(wrappedRunnable, "delegate")) + assertThat(WhiteboxImpl.getInternalState(wrappedRunnable, "delegate")) .isEqualTo(runnable); }