src/java.base/share/classes/java/lang/VersionProps.java.template
changeset 58842 6c255334120d
parent 53018 8bf9268df0e2
equal deleted inserted replaced
58836:31ec3e55fa3d 58842:6c255334120d
     1 /*
     1 /*
     2  * Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 1999, 2019, 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
    40         "@@VERSION_SHORT@@";
    40         "@@VERSION_SHORT@@";
    41 
    41 
    42     private static final String java_version_date =
    42     private static final String java_version_date =
    43         "@@VERSION_DATE@@";
    43         "@@VERSION_DATE@@";
    44 
    44 
       
    45     // This field is read by HotSpot
    45     private static final String java_runtime_name =
    46     private static final String java_runtime_name =
    46         "@@RUNTIME_NAME@@";
    47         "@@RUNTIME_NAME@@";
    47 
    48 
       
    49     // This field is read by HotSpot
    48     private static final String java_runtime_version =
    50     private static final String java_runtime_version =
    49         "@@VERSION_STRING@@";
    51         "@@VERSION_STRING@@";
    50 
    52 
    51     private static final String VERSION_NUMBER =
    53     private static final String VERSION_NUMBER =
    52         "@@VERSION_NUMBER@@";
    54         "@@VERSION_NUMBER@@";
    67         "@@VERSION_OPT@@".startsWith("LTS");
    69         "@@VERSION_OPT@@".startsWith("LTS");
    68 
    70 
    69     private static final String CLASSFILE_MAJOR_MINOR =
    71     private static final String CLASSFILE_MAJOR_MINOR =
    70         "@@VERSION_CLASSFILE_MAJOR@@.@@VERSION_CLASSFILE_MINOR@@";
    72         "@@VERSION_CLASSFILE_MAJOR@@.@@VERSION_CLASSFILE_MINOR@@";
    71 
    73 
    72     private static final String VENDOR_VERSION_STRING =
       
    73         "@@VENDOR_VERSION_STRING@@";
       
    74 
       
    75     private static final String vendor_version =
       
    76         (!VENDOR_VERSION_STRING.isEmpty()
       
    77          ? " " + VENDOR_VERSION_STRING : "");
       
    78 
       
    79     private static final String VENDOR =
    74     private static final String VENDOR =
    80         "@@VENDOR@@";
    75         "@@VENDOR@@";
    81 
    76 
    82     private static final String VENDOR_URL =
    77     private static final String VENDOR_URL =
    83         "@@VENDOR_URL@@";
    78         "@@VENDOR_URL@@";
    84 
    79 
    85     private static final String VENDOR_URL_BUG =
    80     // The remaining VENDOR_* fields must not be final,
       
    81     // so that they can be redefined by jlink plugins
       
    82 
       
    83     // This field is read by HotSpot
       
    84     private static String VENDOR_VERSION =
       
    85         "@@VENDOR_VERSION_STRING@@";
       
    86 
       
    87     private static String VENDOR_URL_BUG =
    86         "@@VENDOR_URL_BUG@@";
    88         "@@VENDOR_URL_BUG@@";
       
    89 
       
    90     // This field is read by HotSpot
       
    91     private static String VENDOR_URL_VM_BUG =
       
    92         "@@VENDOR_URL_VM_BUG@@";
    87 
    93 
    88     /**
    94     /**
    89      * Initialize system properties using build provided values.
    95      * Initialize system properties using build provided values.
    90      *
    96      *
    91      * @param props Map instance in which to insert the properties
    97      * @param props Map instance in which to insert the properties
    93     public static void init(Map<String, String> props) {
    99     public static void init(Map<String, String> props) {
    94         props.put("java.version", java_version);
   100         props.put("java.version", java_version);
    95         props.put("java.version.date", java_version_date);
   101         props.put("java.version.date", java_version_date);
    96         props.put("java.runtime.version", java_runtime_version);
   102         props.put("java.runtime.version", java_runtime_version);
    97         props.put("java.runtime.name", java_runtime_name);
   103         props.put("java.runtime.name", java_runtime_name);
    98         if (!VENDOR_VERSION_STRING.isEmpty())
   104         if (!VENDOR_VERSION.isEmpty())
    99             props.put("java.vendor.version", VENDOR_VERSION_STRING);
   105             props.put("java.vendor.version", VENDOR_VERSION);
   100 
   106 
   101         props.put("java.class.version", CLASSFILE_MAJOR_MINOR);
   107         props.put("java.class.version", CLASSFILE_MAJOR_MINOR);
   102 
   108 
   103         props.put("java.specification.version", VERSION_SPECIFICATION);
   109         props.put("java.specification.version", VERSION_SPECIFICATION);
   104         props.put("java.specification.name", "Java Platform API Specification");
   110         props.put("java.specification.name", "Java Platform API Specification");
   214             jdk_debug_level = "";
   220             jdk_debug_level = "";
   215         } else {
   221         } else {
   216             jdk_debug_level = jdk_debug_level + " ";
   222             jdk_debug_level = jdk_debug_level + " ";
   217         }
   223         }
   218 
   224 
       
   225         String vendor_version = (VENDOR_VERSION.isEmpty()
       
   226                                  ? "" : " " + VENDOR_VERSION);
       
   227 
   219         ps.println(java_runtime_name + vendor_version
   228         ps.println(java_runtime_name + vendor_version
   220                    + " (" + jdk_debug_level + "build " + java_runtime_version + ")");
   229                    + " (" + jdk_debug_level + "build " + java_runtime_version + ")");
   221 
   230 
   222         /* Third line: JVM information. */
   231         /* Third line: JVM information. */
   223         String java_vm_name    = System.getProperty("java.vm.name");
   232         String java_vm_name    = System.getProperty("java.vm.name");