src/java.base/share/classes/java/lang/VersionProps.java.template
author erikj
Tue, 12 Sep 2017 19:03:39 +0200
changeset 47216 71c04702a3d5
parent 44785 jdk/src/java.base/share/classes/java/lang/VersionProps.java.template@62a18e20f5c1
child 48327 d2a837cf9ff1
permissions -rw-r--r--
8187443: Forest Consolidation: Move files to unified layout Reviewed-by: darcy, ihse
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     1
/*
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
     2
 * Copyright (c) 1999, 2017, Oracle and/or its affiliates. All rights reserved.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
90ce3da70b43 Initial load
duke
parents:
diff changeset
     4
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
90ce3da70b43 Initial load
duke
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
     7
 * published by the Free Software Foundation.  Oracle designates this
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
     8
 * particular file as subject to the "Classpath" exception as provided
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
     9
 * by Oracle in the LICENSE file that accompanied this code.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    10
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    11
 * This code is distributed in the hope that it will be useful, but WITHOUT
90ce3da70b43 Initial load
duke
parents:
diff changeset
    12
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
90ce3da70b43 Initial load
duke
parents:
diff changeset
    13
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
90ce3da70b43 Initial load
duke
parents:
diff changeset
    14
 * version 2 for more details (a copy is included in the LICENSE file that
90ce3da70b43 Initial load
duke
parents:
diff changeset
    15
 * accompanied this code).
90ce3da70b43 Initial load
duke
parents:
diff changeset
    16
 *
90ce3da70b43 Initial load
duke
parents:
diff changeset
    17
 * You should have received a copy of the GNU General Public License version
90ce3da70b43 Initial load
duke
parents:
diff changeset
    18
 * 2 along with this work; if not, write to the Free Software Foundation,
90ce3da70b43 Initial load
duke
parents:
diff changeset
    19
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
90ce3da70b43 Initial load
duke
parents:
diff changeset
    20
 *
5506
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
    21
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
    22
 * or visit www.oracle.com if you need additional information or have any
202f599c92aa 6943119: Rebrand source copyright notices
ohair
parents: 4115
diff changeset
    23
 * questions.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    24
 */
90ce3da70b43 Initial load
duke
parents:
diff changeset
    25
36225
6ae0eebc46e9 8150162: Move sun.misc.Version to a truly internal package
chegar
parents: 34011
diff changeset
    26
package java.lang;
6ae0eebc46e9 8150162: Move sun.misc.Version to a truly internal package
chegar
parents: 34011
diff changeset
    27
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    28
import java.io.PrintStream;
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    29
import java.util.Arrays;
39302
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    30
import java.util.List;
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    31
import java.util.Optional;
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    32
36225
6ae0eebc46e9 8150162: Move sun.misc.Version to a truly internal package
chegar
parents: 34011
diff changeset
    33
