Java 9 的版本字符串方案中的第 4 个数字是什么意思?
What does the 4th number mean in Java 9's version string scheme?
根据this blog关于Java9的新版本字符串方案,版本应该像MAJOR.MINOR.SECURITY
,即应该有3个数字和2个句点之间。
然而,对于 Azul 的 Zulu 9,当我打印 Java 版本时,它有 4 个数字和 3 个句点:
./jdk/bin/java -version
openjdk version "9.0.0.15"
OpenJDK Runtime Environment (Zulu build 9.0.0.15+181)
OpenJDK 64-Bit Server VM (Zulu build 9.0.0.15+181, mixed mode)
4个数字代表什么?
i.e., there are supposed to be 3 numbers and 2 periods in between.
不一定,您可以使用 JDK 本身验证版本,详情如下。
除了在 , there has been an API addition to the JDK as well for the Runtime.Version
中由 @Stephen 链接的 JEP 之外,JEP 可用于验证给定的版本字符串。这可以使用示例存根来完成:
[我想知道在这里使用 JShell 会很有趣,没有 IDE!]
Runtime.Version version = Runtime.Version.parse("9");
version = Runtime.Version.parse("9.0.1");
version = Runtime.Version.parse("9.0.0.15");
version = Runtime.Version.parse("9.0.0.15+181");
该代码使用 Version.parse
即
Parses the given string as a valid version string containing a version
number followed by pre-release and build information.
并且可以进一步用于(主要)获取 (runtime) version.
的主要、次要、预发布和安全号码等信息
该博文有点过时了。 Java 9 中实际实现的方案记录在 JEP 223: New Version-String Scheme
中
前三个数字的含义是标准化的。第 4 个和(任何)后续数字的含义留给供应商指定。
还要注意第二个和第三个数字之间有趣的关系。
这里是 JEP 的相关部分。
"The sequence may be of arbitrary length but the first three elements are assigned specific meanings, as follows:
$MAJOR.$MINOR.$SECURITY
$MAJOR
- The major version number, incremented for a major release that contains significant new features as specified in a new edition of the Java SE Platform Specification, e.g., JSR 337 for Java SE 8. Features may be removed in a major release, given advance notice at least one major release ahead of time, and incompatible changes may be made when justified. The $MAJOR
version number of JDK 8 is 8; the $MAJOR
version number of JDK 9 is 9. When $MAJOR
is incremented, all subsequent elements are removed.
$MINOR
- The minor version number, incremented for a minor update release that may contain compatible bug fixes, revisions to standard APIs mandated by a Maintenance Release of the relevant Platform Specification, and implementation features outside the scope of that Specification such as new JDK-specific APIs, additional service providers, new garbage collectors, and ports to new hardware architectures.
$SECURITY
- The security level, incremented for a security-update release that contains critical fixes including those necessary to improve security. $SECURITY
is not reset to zero when $MINOR
is incremented. A higher value of $SECURITY
for a given $MAJOR
value, therefore, always indicates a more secure release, regardless of the value of $MINOR
.
The fourth and later elements of a version number are free for use by downstream consumers of the JDK code base. Such a consumer may, e.g., use the fourth element to identify patch releases which contain a small number of critical non-security fixes in addition to the security fixes in the corresponding security release.
根据this blog关于Java9的新版本字符串方案,版本应该像MAJOR.MINOR.SECURITY
,即应该有3个数字和2个句点之间。
然而,对于 Azul 的 Zulu 9,当我打印 Java 版本时,它有 4 个数字和 3 个句点:
./jdk/bin/java -version
openjdk version "9.0.0.15"
OpenJDK Runtime Environment (Zulu build 9.0.0.15+181)
OpenJDK 64-Bit Server VM (Zulu build 9.0.0.15+181, mixed mode)
4个数字代表什么?
i.e., there are supposed to be 3 numbers and 2 periods in between.
不一定,您可以使用 JDK 本身验证版本,详情如下。
除了在 Runtime.Version
中由 @Stephen 链接的 JEP 之外,JEP 可用于验证给定的版本字符串。这可以使用示例存根来完成:
[我想知道在这里使用 JShell 会很有趣,没有 IDE!]
Runtime.Version version = Runtime.Version.parse("9");
version = Runtime.Version.parse("9.0.1");
version = Runtime.Version.parse("9.0.0.15");
version = Runtime.Version.parse("9.0.0.15+181");
该代码使用 Version.parse
即
Parses the given string as a valid version string containing a version number followed by pre-release and build information.
并且可以进一步用于(主要)获取 (runtime) version.
的主要、次要、预发布和安全号码等信息该博文有点过时了。 Java 9 中实际实现的方案记录在 JEP 223: New Version-String Scheme
中前三个数字的含义是标准化的。第 4 个和(任何)后续数字的含义留给供应商指定。
还要注意第二个和第三个数字之间有趣的关系。
这里是 JEP 的相关部分。
"The sequence may be of arbitrary length but the first three elements are assigned specific meanings, as follows:
$MAJOR.$MINOR.$SECURITY
$MAJOR
- The major version number, incremented for a major release that contains significant new features as specified in a new edition of the Java SE Platform Specification, e.g., JSR 337 for Java SE 8. Features may be removed in a major release, given advance notice at least one major release ahead of time, and incompatible changes may be made when justified. The$MAJOR
version number of JDK 8 is 8; the$MAJOR
version number of JDK 9 is 9. When$MAJOR
is incremented, all subsequent elements are removed.
$MINOR
- The minor version number, incremented for a minor update release that may contain compatible bug fixes, revisions to standard APIs mandated by a Maintenance Release of the relevant Platform Specification, and implementation features outside the scope of that Specification such as new JDK-specific APIs, additional service providers, new garbage collectors, and ports to new hardware architectures.
$SECURITY
- The security level, incremented for a security-update release that contains critical fixes including those necessary to improve security.$SECURITY
is not reset to zero when$MINOR
is incremented. A higher value of$SECURITY
for a given$MAJOR
value, therefore, always indicates a more secure release, regardless of the value of$MINOR
.The fourth and later elements of a version number are free for use by downstream consumers of the JDK code base. Such a consumer may, e.g., use the fourth element to identify patch releases which contain a small number of critical non-security fixes in addition to the security fixes in the corresponding security release.