RFR: 8306678: Replace use of os.version with an internal Version record
Christian Stein
cstein at openjdk.org
Fri Apr 21 20:24:45 UTC 2023
On Fri, 21 Apr 2023 16:44:13 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.
test/jdk/jdk/internal/util/VersionTest.java line 87:
> 85: }
> 86: assertThrows(exception, () -> Version.parse(verName));
> 87: }
The explicit creation of argument instances can be avoided by using something like:
@ParameterizedTest
@ValueSource(strings = {
// dot without digits
"1.", "1.2.", "1.-abc", "1.2.-abc",
// empty
"",
// no an initial digit
"xaaa", "abc.xyz"
})
void checkIllegalParse(String verName) {
checkIllegalParse(verName, IllegalArgumentException.class);
}
void checkIllegalParse(String verName, Class<? extends Throwable> exception) {
assertThrows(exception, () -> Version.parse(verName));
}
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/13584#discussion_r1174134594
More information about the nio-dev
mailing list