< prev index next >

src/java.base/share/classes/java/lang/VersionProps.java.template

Print this page
rev 52582 : 4947890: Minimize JNI upcalls in system-properties initialization
Reviewed-by: erikj

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.  Oracle designates this

@@ -61,24 +61,57 @@
         "@@VERSION_OPT@@";
 
     private static final boolean isLTS =
         "@@VERSION_OPT@@".startsWith("LTS");
 
+    private static final String CLASSFILE_MAJOR_MINOR =
+        "@@VERSION_CLASSFILE_MAJOR@@.@@VERSION_CLASSFILE_MINOR@@";
+
     private static final String VENDOR_VERSION_STRING =
         "@@VENDOR_VERSION_STRING@@";
 
     private static final String vendor_version =
         (VENDOR_VERSION_STRING.length() > 0
          ? " " + VENDOR_VERSION_STRING : "");
 
+    private static final String VENDOR =
+        "@@VENDOR@@";
+
+    private static final String VENDOR_URL =
+        "@@VENDOR_URL@@";
+
+    private static final String VENDOR_URL_BUG =
+        "@@VENDOR_URL_BUG@@";
+
+    /**
+     * Initialize system properties using build provided values.
+     *
+     * @param props Properties instance in which to insert the properties
+     */
     public static void init(Properties props) {
         props.setProperty("java.version", java_version);
         props.setProperty("java.version.date", java_version_date);
         props.setProperty("java.runtime.version", java_runtime_version);
         props.setProperty("java.runtime.name", java_runtime_name);
         if (VENDOR_VERSION_STRING.length() > 0)
             props.setProperty("java.vendor.version", VENDOR_VERSION_STRING);
+
+        props.setProperty("java.class.version", CLASSFILE_MAJOR_MINOR);
+
+        props.setProperty("java.specification.version", VERSION_NUMBER);
+        props.setProperty("java.specification.name", "Java Platform API Specification");
+        props.setProperty("java.specification.vendor", "Oracle Corporation");
+
+        if (!VENDOR.isEmpty()) {
+            props.setProperty("java.vendor", VENDOR);
+        }
+        if (!VENDOR_URL.isEmpty()) {
+            props.setProperty("java.vendor.url", VENDOR_URL);
+        }
+        if (!VENDOR_URL_BUG.isEmpty()) {
+            props.setProperty("java.vendor.url.bug", VENDOR_URL_BUG);
+        }
     }
 
     private static int parseVersionNumber(String version, int prevIndex, int index) {
         if (index - prevIndex > 1 &&
             Character.digit(version.charAt(prevIndex), 10) <= 0)
< prev index next >