Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JDK-8285497: Add system property for Java SE specification maintenance version #8437

Closed
wants to merge 14 commits into from

Conversation

jddarcy
Copy link
Member

@jddarcy jddarcy commented Apr 27, 2022

Add a new system property, java.specification.maintenance.version, to return the maintenance release number of the Java SE specification being implemented. The property is unset, optional in the terminology of System.getProperties, for an initial release of a specification.

Please also review the CSR https://bugs.openjdk.java.net/browse/JDK-8285764

I'll update copyright years before an integration.


Progress

  • Change must not contain extraneous whitespace
  • Commit message must refer to an issue
  • Change requires a CSR request to be approved
  • Change must be properly reviewed (1 review required, with at least 1 reviewer)

Issues

  • JDK-8285497: Add system property for Java SE specification maintenance version
  • JDK-8285764: Add system property for Java SE specification maintenance version (CSR)

Reviewers

Reviewing

Using git

Checkout this PR locally:
$ git fetch https://git.openjdk.java.net/jdk pull/8437/head:pull/8437
$ git checkout pull/8437

Update a local copy of the PR:
$ git checkout pull/8437
$ git pull https://git.openjdk.java.net/jdk pull/8437/head

Using Skara CLI tools

Checkout this PR locally:
$ git pr checkout 8437

View PR using the GUI difftool:
$ git pr show -t 8437

Using diff file

Download this PR as a diff file:
https://git.openjdk.java.net/jdk/pull/8437.diff

@bridgekeeper
Copy link

bridgekeeper bot commented Apr 27, 2022

👋 Welcome back darcy! A progress list of the required criteria for merging this PR into master will be added to the body of your pull request. There are additional pull request commands available for use with this pull request.

@openjdk openjdk bot added the rfr Pull request is ready for review label Apr 27, 2022
@openjdk
Copy link

openjdk bot commented Apr 27, 2022

@jddarcy The following label will be automatically applied to this pull request:

  • core-libs

When this pull request is ready to be reviewed, an "RFR" email will be sent to the corresponding mailing list. If you would like to change these labels, use the /label pull request command.

@openjdk openjdk bot added the core-libs core-libs-dev@openjdk.org label Apr 27, 2022
@mlbridge
Copy link

mlbridge bot commented Apr 27, 2022

@jaikiran
Copy link
Member

Hello Joe, should the property description have a note stating what kind of a value this property holds, if at all present? Would it be free form text or an integer value?

@seanjmullan
Copy link
Member

seanjmullan commented Apr 28, 2022

Should this be added to the default permissions in the conf/security/java.policy file along with other similar properties?

@jddarcy
Copy link
Member Author

jddarcy commented Apr 28, 2022

Should this be added to the default permissions in the conf/security/java.policy file along with other similar properties?

Seems reasonable; good catch.

Copy link
Member

@mbreinhold mbreinhold left a comment

Choose a reason for hiding this comment

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

Also, don't forget to update the CSR with the new specification text, for the record.
Otherwise, looks good!

Comment on lines +33 to +34
permission java.util.PropertyPermission
"java.specification.maintenance.version", "read";
Copy link
Member

Choose a reason for hiding this comment

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

For consistency, you should probably also add a hard-coded permission to the sun.security.provider.PolicyFile.initStaticPolicy() method which is used as a fallback if there is a problem parsing the java.policy file. I doubt this will cause any issues as I don't suspect many/any applications will suddenly start reading this property and running with an SM but again it is mainly for consistency as all the other default permissions in this file are also granted in that method.

Copy link
Member Author

Choose a reason for hiding this comment

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

Will do; thanks. Just to double-check, under the current proposal, this property will be undefined most of the time. I assume it is fine for the permissions to grant the ability to read a property that is not actually there.

Copy link
Member

Choose a reason for hiding this comment

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

Yes.

@jddarcy jddarcy changed the title JDK-8285764: Add system property for Java SE specification maintenance version JDK-8285497: Add system property for Java SE specification maintenance version Apr 28, 2022
@jddarcy
Copy link
Member Author

jddarcy commented Apr 28, 2022

