Preparations for JDK 9
Issue: SPR-12549
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2014 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -25,6 +25,7 @@ import java.util.List;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
|
||||
import org.springframework.core.JdkVersion;
|
||||
import org.springframework.core.io.Resource;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
@@ -82,7 +83,8 @@ public class PathMatchingResourcePatternResolverTests {
|
||||
public void testSingleResourceInJar() throws IOException {
|
||||
Resource[] resources = resolver.getResources("java/net/URL.class");
|
||||
assertEquals(1, resources.length);
|
||||
assertProtocolAndFilename(resources[0], "jar", "URL.class");
|
||||
String expectedProtocol = (JdkVersion.getMajorJavaVersion() < JdkVersion.JAVA_19 ? "jar" : "jrt");
|
||||
assertProtocolAndFilename(resources[0], expectedProtocol, "URL.class");
|
||||
}
|
||||
|
||||
@Ignore // passes under eclipse, fails under ant
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -24,12 +24,6 @@ package org.springframework.tests;
|
||||
*/
|
||||
public enum JavaVersion {
|
||||
|
||||
|
||||
/**
|
||||
* Java 1.5
|
||||
*/
|
||||
JAVA_15("1.5", 15),
|
||||
|
||||
/**
|
||||
* Java 1.6
|
||||
*/
|
||||
@@ -43,7 +37,12 @@ public enum JavaVersion {
|
||||
/**
|
||||
* Java 1.8
|
||||
*/
|
||||
JAVA_18("1.8", 18);
|
||||
JAVA_18("1.8", 18),
|
||||
|
||||
/**
|
||||
* Java 1.9
|
||||
*/
|
||||
JAVA_19("1.9", 19);
|
||||
|
||||
|
||||
private static final JavaVersion runningVersion = findRunningVersion();
|
||||
@@ -55,7 +54,7 @@ public enum JavaVersion {
|
||||
return candidate;
|
||||
}
|
||||
}
|
||||
return JavaVersion.JAVA_15;
|
||||
return JavaVersion.JAVA_16;
|
||||
}
|
||||
|
||||
|
||||
@@ -81,16 +80,16 @@ public enum JavaVersion {
|
||||
* @return {@code true} if the specified version is at least this version
|
||||
*/
|
||||
public boolean isAtLeast(JavaVersion version) {
|
||||
return this.value >= version.value;
|
||||
return (this.value >= version.value);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns the current running JDK version. If the current version cannot be
|
||||
* determined {@link #JAVA_15} will be returned.
|
||||
* determined {@link #JAVA_16} will be returned.
|
||||
* @return the JDK version
|
||||
*/
|
||||
public static JavaVersion runningVersion() {
|
||||
return runningVersion;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright 2002-2013 the original author or authors.
|
||||
* Copyright 2002-2015 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.
|
||||
@@ -36,8 +36,8 @@ public class JavaVersionTests {
|
||||
|
||||
@Test
|
||||
public void isAtLeast() throws Exception {
|
||||
assertTrue(JavaVersion.JAVA_16.isAtLeast(JavaVersion.JAVA_15));
|
||||
assertTrue(JavaVersion.JAVA_16.isAtLeast(JavaVersion.JAVA_16));
|
||||
assertFalse(JavaVersion.JAVA_16.isAtLeast(JavaVersion.JAVA_17));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user