From c4f2566070fde61fac8a04df4c61cbf273c2194e Mon Sep 17 00:00:00 2001 From: Juergen Hoeller Date: Wed, 1 May 2013 21:39:51 +0200 Subject: [PATCH] Allow for building and testing the 3.2.x line against OpenJDK 8 --- build.gradle | 7 +++++++ .../java/org/springframework/core/JdkVersion.java | 14 +++++++++++--- 2 files changed, 18 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 455638e263b..9d7178ea3e5 100644 --- a/build.gradle +++ b/build.gradle @@ -12,6 +12,11 @@ configure(allprojects) { project -> group = "org.springframework" version = qualifyVersionIfNecessary(version) + // The following is a work-around until the Gradle build uses + // Ant 1.9.x by default. This is necessary to avoid the + // "Class not found: javac1.8" issue with Ant versions prior to 1.9.x + ant.properties["build.compiler"] = "javac1.7" + ext.aspectjVersion = "1.7.2" ext.hsqldbVersion = "1.8.0.10" ext.junitVersion = "4.11" @@ -118,6 +123,7 @@ configure(subprojects - project(":spring-build-src")) { subproject -> options.author = true options.header = project.name options.links(project.ext.javadocLinks) + options.addStringOption('Xdoclint:none', '-quiet') // suppress warnings due to cross-module @see and @link references; // note that global 'api' task does display all warnings. @@ -811,6 +817,7 @@ configure(rootProject) { options.stylesheetFile = file("src/api/stylesheet.css") options.splitIndex = true options.links(project.ext.javadocLinks) + options.addStringOption('Xdoclint:none', '-quiet') source subprojects.collect { project -> project.sourceSets.main.allJava diff --git a/spring-core/src/main/java/org/springframework/core/JdkVersion.java b/spring-core/src/main/java/org/springframework/core/JdkVersion.java index b66c85b9deb..a77f75ff520 100644 --- a/spring-core/src/main/java/org/springframework/core/JdkVersion.java +++ b/spring-core/src/main/java/org/springframework/core/JdkVersion.java @@ -1,5 +1,5 @@ /* - * Copyright 2002-2012 the original author or authors. + * Copyright 2002-2013 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. @@ -54,6 +54,11 @@ public abstract class JdkVersion { */ public static final int JAVA_17 = 4; + /** + * Constant identifying the 1.8 JVM (Java 8). + */ + public static final int JAVA_18 = 5; + private static final String javaVersion; @@ -62,7 +67,10 @@ public abstract class JdkVersion { static { javaVersion = System.getProperty("java.version"); // version String should look like "1.4.2_10" - if (javaVersion.contains("1.7.")) { + if (javaVersion.contains("1.8.")) { + majorJavaVersion = JAVA_18; + } + else if (javaVersion.contains("1.7.")) { majorJavaVersion = JAVA_17; } else if (javaVersion.contains("1.6.")) { @@ -87,7 +95,7 @@ public abstract class JdkVersion { /** * Get the major version code. This means we can do things like - * {@code if (getMajorJavaVersion() < JAVA_14)}. + * {@code if (getMajorJavaVersion() >= JAVA_17)}. * @return a code comparable to the JAVA_XX codes in this class * @see #JAVA_13 * @see #JAVA_14