Hello Joe, should the property description have a note stating what kind of a value this property holds, if at all present? Would it be free form text or an integer value?

There is some discussion about the sequence of values in comments on the JBS issue. I think it would be reasonable to have the sequence:

undefined -> 1 -> 2 -> 3 ...

where 1, 2, 3 are strings. I'll update the text to be more explicit about the eventual sequence once the discussion is concluded; thanks.

@jddarcy
Copy link
Member Author

jddarcy commented Apr 28, 2022

Also, don't forget to update the CSR with the new specification text, for the record. Otherwise, looks good!

Will do; I'll update the CSR to reflect that change as well as to be more explicit about the sequence of values, once that is determined.

@openjdk openjdk bot added the csr Pull request needs approved CSR before integration label Apr 28, 2022
@jddarcy
Copy link
Member Author

jddarcy commented Apr 28, 2022

Also, don't forget to update the CSR with the new specification text, for the record. Otherwise, looks good!

Will do; I'll update the CSR to reflect that change as well as to be more explicit about the sequence of values, once that is determined.

CSR now updated accordingly.

Copy link
Member

@jaikiran jaikiran left a comment

Choose a reason for hiding this comment

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

Thank you for the updates, Joe. Looks good to me.

Copy link
Member

@irisclark irisclark left a comment

Choose a reason for hiding this comment

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

Is there intent to backport this to the RI for JSR 337 MR 4?

