1 /*
2 * Copyright 2009-2023 the original author or authors.
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * https://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16 package org.apache.ibatis.reflection;
17
18 import org.apache.ibatis.io.Resources;
19
20 /**
21 * To check the existence of version dependent classes.
22 */
23 public class Jdk {
24
25 /**
26 * <code>true</code> if <code>java.lang.reflect.Parameter</code> is available.
27 *
28 * @deprecated Since 3.5.0, Will remove this field at feature(next major version up)
29 */
30 @Deprecated
31 public static final boolean parameterExists;
32
33 static {
34 boolean available = false;
35 try {
36 Resources.classForName("java.lang.reflect.Parameter");
37 available = true;
38 } catch (ClassNotFoundException e) {
39 // ignore
40 }
41 parameterExists = available;
42 }
43
44 /**
45 * @deprecated Since 3.5.0, Will remove this field at feature(next major version up)
46 */
47 @Deprecated
48 public static final boolean dateAndTimeApiExists;
49
50 static {
51 boolean available = false;
52 try {
53 Resources.classForName("java.time.Clock");
54 available = true;
55 } catch (ClassNotFoundException e) {
56 // ignore
57 }
58 dateAndTimeApiExists = available;
59 }
60
61 /**
62 * @deprecated Since 3.5.0, Will remove this field at feature(next major version up)
63 */
64 @Deprecated
65 public static final boolean optionalExists;
66
67 static {
68 boolean available = false;
69 try {
70 Resources.classForName("java.util.Optional");
71 available = true;
72 } catch (ClassNotFoundException e) {
73 // ignore
74 }
75 optionalExists = available;
76 }
77
78 private Jdk() {
79 }
80 }