class VersionProps {
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    34
90ce3da70b43 Initial load
duke
parents:
diff changeset
    35
90ce3da70b43 Initial load
duke
parents:
diff changeset
    36
    private static final String launcher_name =
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 27565
diff changeset
    37
        "@@LAUNCHER_NAME@@";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    38
90ce3da70b43 Initial load
duke
parents:
diff changeset
    39
    private static final String java_version =
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 27565
diff changeset
    40
        "@@VERSION_SHORT@@";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    41
90ce3da70b43 Initial load
duke
parents:
diff changeset
    42
    private static final String java_runtime_name =
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 27565
diff changeset
    43
        "@@RUNTIME_NAME@@";
15683
3acd10709925 8003256: (profiles) Add support for profile identification
alanb
parents: 8993
diff changeset
    44
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    45
    private static final String java_runtime_version =
33984
2333676816eb 8085822: JEP 223: New Version-String Scheme (initial integration)
ihse
parents: 27565
diff changeset
    46
        "@@VERSION_STRING@@";
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    47
39302
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    48
    private static final String VERSION_NUMBER =
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    49
        "@@VERSION_NUMBER@@";
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    50
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    51
    private static final String VERSION_BUILD =
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    52
        "@@VERSION_BUILD@@";
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    53
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    54
    private static final String VERSION_PRE =
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    55
        "@@VERSION_PRE@@";
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    56
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    57
    private static final String VERSION_OPT =
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    58
        "@@VERSION_OPT@@";
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    59
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
    60
    static {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    61
        init();
90ce3da70b43 Initial load
duke
parents:
diff changeset
    62
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    63
90ce3da70b43 Initial load
duke
parents:
diff changeset
    64
    public static void init() {
90ce3da70b43 Initial load
duke
parents:
diff changeset
    65
        System.setProperty("java.version", java_version);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    66
        System.setProperty("java.runtime.version", java_runtime_version);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    67
        System.setProperty("java.runtime.name", java_runtime_name);
90ce3da70b43 Initial load
duke
parents:
diff changeset
    68
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
    69
39648
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    70
    private static int parseVersionNumber(String version, int prevIndex, int index) {
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    71
        if (index - prevIndex > 1 &&
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    72
            Character.digit(version.charAt(prevIndex), 10) <= 0)
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    73
            throw new IllegalArgumentException("Leading zeros not supported (" +
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    74
                    version.substring(prevIndex, index) + ")");
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    75
        return Integer.parseInt(version, prevIndex, index, 10);
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    76
    }
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    77
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    78
    // This method is reflectively used by regression tests.
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    79
    static List<Integer> parseVersionNumbers(String version) {
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    80
        // Let's find the size of an array required to hold $VNUM components
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    81
        int size = 0;
39302
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    82
        int prevIndex = 0;
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    83
        do {
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    84
            prevIndex = version.indexOf('.', prevIndex) + 1;
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    85
            size++;
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    86
        } while (prevIndex > 0);
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    87
        Integer[] verNumbers = new Integer[size];
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    88
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    89
        // Fill in the array with $VNUM components
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    90
        int n = 0;
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    91
        prevIndex = 0;
39648
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    92
        int index = version.indexOf('.');
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    93
        while (index > -1) {
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    94
            verNumbers[n] = parseVersionNumber(version, prevIndex, index);
39314
779f1d11a746 8160457: VersionProps.versionNumbers() is broken
simonis
parents: 39302
diff changeset
    95
            prevIndex = index + 1; // Skip the period
39648
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
    96
            index = version.indexOf('.', prevIndex);
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    97
            n++;
39302
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
    98
        }
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
    99
        verNumbers[n] = parseVersionNumber(version, prevIndex, version.length());
39648
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
   100
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
   101
        if (verNumbers[0] == 0 || verNumbers[n] == 0)
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
   102
            throw new IllegalArgumentException("Leading/trailing zeros not allowed (" +
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
   103
                    Arrays.toString(verNumbers) + ")");
39648
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
   104
44785
62a18e20f5c1 8177738: Runtime.Version must be a value-based class
prappo
parents: 42338
diff changeset
   105
        return List.of(verNumbers);
39648
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
   106
    }
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
   107
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
   108
    static List<Integer> versionNumbers() {
9bbd1300c256 8160564: TEST: Add a test to check the implementation of VersionProps.versionNumbers()
simonis
parents: 39314
diff changeset
   109
        return parseVersionNumbers(VERSION_NUMBER);
39302
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   110
    }
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   111
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   112
    static Optional<String> pre() {
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   113
        return optionalOf(VERSION_PRE);
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   114
    }
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   115
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   116
    static Optional<Integer> build() {
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   117
        return VERSION_BUILD.isEmpty() ?
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   118
                Optional.empty() :
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   119
                Optional.of(Integer.parseInt(VERSION_BUILD));
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   120
    }
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   121
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   122
    static Optional<String> optional() {
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   123
        return optionalOf(VERSION_OPT);
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   124
    }
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   125
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   126
    // Treat empty strings as value not being present
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   127
    private static Optional<String> optionalOf(String value) {
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   128
        if (!value.isEmpty()) {
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   129
            return Optional.of(value);
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   130
        } else {
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   131
            return Optional.empty();
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   132
        }
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   133
    }
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   134
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   135
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   136
     * In case you were wondering this method is called by java -version.
90ce3da70b43 Initial load
duke
parents:
diff changeset
   137
     */
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   138
    public static void print(boolean err) {
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   139
        print(err, false);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   140
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   141
90ce3da70b43 Initial load
duke
parents:
diff changeset
   142
    /**
90ce3da70b43 Initial load
duke
parents:
diff changeset
   143
     * This is the same as print except that it adds an extra line-feed
90ce3da70b43 Initial load
duke
parents:
diff changeset
   144
     * at the end, typically used by the -showversion in the launcher
90ce3da70b43 Initial load
duke
parents:
diff changeset
   145
     */
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   146
    public static void println(boolean err) {
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   147
        print(err, true);
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   148
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   149
90ce3da70b43 Initial load
duke
parents:
diff changeset
   150
    /**
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   151
     * Print version info.
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   152
     */
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   153
    private static void print(boolean err, boolean newln) {
8993
9076d969ffdf 7025066: Build systems changes to support SE Embedded Integration
dholmes
parents: 5506
diff changeset
   154
        boolean isHeadless = false;
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   155
        PrintStream ps = err ? System.err : System.out;
8993
9076d969ffdf 7025066: Build systems changes to support SE Embedded Integration
dholmes
parents: 5506
diff changeset
   156
9076d969ffdf 7025066: Build systems changes to support SE Embedded Integration
dholmes
parents: 5506
diff changeset
   157
        /* Report that we're running headless if the property is true */
15683
3acd10709925 8003256: (profiles) Add support for profile identification
alanb
parents: 8993
diff changeset
   158
        String headless = System.getProperty("java.awt.headless");
3acd10709925 8003256: (profiles) Add support for profile identification
alanb
parents: 8993
diff changeset
   159
        if ( (headless != null) && (headless.equalsIgnoreCase("true")) ) {
8993
9076d969ffdf 7025066: Build systems changes to support SE Embedded Integration
dholmes
parents: 5506
diff changeset
   160
            isHeadless = true;
15683
3acd10709925 8003256: (profiles) Add support for profile identification
alanb
parents: 8993
diff changeset
   161
        }
8993
9076d969ffdf 7025066: Build systems changes to support SE Embedded Integration
dholmes
parents: 5506
diff changeset
   162
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   163
        /* First line: platform version. */
42338
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   164
        if (err) {
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   165
            ps.println(launcher_name + " version \"" + java_version + "\"");
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   166
        } else {
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   167
            /* Use a format more in line with GNU conventions */
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   168
            ps.println(launcher_name + " " + java_version);
a60f280f803c 8169069: Module system implementation refresh (11/2016)
alanb
parents: 40192
diff changeset
   169
        }
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   170
90ce3da70b43 Initial load
duke
parents:
diff changeset
   171
        /* Second line: runtime version (ie, libraries). */
34011
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   172
        String jdk_debug_level = System.getProperty("jdk.debug", "release");
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   173
        /* Debug level is not printed for "release" builds */
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   174
        if ("release".equals(jdk_debug_level)) {
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   175
            jdk_debug_level = "";
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   176
        } else {
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   177
            jdk_debug_level = jdk_debug_level + " ";
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   178
        }
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   179
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   180
        ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
8993
9076d969ffdf 7025066: Build systems changes to support SE Embedded Integration
dholmes
parents: 5506
diff changeset
   181
15683
3acd10709925 8003256: (profiles) Add support for profile identification
alanb
parents: 8993
diff changeset
   182
        ps.println(')');
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   183
90ce3da70b43 Initial load
duke
parents:
diff changeset
   184
        /* Third line: JVM information. */
90ce3da70b43 Initial load
duke
parents:
diff changeset
   185
        String java_vm_name    = System.getProperty("java.vm.name");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   186
        String java_vm_version = System.getProperty("java.vm.version");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   187
        String java_vm_info    = System.getProperty("java.vm.info");
34011
b1ce08dd7f17 8139986: Store debug level in java.vm.debug and conditionally print in "java -version"
amurillo
parents: 34003
diff changeset
   188
        ps.println(java_vm_name + " (" + jdk_debug_level + "build " + java_vm_version + ", " +
2
90ce3da70b43 Initial load
duke
parents:
diff changeset
   189
                   java_vm_info + ")");
90ce3da70b43 Initial load
duke
parents:
diff changeset
   190
    }
90ce3da70b43 Initial load
duke
parents:
diff changeset
   191
39302
aa8d0bc2a6d2 8160000: Runtime.version() cause startup regressions in 9+119
redestad
parents: 36225
diff changeset
   192
}