Description
In the initial RFR for JDK-8072379 [0], an implementation of an Oracle-specific class, jdk.OracleVersion, was provided. The sole intent of jdk.OracleVersion was to provide interpretation of the fourth element of the version number. During review, it was determined that this class was unnecessary at this time.
There may be a general need for a vendor-specific interpretation of a JDK version string. The following suggestion was provided as a potential solution to this problem:
// API sketch
public final class VendorVersion {
public VendorVersion(String vendor, Version version, Comparator<Version> versionComp>) { ...}
@Override
public boolean equals(VendorVersion vv) {
// Usual instance of checks
return Objects.equals(vendor, vv.vendor()) && versionComp.version(), vv.version());
}
int compareVersion(VendorVersion vv) {
if (!vendor.equals(vv.vendor()))
// throw an exception
return versionComp(version, vv.version);
}
// ...
}
[0] http://mail.openjdk.java.net/pipermail/verona-dev/2015-November/000294.html
There may be a general need for a vendor-specific interpretation of a JDK version string. The following suggestion was provided as a potential solution to this problem:
// API sketch
public final class VendorVersion {
public VendorVersion(String vendor, Version version, Comparator<Version> versionComp>) { ...}
@Override
public boolean equals(VendorVersion vv) {
// Usual instance of checks
return Objects.equals(vendor, vv.vendor()) && versionComp.version(), vv.version());
}
int compareVersion(VendorVersion vv) {
if (!vendor.equals(vv.vendor()))
// throw an exception
return versionComp(version, vv.version);
}
// ...
}
[0] http://mail.openjdk.java.net/pipermail/verona-dev/2015-November/000294.html
Attachments
Issue Links
- relates to
-
JDK-8072379 CoreLibs: Implement jdk.Version
-
- Resolved
-
-
JDK-8144069 Determine correct publication for jdk.Version API
-
- Resolved
-
-
JDK-8144062 Move jdk.Version to java.lang.Runtime.Version
-
- Closed
-