diff --git a/make/MacBundles.gmk b/make/MacBundles.gmk
index 2fa502a4c4..fcd102fb48 100644
--- a/make/MacBundles.gmk
+++ b/make/MacBundles.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -41,7 +41,7 @@ ifeq ($(OPENJDK_TARGET_OS), macosx)
BUNDLE_ID := $(MACOSX_BUNDLE_ID_BASE).$(VERSION_SHORT)
BUNDLE_NAME := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_SHORT)
BUNDLE_INFO := $(MACOSX_BUNDLE_NAME_BASE) $(VERSION_STRING)
- BUNDLE_PLATFORM_VERSION := $(VERSION_MAJOR).$(VERSION_MINOR)
+ BUNDLE_PLATFORM_VERSION := $(VERSION_FEATURE).$(VERSION_INTERIM)
BUNDLE_VERSION := $(VERSION_NUMBER)
ifeq ($(COMPANY_NAME), N/A)
BUNDLE_VENDOR := UNDEFINED
diff --git a/make/ReleaseFile.gmk b/make/ReleaseFile.gmk
index 00677030fa..14ebc9c32a 100644
--- a/make/ReleaseFile.gmk
+++ b/make/ReleaseFile.gmk
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -48,6 +48,9 @@ define create-info-file
$(call info-file-item, "SUN_ARCH_ABI", "$(JDK_ARCH_ABI_PROP_NAME)"))
$(call info-file-item, "SOURCE", "$(strip $(SOURCE_REVISION))")
$(call info-file-item, "IMPLEMENTOR", "$(COMPANY_NAME)")
+ $(if $(VENDOR_VERSION_STRING), \
+ $(call info-file-item, "IMPLEMENTOR_VERSION", "$(VENDOR_VERSION_STRING)"))
+ $(call info-file-item, "JAVA_VERSION_DATE", "$(VERSION_DATE)")
$(call info-file-item, "OS_NAME", "$(RELEASE_FILE_OS_NAME)")
$(call info-file-item, "OS_ARCH", "$(RELEASE_FILE_OS_ARCH)")
endef
diff --git a/make/autoconf/flags.m4 b/make/autoconf/flags.m4
index d272c0c3f6..b1c2982aa6 100644
--- a/make/autoconf/flags.m4
+++ b/make/autoconf/flags.m4
@@ -313,7 +313,7 @@ AC_DEFUN_ONCE([FLAGS_SETUP_INIT_FLAGS],
-D\"JDK_COMPONENT=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) binary\" \
-D\"JDK_VER=\$(VERSION_NUMBER)\" \
-D\"JDK_COPYRIGHT=Copyright \xA9 $COPYRIGHT_YEAR\" \
- -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_MAJOR)\" \
+ -D\"JDK_NAME=\$(PRODUCT_NAME) \$(JDK_RC_PLATFORM_NAME) \$(VERSION_FEATURE)\" \
-D\"JDK_FVER=\$(subst .,\$(COMMA),\$(VERSION_NUMBER_FOUR_POSITIONS))\""
JVM_RCFLAGS="$JVM_RCFLAGS \
diff --git a/make/autoconf/generated-configure.sh b/make/autoconf/generated-configure.sh
index 46ee3bade5..e11acdc166 100644
--- a/make/autoconf/generated-configure.sh
+++ b/make/autoconf/generated-configure.sh
@@ -887,6 +887,8 @@ JAVA
BOOT_JDK
JAVA_CHECK
JAVAC_CHECK
+VENDOR_VERSION_STRING
+VERSION_DATE
VERSION_IS_GA
VERSION_SHORT
VERSION_STRING
@@ -896,9 +898,9 @@ VERSION_OPT
VERSION_BUILD
VERSION_PRE
VERSION_PATCH
-VERSION_SECURITY
-VERSION_MINOR
-VERSION_MAJOR
+VERSION_UPDATE
+VERSION_INTERIM
+VERSION_FEATURE
MACOSX_BUNDLE_ID_BASE
MACOSX_BUNDLE_NAME_BASE
HOTSPOT_VM_DISTRO
@@ -1091,6 +1093,7 @@ infodir
docdir
oldincludedir
includedir
+runstatedir
localstatedir
sharedstatedir
sysconfdir
@@ -1141,14 +1144,19 @@ with_milestone
with_update_version
with_user_release_suffix
with_build_number
+with_version_major
+with_version_minor
+with_version_security
with_version_string
with_version_pre
with_version_opt
with_version_build
-with_version_major
-with_version_minor
-with_version_security
+with_version_feature
+with_version_interim
+with_version_update
with_version_patch
+with_version_date
+with_vendor_version_string
with_boot_jdk
with_build_jdk
with_import_modules
@@ -1375,6 +1383,7 @@ datadir='${datarootdir}'
sysconfdir='${prefix}/etc'
sharedstatedir='${prefix}/com'
localstatedir='${prefix}/var'
+runstatedir='${localstatedir}/run'
includedir='${prefix}/include'
oldincludedir='/usr/include'
docdir='${datarootdir}/doc/${PACKAGE_TARNAME}'
@@ -1627,6 +1636,15 @@ do
| -silent | --silent | --silen | --sile | --sil)
silent=yes ;;
+ -runstatedir | --runstatedir | --runstatedi | --runstated \
+ | --runstate | --runstat | --runsta | --runst | --runs \
+ | --run | --ru | --r)
+ ac_prev=runstatedir ;;
+ -runstatedir=* | --runstatedir=* | --runstatedi=* | --runstated=* \
+ | --runstate=* | --runstat=* | --runsta=* | --runst=* | --runs=* \
+ | --run=* | --ru=* | --r=*)
+ runstatedir=$ac_optarg ;;
+
-sbindir | --sbindir | --sbindi | --sbind | --sbin | --sbi | --sb)
ac_prev=sbindir ;;
-sbindir=* | --sbindir=* | --sbindi=* | --sbind=* | --sbin=* \
@@ -1764,7 +1782,7 @@ fi
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
- libdir localedir mandir
+ libdir localedir mandir runstatedir
do
eval ac_val=\$$ac_var
# Remove trailing slashes.
@@ -1917,6 +1935,7 @@ Fine tuning of the installation directories:
--sysconfdir=DIR read-only single-machine data [PREFIX/etc]
--sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
--localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --runstatedir=DIR modifiable per-process data [LOCALSTATEDIR/run]
--libdir=DIR object code libraries [EPREFIX/lib]
--includedir=DIR C header files [PREFIX/include]
--oldincludedir=DIR C header files for non-gcc [/usr/include]
@@ -2058,6 +2077,12 @@ Optional Packages:
compatibility and is ignored
--with-build-number Deprecated. Option is kept for backwards
compatibility and is ignored
+ --with-version-major Deprecated. Option is kept for backwards
+ compatibility and is ignored
+ --with-version-minor Deprecated. Option is kept for backwards
+ compatibility and is ignored
+ --with-version-security Deprecated. Option is kept for backwards
+ compatibility and is ignored
--with-version-string Set version string [calculated]
--with-version-pre Set the base part of the version 'PRE' field
(pre-release identifier) ['internal']
@@ -2065,14 +2090,17 @@ Optional Packages:
[ A version number, {@code $VNUM}, is a non-empty sequence
- * of elements separated by period characters (U+002E). An element is
- * either zero, or an unsigned integer numeral without leading zeros. The
- * final element in a version number must not be zero. The format is:
- * A version number, {@code $VNUM}, is a non-empty sequence of
+ * elements separated by period characters (U+002E). An element is either
+ * zero, or an unsigned integer numeral without leading zeros. The final
+ * element in a version number must not be zero. When an element is
+ * incremented, all subsequent elements are removed. The format is: The sequence may be of arbitrary length but the first three
- * elements are assigned specific meanings, as follows: The sequence may be of arbitrary length but the first four elements
+ * are assigned specific meanings, as follows: {@code $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 {@code $MAJOR}
- * version number of JDK 8 is {@code 8}; the {@code $MAJOR} version
- * number of JDK 9 is {@code 9}. When {@code $MAJOR} is incremented,
- * all subsequent elements are removed. {@code $FEATURE} — The
+ * feature-release counter, incremented for every feature release
+ * regardless of release content. Features may be added in a feature
+ * release; they may also be removed, if advance notice was given at least
+ * one feature release ahead of time. Incompatible changes may be made
+ * when justified. {@code $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. {@code $INTERIM} — The
+ * interim-release counter, incremented for non-feature releases that
+ * contain compatible bug fixes and enhancements but no incompatible
+ * changes, no feature removals, and no changes to standard APIs.
+ * {@code $SECURITY} --- The security
- * level, incremented for a security update release that contains critical
- * fixes including those necessary to improve security. {@code $SECURITY}
- * is not reset when {@code $MINOR} is incremented. A
- * higher value of {@code $SECURITY} for a given {@code $MAJOR} value,
- * therefore, always indicates a more secure release, regardless of the
- * value of {@code $MINOR}. {@code $UPDATE} — The update-release
+ * counter, incremented for compatible update releases that fix security
+ * issues, regressions, and bugs in newer features. {@code $PATCH} — The emergency
+ * patch-release counter, incremented only when it's necessary to produce
+ * an emergency release to fix a critical issue. The fourth and later elements of a version number are free for use
- * by downstream consumers of this 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. The fifth and later elements of a version number are free for use by
+ * platform implementors, to identify implementor-specific patch
+ * releases. The version number does not include trailing zero elements;
- * i.e., {@code $SECURITY} is omitted if it has the value zero,
- * and {@code $MINOR} is omitted if both {@code $MINOR} and {@code
- * $SECURITY} have the value zero. A version number never has trailing zero elements. If an element
+ * and all those that follow it logically have the value zero then all of
+ * them are omitted. The sequence of numerals in a version number is compared to another
* such sequence in numerical, pointwise fashion; e.g., {@code
- * 9.9.1} is less than {@code 9.10.3}. If one sequence is shorter than
- * another then the missing elements of the shorter sequence are
- * considered to be less than the corresponding elements of the longer
- * sequence; e.g., {@code 9.1.2} is less than {@code 9.1.2.1}.
- * Version numbers
*
- *
*
- *
- * [1-9][0-9]*((\.0)*\.[1-9][0-9]*)*
+ * [1-9][0-9]*((\.0)*\.[1-9][0-9]*)*
*
*
*
- * $MAJOR.$MINOR.$SECURITY
+ * $FEATURE.$INTERIM.$UPDATE.$PATCH
*
*
- *
*
- *
A version string, {@code $VSTR}, consists of a version - * number {@code $VNUM}, as described above, optionally followed by - * pre-release and build information, in one of the following formats: - *
+ *A version string, {@code $VSTR}, is a version number {@code + * $VNUM}, as described above, optionally followed by pre-release and build + * information, in one of the following formats:
* ** $VNUM(-$PRE)?\+$BUILD(-$OPT)? @@ -986,19 +973,19 @@ public class Runtime { ** *
* @@ -1082,7 +1069,7 @@ public class Runtime { throw new NullPointerException(); // Shortcut to avoid initializing VersionPattern when creating - // major version constants during startup + // feature-version constants during startup if (isSimpleNumber(s)) { return new Version(List.of(Integer.parseInt(s)), Optional.empty(), Optional.empty(), Optional.empty()); @@ -1139,43 +1126,114 @@ public class Runtime { } /** - * Returns the major version number. + * Returns the value of the feature element of + * the version number. * - * @return The major version number + * @return The value of the feature element + * + * @since 10 */ - public int major() { + public int feature() { return version.get(0); } /** - * Returns the minor version number or zero if it - * was not set. + * Returns the value of the interim element of + * the version number, or zero if it is absent. * - * @return The minor version number or zero if it was not set + * @return The value of the interim element, or zero + * + * @since 10 */ - public int minor() { + public int interim() { return (version.size() > 1 ? version.get(1) : 0); } /** - * Returns the security version number or zero - * if it was not set. + * Returns the value of the update element of the + * version number, or zero if it is absent. * - * @return The security version number or zero if it was not set + * @return The value of the update element, or zero + * + * @since 10 */ - public int security() { + public int update() { return (version.size() > 2 ? version.get(2) : 0); } /** - * Returns an unmodifiable {@link java.util.List List} of the - * integer numerals contained in the version - * number. The {@code List} always contains at least one - * element corresponding to the major version - * number. + * Returns the value of the patch element of the + * version number, or zero if it is absent. * - * @return An unmodifiable list of the integer numerals - * contained in the version number + * @return The value of the patch element, or zero + * + * @since 10 + */ + public int patch() { + return (version.size() > 3 ? version.get(3) : 0); + } + + /** + * Returns the value of the major element of the version number. + * + * @deprecated As of Java SE 10, the first element of a version + * number is not the major-release number but the feature-release + * counter, incremented for every time-based release. Use the {@link + * #feature()} method in preference to this method. For compatibility, + * this method returns the value of the feature + * element. + * + * @return The value of the feature element + */ + @Deprecated(since = "10") + public int major() { + return feature(); + } + + /** + * Returns the value of the minor element of the version number, or + * zero if it is absent. + * + * @deprecated As of Java SE 10, the second element of a version + * number is not the minor-release number but the interim-release + * counter, incremented for every interim release. Use the {@link + * #interim()} method in preference to this method. For compatibility, + * this method returns the value of the interim + * element, or zero if it is absent. + * + * @return The value of the interim element, or zero + */ + @Deprecated(since = "10") + public int minor() { + return interim(); + } + + /** + * Returns the value of the security element of the version number, or + * zero if it is absent. + * + * @deprecated As of Java SE 10, the third element of a version + * number is not the security level but the update-release counter, + * incremented for every update release. Use the {@link #update()} + * method in preference to this method. For compatibility, this method + * returns the value of the update element, or + * zero if it is absent. + * + * @return The value of the update element, or zero + */ + @Deprecated(since = "10") + public int security() { + return update(); + } + + /** + * Returns an unmodifiable {@link java.util.List List} of the integers + * represented in the version number. The {@code + * List} always contains at least one element corresponding to the feature version number. + * + * @return An unmodifiable list of the integers + * represented in the version number */ public List- + * — A pre-release identifier. Typically {@code ea}, for a + * potentially unstable early-access release under active development, or + * {@code internal}, for an internal developer build. * *
{@code $PRE}, matching {@code ([a-zA-Z0-9]+)} - * --- A pre-release identifier. Typically {@code ea}, for a - * potentially unstable early-access release under active development, - * or {@code internal}, for an internal developer build.
- * - *
{@code $BUILD}, matching {@code - * (0|[1-9][0-9]*)} --- The build number, incremented for each promoted + * (0|[1-9][0-9]*)} — The build number, incremented for each promoted * build. {@code $BUILD} is reset to {@code 1} when any portion of {@code * $VNUM} is incremented.
- + *
{@code $OPT}, matching {@code - * ([-a-zA-Z0-9.]+)} --- Additional build information, if desired. In - * the case of an {@code internal} build this will often contain the date - * and time of the build.
- * *
{@code $OPT}, matching {@code ([-a-zA-Z0-9.]+)} + * — Additional build information, if desired. In the case of an + * {@code internal} build this will often contain the date and time of the + * build.
version() { return version; diff --git a/src/java.base/share/classes/java/lang/System.java b/src/java.base/share/classes/java/lang/System.java index b28b5793ab..04c98cace8 100644 --- a/src/java.base/share/classes/java/lang/System.java +++ b/src/java.base/share/classes/java/lang/System.java @@ -550,8 +550,10 @@ public final class System { * System properties. The following properties are guaranteed to be defined: * *
- java.version
- Java version number + *
- java.version.date
- Java version date *
- java.vendor
- Java vendor specific string *
- java.vendor.url
- Java vendor URL + *
- java.vendor.version
- Java vendor version *
- java.home
- Java installation directory *
- java.class.version
- Java class version number *
- java.class.path
- Java classpath @@ -591,12 +593,18 @@ public final class System { * * *
+ * - * java.version
Java Runtime Environment version which may be interpreted + * Java Runtime Environment version, which may be interpreted * as a {@link Runtime.Version} * + * java.version.date
Java Runtime Environment version date, in ISO-8601 YYYY-MM-DD + * format, which may be interpreted as a {@link + * java.time.LocalDate} * * java.vendor
Java Runtime Environment vendor + * * java.vendor.url
Java vendor URL * + * java.vendor.version
Java vendor version * * java.home
Java installation directory diff --git a/src/java.base/share/classes/java/lang/VersionProps.java.template b/src/java.base/share/classes/java/lang/VersionProps.java.template index 53a9160c8c..031d1393d3 100644 --- a/src/java.base/share/classes/java/lang/VersionProps.java.template +++ b/src/java.base/share/classes/java/lang/VersionProps.java.template @@ -32,13 +32,15 @@ import java.util.Optional; class VersionProps { - private static final String launcher_name = "@@LAUNCHER_NAME@@"; private static final String java_version = "@@VERSION_SHORT@@"; + private static final String java_version_date = + "@@VERSION_DATE@@"; + private static final String java_runtime_name = "@@RUNTIME_NAME@@"; @@ -57,14 +59,27 @@ class VersionProps { private static final String VERSION_OPT = "@@VERSION_OPT@@"; + private static final boolean isLTS = + "@@VERSION_OPT@@".startsWith("LTS"); + + private static final String VENDOR_VERSION_STRING = + "@@VENDOR_VERSION_STRING@@"; + + private static final String vendor_version = + (VENDOR_VERSION_STRING.length() > 0 + ? " " + VENDOR_VERSION_STRING : ""); + static { init(); } public static void init() { System.setProperty("java.version", java_version); + System.setProperty("java.version.date", java_version_date); System.setProperty("java.runtime.version", java_runtime_version); System.setProperty("java.runtime.name", java_runtime_name); + if (VENDOR_VERSION_STRING.length() > 0) + System.setProperty("java.vendor.version", VENDOR_VERSION_STRING); } private static int parseVersionNumber(String version, int prevIndex, int index) { @@ -162,31 +177,36 @@ class VersionProps { /* First line: platform version. */ if (err) { - ps.println(launcher_name + " version \"" + java_version + "\""); + ps.println(launcher_name + " version \"" + java_version + "\"" + + " " + java_version_date + + (isLTS ? " LTS" : "")); } else { /* Use a format more in line with GNU conventions */ - ps.println(launcher_name + " " + java_version); + ps.println(launcher_name + " " + java_version + + " " + java_version_date + + (isLTS ? " LTS" : "")); } /* Second line: runtime version (ie, libraries). */ String jdk_debug_level = System.getProperty("jdk.debug", "release"); - /* Debug level is not printed for "release" builds */ if ("release".equals(jdk_debug_level)) { + /* Do not show debug level "release" builds */ jdk_debug_level = ""; } else { jdk_debug_level = jdk_debug_level + " "; } - ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version); - - ps.println(')'); + ps.println(java_runtime_name + vendor_version + + " (" + jdk_debug_level + "build " + java_runtime_version + ")"); /* Third line: JVM information. */ String java_vm_name = System.getProperty("java.vm.name"); String java_vm_version = System.getProperty("java.vm.version"); String java_vm_info = System.getProperty("java.vm.info"); - ps.println(java_vm_name + " (" + jdk_debug_level + "build " + java_vm_version + ", " + - java_vm_info + ")"); + ps.println(java_vm_name + vendor_version + + " (" + jdk_debug_level + "build " + java_vm_version + ", " + + java_vm_info + ")"); + } } diff --git a/src/java.base/share/classes/java/util/jar/JarFile.java b/src/java.base/share/classes/java/util/jar/JarFile.java index bea2663295..c4e20f357e 100644 --- a/src/java.base/share/classes/java/util/jar/JarFile.java +++ b/src/java.base/share/classes/java/util/jar/JarFile.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -112,9 +112,9 @@ import java.util.zip.ZipFile; * java.vm.specification.version
- * {@code jdk.util.jar.version} can be assigned a value that is the * {@code String} representation of a non-negative integer - * {@code <= Runtime.version().major()}. The value is used to set the effective + * {@code <= Runtime.version().feature()}. The value is used to set the effective * runtime version to something other than the default value obtained by - * evaluating {@code Runtime.version().major()}. The effective runtime version + * evaluating {@code Runtime.version().feature()}. The effective runtime version * is the version that the {@link JarFile#JarFile(File, boolean, int, Runtime.Version)} * constructor uses when the value of the last argument is * {@code JarFile.runtimeVersion()}. @@ -143,7 +143,7 @@ import java.util.zip.ZipFile; public class JarFile extends ZipFile { private final static Runtime.Version BASE_VERSION; - private final static int BASE_VERSION_MAJOR; + private final static int BASE_VERSION_FEATURE; private final static Runtime.Version RUNTIME_VERSION; private final static boolean MULTI_RELEASE_ENABLED; private final static boolean MULTI_RELEASE_FORCED; @@ -153,7 +153,7 @@ class JarFile extends ZipFile { private boolean jvInitialized; private boolean verify; private final Runtime.Version version; // current version - private final int versionMajor; // version.major() + private final int versionFeature; // version.feature() private boolean isMultiRelease; // is jar multi-release? // indicates if Class-Path attribute present @@ -170,14 +170,14 @@ class JarFile extends ZipFile { JUZFA = jdk.internal.misc.SharedSecrets.getJavaUtilZipFileAccess(); // multi-release jar file versions >= 9 BASE_VERSION = Runtime.Version.parse(Integer.toString(8)); - BASE_VERSION_MAJOR = BASE_VERSION.major(); + BASE_VERSION_FEATURE = BASE_VERSION.feature(); String jarVersion = GetPropertyAction.privilegedGetProperty("jdk.util.jar.version"); - int runtimeVersion = Runtime.version().major(); + int runtimeVersion = Runtime.version().feature(); if (jarVersion != null) { int jarVer = Integer.parseInt(jarVersion); runtimeVersion = (jarVer > runtimeVersion) ? runtimeVersion - : Math.max(jarVer, BASE_VERSION_MAJOR); + : Math.max(jarVer, BASE_VERSION_FEATURE); } RUNTIME_VERSION = Runtime.Version.parse(Integer.toString(runtimeVersion)); String enableMultiRelease = GetPropertyAction @@ -224,10 +224,10 @@ class JarFile extends ZipFile { * Returns the version that represents the effective runtime versioned * configuration of a multi-release jar file. *
- * By default the major version number of the returned {@code Version} will - * be equal to the major version number of {@code Runtime.version()}. + * By default the feature version number of the returned {@code Version} will + * be equal to the feature version number of {@code Runtime.version()}. * However, if the {@code jdk.util.jar.version} property is set, the - * returned {@code Version} is derived from that property and major version + * returned {@code Version} is derived from that property and feature version * numbers may not be equal. * * @return the version that represents the runtime versioned configuration @@ -322,7 +322,7 @@ class JarFile extends ZipFile { *
* The canonical form derived from the version parameter is * {@code Runtime.Version.parse(Integer.toString(n))} where {@code n} is - * {@code Math.max(version.major(), JarFile.baseVersion().major())}. + * {@code Math.max(version.feature(), JarFile.baseVersion().feature())}. * * @param file the jar file to be opened for reading * @param verify whether or not to verify the jar file if @@ -341,17 +341,17 @@ class JarFile extends ZipFile { super(file, mode); this.verify = verify; Objects.requireNonNull(version); - if (MULTI_RELEASE_FORCED || version.major() == RUNTIME_VERSION.major()) { + if (MULTI_RELEASE_FORCED || version.feature() == RUNTIME_VERSION.feature()) { // This deals with the common case where the value from JarFile.runtimeVersion() is passed this.version = RUNTIME_VERSION; - } else if (version.major() <= BASE_VERSION_MAJOR) { + } else if (version.feature() <= BASE_VERSION_FEATURE) { // This also deals with the common case where the value from JarFile.baseVersion() is passed this.version = BASE_VERSION; } else { // Canonicalize - this.version = Runtime.Version.parse(Integer.toString(version.major())); + this.version = Runtime.Version.parse(Integer.toString(version.feature())); } - this.versionMajor = this.version.major(); + this.versionFeature = this.version.feature(); } /** @@ -579,7 +579,7 @@ class JarFile extends ZipFile { // filter out dir META-INF/versions/ and META-INF/versions/*/ // and any entry with version > 'version' if (index == -1 || index == (name.length() - 1) || - Integer.parseInt(name, off, index, 10) > versionMajor) { + Integer.parseInt(name, off, index, 10) > versionFeature) { return null; } } catch (NumberFormatException x) { @@ -592,11 +592,11 @@ class JarFile extends ZipFile { } private JarEntry getVersionedEntry(String name, JarEntry je) { - if (BASE_VERSION_MAJOR < versionMajor) { + if (BASE_VERSION_FEATURE < versionFeature) { if (!name.startsWith(META_INF)) { // search for versioned entry - int v = versionMajor; - while (v > BASE_VERSION_MAJOR) { + int v = versionFeature; + while (v > BASE_VERSION_FEATURE) { JarFileEntry vje = getEntry0(META_INF_VERSIONS + v + "/" + name); if (vje != null) { return vje.withBasename(name); @@ -673,7 +673,7 @@ class JarFile extends ZipFile { } JarFileEntry realEntry() { - if (isMultiRelease() && versionMajor != BASE_VERSION_MAJOR) { + if (isMultiRelease() && versionFeature != BASE_VERSION_FEATURE) { String entryName = super.getName(); return entryName == basename || entryName.equals(basename) ? this : new JarFileEntry(entryName, this); diff --git a/src/java.base/share/native/libjava/jdk_util.c b/src/java.base/share/native/libjava/jdk_util.c index f7f55ad37e..208350328c 100644 --- a/src/java.base/share/native/libjava/jdk_util.c +++ b/src/java.base/share/native/libjava/jdk_util.c @@ -1,5 +1,5 @@ /* - * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -34,9 +34,9 @@ JNIEXPORT void JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) { /* These VERSION_* macros are given by the build system */ - const unsigned int version_major = VERSION_MAJOR; - const unsigned int version_minor = VERSION_MINOR; - const unsigned int version_security = VERSION_SECURITY; + const unsigned int version_major = VERSION_FEATURE; + const unsigned int version_minor = VERSION_INTERIM; + const unsigned int version_security = VERSION_UPDATE; const unsigned int version_patch = VERSION_PATCH; const unsigned int version_build = VERSION_BUILD; diff --git a/src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java b/src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java index b4d4d11d15..a1e0662a8c 100644 --- a/src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java +++ b/src/jdk.jconsole/share/classes/sun/tools/jconsole/AboutDialog.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2006, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2006, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -181,7 +181,7 @@ public class AboutDialog extends InternalDialog { } private static String getOnlineDocUrl() { - String version = Integer.toString(Runtime.version().major()); + String version = Integer.toString(Runtime.version().feature()); return Resources.format(Messages.HELP_ABOUT_DIALOG_USER_GUIDE_LINK_URL, version); } diff --git a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java index 5904907cda..1a91ccbb3e 100644 --- a/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java +++ b/src/jdk.jlink/share/classes/jdk/tools/jlink/internal/JlinkTask.java @@ -448,13 +448,14 @@ public class JlinkTask { // java.base version is different than the current runtime version version = Runtime.Version.parse(v.toString()); - if (Runtime.version().major() != version.major() || - Runtime.version().minor() != version.minor()) { + if (Runtime.version().feature() != version.feature() || + Runtime.version().interim() != version.interim()) + { // jlink version and java.base version do not match. // We do not (yet) support this mode. throw new IllegalArgumentException(taskHelper.getMessage("err.jlink.version.mismatch", - Runtime.version().major(), Runtime.version().minor(), - version.major(), version.minor())); + Runtime.version().feature(), Runtime.version().interim(), + version.feature(), version.interim())); } } diff --git a/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java b/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java index c0abb244a8..38b3b78da6 100644 --- a/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java +++ b/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Main.java @@ -1,5 +1,5 @@ /* - * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -299,7 +299,7 @@ public final class Main extends Shell { private static String JAVADOC_BASE = "https://docs.oracle.com/javase/%d/docs/api/"; private static void openBrowserForJavadoc(ScriptFunction browse, String relativeUrl) { try { - final URI uri = new URI(String.format(JAVADOC_BASE, Runtime.version().major()) + relativeUrl); + final URI uri = new URI(String.format(JAVADOC_BASE, Runtime.version().feature()) + relativeUrl); ScriptRuntime.apply(browse, null, uri); } catch (Exception ignored) { } diff --git a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java index 2fec88e022..81c01f5484 100644 --- a/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java +++ b/src/jdk.zipfs/share/classes/jdk/nio/zipfs/JarFileSystem.java @@ -70,14 +70,14 @@ class JarFileSystem extends ZipFileSystem { if (o instanceof String) { String s = (String)o; if (s.equals("runtime")) { - version = Runtime.version().major(); + version = Runtime.version().feature(); } else { version = Integer.parseInt(s); } } else if (o instanceof Integer) { version = (Integer)o; } else if (o instanceof Version) { - version = ((Version)o).major(); + version = ((Version)o).feature(); } else { throw new IllegalArgumentException("env parameter must be String, Integer, " + "or Version"); diff --git a/test/jdk/java/lang/Runtime/Version/Basic.java b/test/jdk/java/lang/Runtime/Version/Basic.java index 2bac3be8be..26c4c6df6f 100644 --- a/test/jdk/java/lang/Runtime/Version/Basic.java +++ b/test/jdk/java/lang/Runtime/Version/Basic.java @@ -38,6 +38,7 @@ import java.util.stream.Collectors; import static java.lang.System.out; public class Basic { + private static final Class extends Throwable> IAE = IllegalArgumentException.class; private static final Class extends Throwable> NPE @@ -51,17 +52,19 @@ public class Basic { public static void main(String ... args) { - //// Tests for parse(), major(), minor(), security(), pre(), - //// build(), optional(), version(), toString() - // v M m sec pre bld opt + //// Tests for parse(), feature(), interim(), update(), patch(), + //// pre(), build(), optional(), version(), and toString() + // v f i u p pre bld opt // $VNUM - test("9", 9, 0, 0, "", 0, ""); - test("9.1", 9, 1, 0, "", 0, ""); - test("9.0.1", 9, 0, 1, "", 0, ""); - test("404.1.2", 404, 1, 2, "", 0, ""); - test("9.1.2.3", 9, 1, 2, "", 0, ""); - test("1000.0.0.0.0.0.99999999", 1000, 0, 0, "", 0, ""); + test("9", 9, 0, 0, 0, "", 0, ""); + test("9.1", 9, 1, 0, 0, "", 0, ""); + test("9.0.1", 9, 0, 1, 0, "", 0, ""); + test("9.0.0.1", 9, 0, 0, 1, "", 0, ""); + test("9.0.0.0.1", 9, 0, 0, 0, "", 0, ""); + test("404.1.2", 404, 1, 2, 0, "", 0, ""); + test("9.1.2.3", 9, 1, 2, 3, "", 0, ""); + test("1000.0.0.0.0.0.99999999", 1000, 0, 0, 0, "", 0, ""); tryCatch(null, NPE); tryCatch("", IAE); @@ -75,23 +78,23 @@ public class Basic { tryCatch(TOO_BIG_STR, NFE); // $PRE - test("9-ea", 9, 0, 0, "ea", 0, ""); - test("9-internal", 9, 0, 0, "internal", 0, ""); - test("9-0", 9, 0, 0, "0", 0, ""); - test("9.2.7-8", 9, 2, 7, "8", 0, ""); - test("1-ALL", 1, 0, 0, "ALL", 0, ""); - test("2.3.4.5-1a", 2, 3, 4, "1a", 0, ""); - test("1-" + TOO_BIG_STR, 1, 0, 0, TOO_BIG_STR, 0, ""); + test("9-ea", 9, 0, 0, 0, "ea", 0, ""); + test("9-internal", 9, 0, 0, 0, "internal", 0, ""); + test("9-0", 9, 0, 0, 0, "0", 0, ""); + test("9.2.7-8", 9, 2, 7, 0, "8", 0, ""); + test("1-ALL", 1, 0, 0, 0, "ALL", 0, ""); + test("2.3.4.5-1a", 2, 3, 4, 5, "1a", 0, ""); + test("1-" + TOO_BIG_STR, 1, 0, 0, 0, TOO_BIG_STR, 0, ""); tryCatch("9:-ea", IAE); tryCatch("3.14159-", IAE); tryCatch("3.14159-%", IAE); // $BUILD - test("9+0", 9, 0, 0, "", 0, ""); - test("3.14+9999900", 3, 14, 0, "", 9999900, ""); - test("9-pre+105", 9, 0, 0, "pre", 105, ""); - test("6.0.42-8beta+4", 6, 0, 42, "8beta", 4, ""); + test("9+0", 9, 0, 0, 0, "", 0, ""); + test("3.14+9999900", 3, 14, 0, 0, "", 9999900, ""); + test("9-pre+105", 9, 0, 0, 0, "pre", 105, ""); + test("6.0.42-8beta+4", 6, 0, 42, 0, "8beta", 4, ""); tryCatch("9+", IAE); tryCatch("7+a", IAE); @@ -101,13 +104,13 @@ public class Basic { tryCatch("1+" + TOO_BIG_STR, NFE); // $OPT - test("9+-foo", 9, 0, 0, "", 0, "foo"); - test("9-pre-opt", 9, 0, 0, "pre", 0, "opt"); - test("42+---bar", 42, 0, 0, "", 0, "--bar"); - test("2.91+-8061493-", 2, 91, 0, "", 0, "8061493-"); - test("24+-foo.bar", 24, 0, 0, "", 0, "foo.bar"); - test("9-ribbit+17-...", 9, 0, 0, "ribbit", 17, "..."); - test("7+1-" + TOO_BIG_STR, 7,0, 0, "", 1, TOO_BIG_STR); + test("9+-foo", 9, 0, 0, 0, "", 0, "foo"); + test("9-pre-opt", 9, 0, 0, 0, "pre", 0, "opt"); + test("42+---bar", 42, 0, 0, 0, "", 0, "--bar"); + test("2.91+-8061493-", 2, 91, 0, 0, "", 0, "8061493-"); + test("24+-foo.bar", 24, 0, 0, 0, "", 0, "foo.bar"); + test("9-ribbit+17-...", 9, 0, 0, 0, "ribbit", 17, "..."); + test("7+1-" + TOO_BIG_STR, 7,0, 0, 0, "", 1, TOO_BIG_STR); tryCatch("9-pre+-opt", IAE); tryCatch("1.4142+-", IAE); @@ -127,6 +130,8 @@ public class Basic { testEHC("9", "8", false, false, 1, 1); testEHC("10.512.1", "10.512.2", false, false, -1, -1); + testEHC("10.512.0.1", "10.512.0.2", false, false, -1, -1); + testEHC("10.512.0.0.1", "10.512.0.0.2", false, false, -1, -1); testEHC("512.10.1", "512.11.1", false, false, -1, -1); // $OPT comparison @@ -164,17 +169,21 @@ public class Basic { } - private static void test(String s, Integer major, Integer minor, - Integer sec, String pre, Integer build, - String opt) + private static void test(String s, Integer feature, Integer interim, + Integer update, Integer patch, + String pre, Integer build, String opt) { Version v = testParse(s); testStr(v.toString(), s); - testInt(v.major(), major); - testInt(v.minor(), minor); - testInt(v.security(), sec); + testInt(v.feature(), feature); + testInt(v.major(), feature); + testInt(v.interim(), interim); + testInt(v.minor(), interim); + testInt(v.update(), update); + testInt(v.security(), update); + testInt(v.patch(), patch); testStr((v.pre().isPresent() ? v.pre().get() : ""), pre); testInt((v.build().isPresent() ? v.build().get() : 0), build); testStr((v.optional().isPresent() ? v.optional().get() : ""), opt); @@ -381,4 +390,5 @@ public class Basic { first = x; } } + }