@@ -109,6 +109,10 @@ class VersionProps {
props.put("java.class.version", CLASSFILE_MAJOR_MINOR);

props.put("java.specification.version", VERSION_SPECIFICATION);

// Uncomment next props.put call after the first maintenance release for a
Copy link
Member

Choose a reason for hiding this comment

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

Is "after" correct? I think this value should be set to the target MR at the beginning of RI development for the release, similar to what is done for other version identification system properties.

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, sure -- this versioning info should be updated in the same way we update versions for all the early access builds of a release.

* After a first maintenance release this property will
* have the value {@code "1"}; after a second maintenance
* release, this property will have the value {@code "2"},
* and so on.
Copy link
Member

Choose a reason for hiding this comment

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

There should be no requirement that values be allocated sequentially. In other words, if JCP MR does not require an RI, then it should not be surprising if there is no JDK build with maintenance version . As an example, JSR 337 MR 1 and MR 2 both used the same RI. If this system property had existed during development of MR 1, it would return "1". Since no RI was submitted for MR 2, a build returning "2" should never exist. MR 3 did update the RI, so it would return "3".

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there intent to backport this to the RI for JSR 337 MR 4?

I think that would be helpful, if not strictly necessary.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is there intent to backport this to the RI for JSR 337 MR 4?

I think that would be helpful, if not strictly necessary.

PS And if backported, the spec could be updated for earlier release trains to start at a different value like "4".

Copy link
Member

Choose a reason for hiding this comment

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

@irisclark does raise an interesting point: If, say, MR 2 doesn’t require a change to the RI then the MR 1 RI is also the MR 2 RI, but its java.specification.maintenance.version property will report that it’s the MR 1 RI.

One way to fix this would be to require an RI update with every MR just to update this property, even if no other code in the RI changes — but we prefer to avoid doing RI builds unnecessarily.

Another way to fix it would be to finesse the specification of this property, perhaps:

     * <tr><th scope="row">{@systemProperty java.specification.maintenance.version}</th>
     *     <td>Java Runtime Environment specification maintenance version, which may
     *         be interpreted as a non-zero integer. If defined, the value of this
     *         property is the identifying number of the most recent <a
     *         href="https://jcp.org/en/procedures/jcp2#3.6.4">specification
     *         maintenance release</a> that required a change to the runtime</a>
     *         <em>(optional)</em>.
     *         </td></tr>

Copy link
Member Author

Choose a reason for hiding this comment

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

In the latest push, to address the concerns raised updated the proposed wording to, in plain text:

Java Runtime Environment specification maintenance version, not defined before the specification implemented by this runtime has undergone a maintenance release (optional). When defined, the value of this property may be interpreted as a positive integer. The value indicates the latest maintenance release the runtime is known to support. A later release may be supported by the environment. To indicate the first maintenance release this property will have the value "1"; to indicate the second maintenance release, this property will have the value "2", and so on.

Copy link
Member Author

Choose a reason for hiding this comment

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

PS CSR Updated to reflect this push; please review: https://bugs.openjdk.java.net/browse/JDK-8285764

Copy link
Member

Choose a reason for hiding this comment

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

The negative definition above permits the property always to be undefined, but we do want it to be defined when meaningful. It’s also getting to be an awful lot of text to add to the otherwise terse tabular summary of system properties in the System::getProperties() specification.

Consider using this text in the table:

Java Runtime Environment specification maintenance version, which may be interpreted as a positive integer (optional, see below)

and then this in a paragraph following the table:

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 maintenance release. 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.

* After a first maintenance release this property will
* have the value {@code "1"}; after a second maintenance
* release, this property will have the value {@code "2"},
* and so on.
Copy link
Member

Choose a reason for hiding this comment

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

The negative definition above permits the property always to be undefined, but we do want it to be defined when meaningful. It’s also getting to be an awful lot of text to add to the otherwise terse tabular summary of system properties in the System::getProperties() specification.

Consider using this text in the table:

Java Runtime Environment specification maintenance version, which may be interpreted as a positive integer (optional, see below)

and then this in a paragraph following the table:

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 maintenance release. 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.

@jddarcy
Copy link
Member Author

jddarcy commented May 4, 2022

PR and CSR updated as suggested.

Copy link
Member

@irisclark irisclark left a comment

Choose a reason for hiding this comment

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

Associated CSR also reviewed.

* 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
Copy link
Member

Choose a reason for hiding this comment

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

The final sentence can be shortened, and looking at it now the semicolon should just be a comma:

     * maintenance release. To indicate the first maintenance release
     * this property will have the value {@code "1"}, to indicate the
     * second maintenance release it will have the value {@code "2"},
     * and so on.

Otherwise, this looks good to me.

@openjdk openjdk bot removed the csr Pull request needs approved CSR before integration label May 5, 2022
@openjdk
Copy link

openjdk bot commented May 5, 2022

@jddarcy This change now passes all automated pre-integration checks.

ℹ️ This project also has non-automated pre-integration requirements. Please see the file CONTRIBUTING.md for details.

After integration, the commit message for the final commit will be:

8285497: Add system property for Java SE specification maintenance version

Reviewed-by: mullan, jpai, iris

You can use pull request commands such as /summary, /contributor and /issue to adjust it as needed.

At the time when this comment was updated there had been 1 new commit pushed to the master branch:

  • 6d7e446: 8283306: re-resolving indirect call to non-entrant nmethod can crash

Please see this link for an up-to-date comparison between the source branch of this pull request and the master branch.
As there are no conflicts, your changes will automatically be rebased on top of these commits when integrating. If you prefer to avoid this automatic rebasing, please check the documentation for the /integrate command for further details.

➡️ To integrate this PR with the above commit message to the master branch, type /integrate in a new comment.

@openjdk openjdk bot added the ready Pull request is ready to be integrated label May 5, 2022
@jddarcy
Copy link
Member Author

jddarcy commented May 5, 2022

/integrate

@openjdk
Copy link

openjdk bot commented May 5, 2022

Going to push as commit 59ef76a.
Since your change was applied there has been 1 commit pushed to the master branch:

  • 6d7e446: 8283306: re-resolving indirect call to non-entrant nmethod can crash

Your commit was automatically rebased without conflicts.

@openjdk openjdk bot added the integrated Pull request has been integrated label May 5, 2022
@openjdk openjdk bot closed this May 5, 2022
@openjdk openjdk bot removed ready Pull request is ready to be integrated rfr Pull request is ready for review labels May 5, 2022
@openjdk
Copy link

openjdk bot commented May 5, 2022

@jddarcy Pushed as commit 59ef76a.

💡 You may see a message that your pull request was closed with unmerged commits. This can be safely ignored.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core-libs core-libs-dev@openjdk.org integrated Pull request has been integrated
Development

Successfully merging this pull request may close these issues.

5 participants