Skip to content

Commit 0ff4484

Browse files
committed
Merge branch '2.1.x'
Closes gh-17599
2 parents 888b2e1 + 260acd0 commit 0ff4484

File tree

1 file changed

+27
-6
lines changed
  • spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system

1 file changed

+27
-6
lines changed

spring-boot-project/spring-boot/src/main/java/org/springframework/boot/system/JavaVersion.java

Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2012-2017 the original author or authors.
2+
* Copyright 2012-2019 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,11 +19,12 @@
1919
import java.util.Arrays;
2020
import java.util.Collections;
2121
import java.util.List;
22+
import java.util.Optional;
2223

2324
import org.springframework.util.ClassUtils;
2425

2526
/**
26-
* Supported Java versions.
27+
* Known Java versions.
2728
*
2829
* @author Oliver Gierke
2930
* @author Phillip Webb
@@ -34,20 +35,40 @@ public enum JavaVersion {
3435
/**
3536
* Java 1.8.
3637
*/
37-
EIGHT("1.8", "java.util.function.Function"),
38+
EIGHT("1.8", Optional.class, "empty"),
3839

3940
/**
4041
* Java 1.9.
4142
*/
42-
NINE("1.9", "java.security.cert.URICertStoreParameters");
43+
NINE("1.9", Optional.class, "stream"),
44+
45+
/**
46+
* Java 10.
47+
*/
48+
TEN("10", Optional.class, "orElseThrow"),
49+
50+
/**
51+
* Java 11.
52+
*/
53+
ELEVEN("11", String.class, "strip"),
54+
55+
/**
56+
* Java 12.
57+
*/
58+
TWELVE("12", String.class, "describeConstable"),
59+
60+
/**
61+
* Java 13.
62+
*/
63+
THIRTEEN("13", String.class, "stripIndent");
4364

4465
private final String name;
4566

4667
private final boolean available;
4768

48-
JavaVersion(String name, String className) {
69+
JavaVersion(String name, Class<?> clazz, String methodName) {
4970
this.name = name;
50-
this.available = ClassUtils.isPresent(className, getClass().getClassLoader());
71+
this.available = ClassUtils.hasMethod(clazz, methodName);
5172
}
5273

5374
@Override

0 commit comments

Comments
 (0)