1
1
/*
2
- * Copyright 2012-2017 the original author or authors.
2
+ * Copyright 2012-2019 the original author or authors.
3
3
*
4
4
* Licensed under the Apache License, Version 2.0 (the "License");
5
5
* you may not use this file except in compliance with the License.
19
19
import java .util .Arrays ;
20
20
import java .util .Collections ;
21
21
import java .util .List ;
22
+ import java .util .Optional ;
22
23
23
24
import org .springframework .util .ClassUtils ;
24
25
25
26
/**
26
- * Supported Java versions.
27
+ * Known Java versions.
27
28
*
28
29
* @author Oliver Gierke
29
30
* @author Phillip Webb
@@ -34,20 +35,40 @@ public enum JavaVersion {
34
35
/**
35
36
* Java 1.8.
36
37
*/
37
- EIGHT ("1.8" , "java.util.function.Function " ),
38
+ EIGHT ("1.8" , Optional . class , "empty " ),
38
39
39
40
/**
40
41
* Java 1.9.
41
42
*/
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" );
43
64
44
65
private final String name ;
45
66
46
67
private final boolean available ;
47
68
48
- JavaVersion (String name , String className ) {
69
+ JavaVersion (String name , Class <?> clazz , String methodName ) {
49
70
this .name = name ;
50
- this .available = ClassUtils .isPresent ( className , getClass (). getClassLoader () );
71
+ this .available = ClassUtils .hasMethod ( clazz , methodName );
51
72
}
52
73
53
74
@ Override
0 commit comments