Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8286766

Add system property for Java SE specification maintenance version

XMLWordPrintable

    • behavioral
    • minimal
    • Define new optional system property.
    • System or security property
    • SE

      Summary

      Add a new system property, java.specification.maintenance.version, to return the maintenance release number of the Java SE specification being implemented by the JDK. (The backport is identical to the original fix, other dropping the use of the systemProperty javadoc tag.)

      Problem

      There is no existing programmatic way to determine if a JDK is implementing an original release Java SE specification or a maintenance release to a Java SE specification.

      Solution

      Add an optional property, java.specification.maintenance.version, to the list of properties defined by System.getProperties(). The property is unset, optional in the terminology of System.getProperties, for an initial release of a specification. Subsequent values are "1", "2", etc.

      Specification

      --- a/jdk/src/share/classes/java/lang/System.java
      +++ b/jdk/src/share/classes/java/lang/System.java
      @@ -1,5 +1,5 @@
       /*
      - * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
      + * Copyright (c) 1994, 2022, 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
      @@ -557,6 +557,10 @@
            *     <td>Java installation directory</td></tr>
            * <tr><td><code>java.vm.specification.version</code></td>
            *     <td>Java Virtual Machine specification version</td></tr>
      +     * <tr><td><code>java.specification.maintenance.version</code></td>
      +     *     <td>Java Runtime Environment specification maintenance
      +     *     version, may be interpreted as a positive integer
      +     *     <em>(optional, see below)</em></td></tr>
            * <tr><td><code>java.vm.specification.vendor</code></td>
            *     <td>Java Virtual Machine specification vendor</td></tr>
            * <tr><td><code>java.vm.specification.name</code></td>
      @@ -608,6 +612,16 @@
            *     <td>User's current working directory</td></tr>
            * </table>
            * <p>
      +     * The {@code java.specification.maintenance.version} property is
      +     * defined if the specification implemented by this runtime at the
      +     * time of its construction had undergone a <a
      +     * href="https://jcp.org/en/procedures/jcp2#3.6.4">maintenance
      +     * release</a>. When defined, its value identifies that
      +     * maintenance release. To indicate the first maintenance release
      +     * this property will have the value {@code "1"}, to indicate the
      +     * second maintenance release this property will have the value
      +     * {@code "2"}, and so on.
      +     * <p>
            * Multiple paths in a system property value are separated by the path
            * separator character of the platform.
            * <p>

            darcy Joe Darcy
            darcy Joe Darcy
            Iris Clark
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: