1 /* |
1 /* |
2 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved. |
2 * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
4 * |
4 * |
5 * This code is free software; you can redistribute it and/or modify it |
5 * This code is free software; you can redistribute it and/or modify it |
6 * under the terms of the GNU General Public License version 2 only, as |
6 * under the terms of the GNU General Public License version 2 only, as |
7 * published by the Free Software Foundation. Oracle designates this |
7 * published by the Free Software Foundation. Oracle designates this |
61 "@@VERSION_OPT@@"; |
61 "@@VERSION_OPT@@"; |
62 |
62 |
63 private static final boolean isLTS = |
63 private static final boolean isLTS = |
64 "@@VERSION_OPT@@".startsWith("LTS"); |
64 "@@VERSION_OPT@@".startsWith("LTS"); |
65 |
65 |
|
66 private static final String CLASSFILE_MAJOR_MINOR = |
|
67 "@@VERSION_CLASSFILE_MAJOR@@.@@VERSION_CLASSFILE_MINOR@@"; |
|
68 |
66 private static final String VENDOR_VERSION_STRING = |
69 private static final String VENDOR_VERSION_STRING = |
67 "@@VENDOR_VERSION_STRING@@"; |
70 "@@VENDOR_VERSION_STRING@@"; |
68 |
71 |
69 private static final String vendor_version = |
72 private static final String vendor_version = |
70 (VENDOR_VERSION_STRING.length() > 0 |
73 (VENDOR_VERSION_STRING.length() > 0 |
71 ? " " + VENDOR_VERSION_STRING : ""); |
74 ? " " + VENDOR_VERSION_STRING : ""); |
72 |
75 |
|
76 private static final String VENDOR = |
|
77 "@@VENDOR@@"; |
|
78 |
|
79 private static final String VENDOR_URL = |
|
80 "@@VENDOR_URL@@"; |
|
81 |
|
82 private static final String VENDOR_URL_BUG = |
|
83 "@@VENDOR_URL_BUG@@"; |
|
84 |
|
85 /** |
|
86 * Initialize system properties using build provided values. |
|
87 * |
|
88 * @param props Properties instance in which to insert the properties |
|
89 */ |
73 public static void init(Properties props) { |
90 public static void init(Properties props) { |
74 props.setProperty("java.version", java_version); |
91 props.setProperty("java.version", java_version); |
75 props.setProperty("java.version.date", java_version_date); |
92 props.setProperty("java.version.date", java_version_date); |
76 props.setProperty("java.runtime.version", java_runtime_version); |
93 props.setProperty("java.runtime.version", java_runtime_version); |
77 props.setProperty("java.runtime.name", java_runtime_name); |
94 props.setProperty("java.runtime.name", java_runtime_name); |
78 if (VENDOR_VERSION_STRING.length() > 0) |
95 if (VENDOR_VERSION_STRING.length() > 0) |
79 props.setProperty("java.vendor.version", VENDOR_VERSION_STRING); |
96 props.setProperty("java.vendor.version", VENDOR_VERSION_STRING); |
|
97 |
|
98 props.setProperty("java.class.version", CLASSFILE_MAJOR_MINOR); |
|
99 |
|
100 props.setProperty("java.specification.version", VERSION_NUMBER); |
|
101 props.setProperty("java.specification.name", "Java Platform API Specification"); |
|
102 props.setProperty("java.specification.vendor", "Oracle Corporation"); |
|
103 |
|
104 props.setProperty("java.vendor", VENDOR); |
|
105 props.setProperty("java.vendor.url", VENDOR_URL); |
|
106 props.setProperty("java.vendor.url.bug", VENDOR_URL_BUG); |
80 } |
107 } |
81 |
108 |
82 private static int parseVersionNumber(String version, int prevIndex, int index) { |
109 private static int parseVersionNumber(String version, int prevIndex, int index) { |
83 if (index - prevIndex > 1 && |
110 if (index - prevIndex > 1 && |
84 Character.digit(version.charAt(prevIndex), 10) <= 0) |
111 Character.digit(version.charAt(prevIndex), 10) <= 0) |