Skip to content

Commit

Permalink
8285497: Add system property for Java SE specification maintenance ve…
Browse files Browse the repository at this point in the history
…rsion

Reviewed-by: lancea, darcy, naoto, iris, clanger
Backport-of: 59ef76a365eafe40d8d68b4d5e028f0e731abd01
  • Loading branch information
Justin Lu authored and naotoj committed Mar 13, 2023
1 parent 0a700c6 commit e5ac7a1
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 3 deletions.
15 changes: 14 additions & 1 deletion src/java.base/share/classes/java/lang/System.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2018, 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
Expand Down Expand Up @@ -628,6 +628,9 @@ public static native void arraycopy(Object src, int srcPos,
* <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>
Expand Down Expand Up @@ -664,6 +667,16 @@ public static native void arraycopy(Object src, int srcPos,
* </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>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 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
Expand Down Expand Up @@ -608,6 +608,9 @@ public Void run() {
pe.add(new PropertyPermission
("java.specification.version",
SecurityConstants.PROPERTY_READ_ACTION));
pe.add(new PropertyPermission
("java.specification.maintenance.version",
SecurityConstants.PROPERTY_READ_ACTION));
pe.add(new PropertyPermission
("java.specification.vendor",
SecurityConstants.PROPERTY_READ_ACTION));
Expand Down
2 changes: 2 additions & 0 deletions src/java.base/share/conf/security/java.policy
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ grant {
permission java.util.PropertyPermission "line.separator", "read";
permission java.util.PropertyPermission
"java.specification.version", "read";
permission java.util.PropertyPermission
"java.specification.maintenance.version", "read";
permission java.util.PropertyPermission "java.specification.vendor", "read";
permission java.util.PropertyPermission "java.specification.name", "read";
permission java.util.PropertyPermission
Expand Down
4 changes: 3 additions & 1 deletion src/java.base/share/native/libjava/System.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1994, 2017, 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
Expand Down Expand Up @@ -206,6 +206,8 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)

PUTPROP(props, "java.specification.version",
VERSION_SPECIFICATION);
PUTPROP(props, "java.specification.maintenance.version",
"2");
PUTPROP(props, "java.specification.name",
"Java Platform API Specification");
PUTPROP(props, "java.specification.vendor",
Expand Down

1 comment on commit e5ac7a1

@openjdk-notifier
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.