RFR: 8306678: Replace use of os.version with an internal Version record [v2]

ExE Boss duke at openjdk.org
Mon Apr 24 20:43:15 UTC 2023


On Mon, 24 Apr 2023 19:56:19 GMT, Roger Riggs <rriggs at openjdk.org> wrote:

>> Create an internal Version record to hold and compare versions of the form (major, minor, micro).
>> Add `OperatingSystem.version()` to return the version of the running OS.
>> Replace uses of os.version in java.base.
>> Subsequent PRs will apply to uses in other modules including, jdk.jlink, jdk.jpackage, and java.desktop.
>
> Roger Riggs has updated the pull request incrementally with two additional commits since the last revision:
> 
>  - Revert changes to MacOsX sun.nio.fs.BsdFileStore; the version check is being removed in another PR.
>  - Review comment updates

Syntax errors:

test/jdk/jdk/internal/util/VersionTest.java line 89:

> 87:                 Arguments.of(new Version(3, 3, 1), new Version(3, 3, 1), 0),
> 88:                 Arguments.of(new Version(3, 3, 1), new Version(3, 3, 0), +1),
> 89:                 Arguments.of(new Version(3, 3, 0), new Version(3, 3, 1), -1)

Missing comma:
Suggestion:

                Arguments.of(new Version(3, 3, 0), new Version(3, 3, 1), -1),

test/jdk/jdk/internal/util/VersionTest.java line 90:

> 88:                 Arguments.of(new Version(3, 3, 1), new Version(3, 3, 0), +1),
> 89:                 Arguments.of(new Version(3, 3, 0), new Version(3, 3, 1), -1)
> 90:                 Arguments.of(new Version(2, 1), new Version(2, 1), 0),

This line is the same as line 84.

test/jdk/jdk/internal/util/VersionTest.java line 92:

> 90:                 Arguments.of(new Version(2, 1), new Version(2, 1), 0),
> 91:                 Arguments.of(new Version(2, 0), new Version(3, 0), -1),
> 92:                 Arguments.of(new Version(3, 0), new Version(2, 0), +1),

**Java** doesn’t (currently) allow trailing commas in method parameters:
Suggestion:

                Arguments.of(new Version(3, 0), new Version(2, 0), +1)

-------------

PR Review: https://git.openjdk.org/jdk/pull/13584#pullrequestreview-1398759614
PR Review Comment: https://git.openjdk.org/jdk/pull/13584#discussion_r1175760505
PR Review Comment: https://git.openjdk.org/jdk/pull/13584#discussion_r1175759513
PR Review Comment: https://git.openjdk.org/jdk/pull/13584#discussion_r1175761011


More information about the core-libs-dev mailing list