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

Add system property for Java SE specification maintenance version

XMLWordPrintable

    • behavioral
    • minimal
    • Define new optional system property.
    • Java API, 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

      diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java
      index 5e4c12c99f..ccc89188e0 100644
      --- a/src/java.base/share/classes/java/lang/System.java
      +++ b/src/java.base/share/classes/java/lang/System.java
      @@ -631,6 +631,9 @@ public final class System {
            *     <td>Java Runtime Environment specification version, whose value is
            *     the {@linkplain Runtime.Version#feature feature} element of the
            *     {@linkplain Runtime#version() runtime version}</td></tr>
      +     * <tr><th scope="row">{@code java.specification.maintenance.version}</th>
      +     *     <td>Java Runtime Environment specification maintenance version,
      +     *     may be interpreted as a positive integer <em>(optional, see below)</em></td></tr>
            * <tr><th scope="row">{@code java.specification.vendor}</th>
            *     <td>Java Runtime Environment specification  vendor</td></tr>
            * <tr><th scope="row">{@code java.specification.name}</th>
      @@ -667,6 +670,16 @@ public final class System {
            * </tbody>
            * </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>

            jlu Justin Lu
            darcy Joe Darcy
            Iris Clark, Lance Andersen, Naoto Sato
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: