--- a/jdk/make/CompileDemos.gmk Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/make/CompileDemos.gmk Mon Jun 29 11:28:02 2015 -0700
@@ -55,7 +55,8 @@
SOURCE_FILES := $(JDK_TOPDIR)/make/data/mainmanifest/manifest.mf, \
OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/demo/java-main-manifest.mf, \
REPLACEMENTS := \
- @@RELEASE@@ => $(RELEASE) ; \
+ @@VERSION_SPECIFICATION@@ => $(VERSION_SPECIFICATION) ; \
+ @@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
@@COMPANY_NAME@@ => $(COMPANY_NAME) , \
))
--- a/jdk/make/data/mainmanifest/manifest.mf Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/make/data/mainmanifest/manifest.mf Mon Jun 29 11:28:02 2015 -0700
@@ -1,7 +1,7 @@
Manifest-Version: 1.0
Specification-Title: Java Platform API Specification
-Specification-Version: 1.9
+Specification-Version: @@VERSION_SPECIFICATION@@
Specification-Vendor: Oracle Corporation
Implementation-Title: Java Runtime Environment
-Implementation-Version: @@RELEASE@@
+Implementation-Version: @@VERSION_SHORT@@
Implementation-Vendor: @@COMPANY_NAME@@
--- a/jdk/make/gensrc/GensrcMisc.gmk Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/make/gensrc/GensrcMisc.gmk Mon Jun 29 11:28:02 2015 -0700
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2011, 2014, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2011, 2015, 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
@@ -26,28 +26,18 @@
##########################################################################################
# Install the launcher name, release version string, full version
# string and the runtime name into the Version.java file.
-# To be printed by java -version
-
-# These dependencies should ideally be added to prerequesites for Version.java
-# but skip for now until we have better incremental build for java.
-# $(call DependOnVariable, LAUNCHER_NAME) \
-# $(call DependOnVariable, RELEASE) \
-# $(call DependOnVariable, FULL_VERSION) \
-# $(call DependOnVariable, RUNTIME_VERSION)
-$(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java: \
- $(JDK_TOPDIR)/src/java.base/share/classes/sun/misc/Version.java.template
- $(MKDIR) -p $(@D)
- $(RM) $@ $@.tmp
- $(ECHO) Generating sun/misc/Version.java
- $(SED) -e 's/@@launcher_name@@/$(LAUNCHER_NAME)/g' \
- -e 's/@@java_version@@/$(RELEASE)/g' \
- -e 's/@@java_runtime_version@@/$(FULL_VERSION)/g' \
- -e 's/@@java_runtime_name@@/$(RUNTIME_NAME)/g' \
- $< > $@.tmp
- $(MV) $@.tmp $@
+$(eval $(call SetupTextFileProcessing, BUILD_VERSION_JAVA, \
+ SOURCE_FILES := $(JDK_TOPDIR)/src/java.base/share/classes/sun/misc/Version.java.template, \
+ OUTPUT_FILE := $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java, \
+ REPLACEMENTS := \
+ @@LAUNCHER_NAME@@ => $(LAUNCHER_NAME) ; \
+ @@RUNTIME_NAME@@ => $(RUNTIME_NAME) ; \
+ @@VERSION_SHORT@@ => $(VERSION_SHORT) ; \
+ @@VERSION_STRING@@ => $(VERSION_STRING), \
+))
-GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java
+GENSRC_JAVA_BASE += $(BUILD_VERSION_JAVA)
##########################################################################################
--- a/jdk/make/launcher/Launcher-jdk.accessibility.gmk Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/make/launcher/Launcher-jdk.accessibility.gmk Mon Jun 29 11:28:02 2015 -0700
@@ -52,7 +52,7 @@
-D "JDK_INTERNAL_NAME=jabswitch" \
-D "JDK_FTYPE=0x01L", \
MANIFEST := $(JABSWITCH_SRC)/jabswitch.manifest, \
- MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
+ MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
))
TARGETS += $(BUILD_JABSWITCH)
--- a/jdk/make/launcher/Launcher-jdk.pack200.gmk Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/make/launcher/Launcher-jdk.pack200.gmk Mon Jun 29 11:28:02 2015 -0700
@@ -103,7 +103,7 @@
-D "JDK_FTYPE=0x1L", \
DEBUG_SYMBOLS := true, \
MANIFEST := $(JDK_TOPDIR)/src/jdk.pack200/windows/native/unpack200/unpack200_proto.exe.manifest, \
- MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
+ MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
))
ifneq ($(USE_EXTERNAL_LIBZ), true)
--- a/jdk/make/launcher/LauncherCommon.gmk Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/make/launcher/LauncherCommon.gmk Mon Jun 29 11:28:02 2015 -0700
@@ -164,9 +164,7 @@
OPTIMIZATION := $$($1_OPTIMIZATION_ARG), \
CFLAGS := $$($1_CFLAGS) \
$(LAUNCHER_CFLAGS) \
- -DFULL_VERSION='"$(FULL_VERSION)"' \
- -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
- -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
+ $(VERSION_CFLAGS) \
-DLAUNCHER_NAME='"$(LAUNCHER_NAME)"' \
-DPROGNAME='"$1"' $(DPACKAGEPATH) \
$2, \
@@ -198,7 +196,7 @@
-D "JDK_FTYPE=0x1L" \
$7, \
MANIFEST := $(JAVA_MANIFEST), \
- MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
+ MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
CODESIGN := $$($1_CODESIGN), \
)
--- a/jdk/make/lib/CoreLibraries.gmk Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/make/lib/CoreLibraries.gmk Mon Jun 29 11:28:02 2015 -0700
@@ -119,15 +119,6 @@
-I$(SUPPORT_OUTPUTDIR)/headers/java.base \
-DARCHPROPNAME='"$(OPENJDK_TARGET_CPU_OSARCH)"'
-LIBJAVA_CFLAGS += -DJDK_MAJOR_VERSION='"$(JDK_MAJOR_VERSION)"' \
- -DJDK_MINOR_VERSION='"$(JDK_MINOR_VERSION)"' \
- -DJDK_MICRO_VERSION='"$(JDK_MICRO_VERSION)"' \
- -DJDK_BUILD_NUMBER='"$(JDK_BUILD_NUMBER)"'
-
-ifneq (, $(JDK_UPDATE_VERSION))
- LIBJAVA_CFLAGS += -DJDK_UPDATE_VERSION='"$(JDK_UPDATE_VERSION)"'
-endif
-
ifeq ($(OPENJDK_TARGET_OS), macosx)
BUILD_LIBJAVA_java_props_md.c_CFLAGS := -x objective-c
BUILD_LIBJAVA_java_props_macosx.c_CFLAGS := -x objective-c
@@ -146,6 +137,8 @@
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
+ System.c_CFLAGS := $(VERSION_CFLAGS), \
+ jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \
$(call SET_SHARED_LIBRARY_ORIGIN), \
--- a/jdk/make/mapfiles/libjava/mapfile-vers Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/make/mapfiles/libjava/mapfile-vers Mon Jun 29 11:28:02 2015 -0700
@@ -269,9 +269,7 @@
Java_sun_reflect_Reflection_getCallerClass__I;
Java_sun_reflect_Reflection_getClassAccessFlags;
Java_sun_misc_Version_getJdkVersionInfo;
- Java_sun_misc_Version_getJdkSpecialVersion;
Java_sun_misc_Version_getJvmVersionInfo;
- Java_sun_misc_Version_getJvmSpecialVersion;
Java_sun_misc_VM_latestUserDefinedLoader;
Java_sun_misc_VM_getuid;
Java_sun_misc_VM_geteuid;
--- a/jdk/src/java.base/share/classes/sun/misc/Version.java.template Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/classes/sun/misc/Version.java.template Mon Jun 29 11:28:02 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2015, 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
@@ -30,16 +30,16 @@
private static final String launcher_name =
- "@@launcher_name@@";
+ "@@LAUNCHER_NAME@@";
private static final String java_version =
- "@@java_version@@";
+ "@@VERSION_SHORT@@";
private static final String java_runtime_name =
- "@@java_runtime_name@@";
+ "@@RUNTIME_NAME@@";
private static final String java_runtime_version =
- "@@java_runtime_version@@";
+ "@@VERSION_STRING@@";
static {
init();
@@ -54,16 +54,14 @@
private static boolean versionsInitialized = false;
private static int jvm_major_version = 0;
private static int jvm_minor_version = 0;
- private static int jvm_micro_version = 0;
- private static int jvm_update_version = 0;
+ private static int jvm_security_version = 0;
+ private static int jvm_patch_version = 0;
private static int jvm_build_number = 0;
- private static String jvm_special_version = null;
private static int jdk_major_version = 0;
private static int jdk_minor_version = 0;
- private static int jdk_micro_version = 0;
- private static int jdk_update_version = 0;
+ private static int jdk_security_version = 0;
+ private static int jdk_patch_version = 0;
private static int jdk_build_number = 0;
- private static String jdk_special_version = null;
/**
* In case you were wondering this method is called by java -version.
@@ -146,44 +144,29 @@
/**
- * Returns the micro version of the running JVM if it's 1.6 or newer
- * or any RE VM build. It will return 0 if it's an internal 1.5 or
- * 1.4.x build.
+ * Returns the security version of the running JVM
* @since 1.6
*/
- public static synchronized int jvmMicroVersion() {
+ public static synchronized int jvmSecurityVersion() {
if (!versionsInitialized) {
initVersions();
}
- return jvm_micro_version;
+ return jvm_security_version;
}
/**
- * Returns the update release version of the running JVM if it's
- * a RE build. It will return 0 if it's an internal build.
- * @since 1.6
+ * Returns the patch release version of the running JVM
+ * @since JDK9
*/
- public static synchronized int jvmUpdateVersion() {
+ public static synchronized int jvmPatchVersion() {
if (!versionsInitialized) {
initVersions();
}
- return jvm_update_version;
+ return jvm_patch_version;
}
- public static synchronized String jvmSpecialVersion() {
- if (!versionsInitialized) {
- initVersions();
- }
- if (jvm_special_version == null) {
- jvm_special_version = getJvmSpecialVersion();
- }
- return jvm_special_version;
- }
- public static native String getJvmSpecialVersion();
-
/**
- * Returns the build number of the running JVM if it's a RE build
- * It will return 0 if it's an internal build.
+ * Returns the build number of the running JVM
* @since 1.6
*/
public static synchronized int jvmBuildNumber() {
@@ -217,42 +200,29 @@
}
/**
- * Returns the micro version of the running JDK.
+ * Returns the security version of the running JDK.
* @since 1.6
*/
- public static synchronized int jdkMicroVersion() {
+ public static synchronized int jdkSecurityVersion() {
if (!versionsInitialized) {
initVersions();
}
- return jdk_micro_version;
+ return jdk_security_version;
}
/**
- * Returns the update release version of the running JDK if it's
- * a RE build. It will return 0 if it's an internal build.
- * @since 1.6
+ * Returns the patch release version of the running JDK
+ * @since 9
*/
- public static synchronized int jdkUpdateVersion() {
+ public static synchronized int jdkPatchVersion() {
if (!versionsInitialized) {
initVersions();
}
- return jdk_update_version;
+ return jdk_patch_version;
}
- public static synchronized String jdkSpecialVersion() {
- if (!versionsInitialized) {
- initVersions();
- }
- if (jdk_special_version == null) {
- jdk_special_version = getJdkSpecialVersion();
- }
- return jdk_special_version;
- }
- public static native String getJdkSpecialVersion();
-
/**
- * Returns the build number of the running JDK if it's a RE build
- * It will return 0 if it's an internal build.
+ * Returns the build number of the running JDK
* @since 1.6
*/
public static synchronized int jdkBuildNumber() {
@@ -262,64 +232,12 @@
return jdk_build_number;
}
- // true if JVM exports the version info including the capabilities
- private static boolean jvmVersionInfoAvailable;
private static synchronized void initVersions() {
if (versionsInitialized) {
return;
}
- jvmVersionInfoAvailable = getJvmVersionInfo();
- if (!jvmVersionInfoAvailable) {
- // parse java.vm.version for older JVM before the
- // new JVM_GetVersionInfo is added.
- // valid format of the version string is:
- // n.n.n[_uu[c]][-<identifer>]-bxx
- CharSequence cs = System.getProperty("java.vm.version");
- if (cs.length() >= 5 &&
- Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' &&
- Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' &&
- Character.isDigit(cs.charAt(4))) {
- jvm_major_version = Character.digit(cs.charAt(0), 10);
- jvm_minor_version = Character.digit(cs.charAt(2), 10);
- jvm_micro_version = Character.digit(cs.charAt(4), 10);
- cs = cs.subSequence(5, cs.length());
- if (cs.charAt(0) == '_' && cs.length() >= 3 &&
- Character.isDigit(cs.charAt(1)) &&
- Character.isDigit(cs.charAt(2))) {
- int nextChar = 3;
- try {
- String uu = cs.subSequence(1, 3).toString();
- jvm_update_version = Integer.valueOf(uu).intValue();
- if (cs.length() >= 4) {
- char c = cs.charAt(3);
- if (c >= 'a' && c <= 'z') {
- jvm_special_version = Character.toString(c);
- nextChar++;
- }
- }
- } catch (NumberFormatException e) {
- // not conforming to the naming convention
- return;
- }
- cs = cs.subSequence(nextChar, cs.length());
- }
- if (cs.charAt(0) == '-') {
- // skip the first character
- // valid format: <identifier>-bxx or bxx
- // non-product VM will have -debug|-release appended
- cs = cs.subSequence(1, cs.length());
- String[] res = cs.toString().split("-");
- for (String s : res) {
- if (s.charAt(0) == 'b' && s.length() == 3 &&
- Character.isDigit(s.charAt(1)) &&
- Character.isDigit(s.charAt(2))) {
- jvm_build_number =
- Integer.valueOf(s.substring(1, 3)).intValue();
- break;
- }
- }
- }
- }
+ if (!getJvmVersionInfo()) {
+ throw new InternalError("Unable to obtain JVM version info");
}
getJdkVersionInfo();
versionsInitialized = true;
@@ -327,8 +245,6 @@
// Gets the JVM version info if available and sets the jvm_*_version fields
// and its capabilities.
- //
- // Return false if not available which implies an old VM (Tiger or before).
private static native boolean getJvmVersionInfo();
private static native void getJdkVersionInfo();
}
--- a/jdk/src/java.base/share/native/include/jvm.h Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/native/include/jvm.h Mon Jun 29 11:28:02 2015 -0700
@@ -49,7 +49,7 @@
* These functions allow the verifier and format checker to be written
* in a VM-independent way.
*
- * Third, this file contains various I/O and nerwork operations needed
+ * Third, this file contains various I/O and network operations needed
* by the standard Java I/O and network APIs.
*/
@@ -1127,11 +1127,9 @@
* ==========================================================================
*/
typedef struct {
- /* Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx */
- unsigned int jvm_version; /* Consists of major, minor, micro (n.n.n) */
- /* and build number (xx) */
- unsigned int update_version : 8; /* Update release version (uu) */
- unsigned int special_update_version : 8; /* Special update release version (c)*/
+ unsigned int jvm_version; /* Encoded $VNUM as specified by JEP-223 */
+ unsigned int patch_version : 8; /* JEP-223 patch version */
+ unsigned int reserved3 : 8;
unsigned int reserved1 : 16;
unsigned int reserved2;
@@ -1150,22 +1148,16 @@
#define JVM_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
#define JVM_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
-#define JVM_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
-
-/* Build number is available only for RE builds.
- * It will be zero for internal builds.
- */
+#define JVM_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
#define JVM_VERSION_BUILD(version) ((version & 0x000000FF))
JNIEXPORT void JNICALL
JVM_GetVersionInfo(JNIEnv* env, jvm_version_info* info, size_t info_size);
typedef struct {
- // Naming convention of RE build version string: n.n.n[_uu[c]][-<identifier>]-bxx
- unsigned int jdk_version; /* Consists of major, minor, micro (n.n.n) */
- /* and build number (xx) */
- unsigned int update_version : 8; /* Update release version (uu) */
- unsigned int special_update_version : 8; /* Special update release version (c)*/
+ unsigned int jdk_version; /* Encoded $VNUM as specified by JEP-223 */
+ unsigned int patch_version : 8; /* JEP-223 patch version */
+ unsigned int reserved3 : 8;
unsigned int reserved1 : 16;
unsigned int reserved2;
@@ -1186,11 +1178,7 @@
#define JDK_VERSION_MAJOR(version) ((version & 0xFF000000) >> 24)
#define JDK_VERSION_MINOR(version) ((version & 0x00FF0000) >> 16)
-#define JDK_VERSION_MICRO(version) ((version & 0x0000FF00) >> 8)
-
-/* Build number is available only for RE build (i.e. JDK_BUILD_NUMBER is set to bNN)
- * It will be zero for internal builds.
- */
+#define JDK_VERSION_SECURITY(version) ((version & 0x0000FF00) >> 8)
#define JDK_VERSION_BUILD(version) ((version & 0x000000FF))
/*
--- a/jdk/src/java.base/share/native/launcher/defines.h Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/native/launcher/defines.h Mon Jun 29 11:28:02 2015 -0700
@@ -28,22 +28,20 @@
#include "java.h"
+#define STR_HELPER(x) #x
+#define STR(x) STR_HELPER(x)
+
/*
* This file contains commonly defined constants used only by main.c
* and should not be included by another file.
*/
-#ifndef FULL_VERSION
+#ifndef VERSION_STRING
/* make sure the compilation fails */
-#error "FULL_VERSION must be defined"
+#error "VERSION_STRING must be defined"
#endif
-#if defined(JDK_MAJOR_VERSION) && defined(JDK_MINOR_VERSION)
-#define DOT_VERSION JDK_MAJOR_VERSION "." JDK_MINOR_VERSION
-#else
-/* make sure the compilation fails */
-#error "JDK_MAJOR_VERSION and JDK_MINOR_VERSION must be defined"
-#endif
-
+/* Unused, but retained for JLI_Launch compatibility*/
+#define DOT_VERSION "0.0"
#ifdef JAVA_ARGS
#define HAS_JAVA_ARGS JNI_TRUE
--- a/jdk/src/java.base/share/native/launcher/main.c Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/native/launcher/main.c Mon Jun 29 11:28:02 2015 -0700
@@ -125,7 +125,7 @@
return JLI_Launch(margc, margv,
sizeof(const_jargs) / sizeof(char *), const_jargs,
sizeof(const_appclasspath) / sizeof(char *), const_appclasspath,
- FULL_VERSION,
+ VERSION_STRING,
DOT_VERSION,
(const_progname != NULL) ? const_progname : *margv,
(const_launcher != NULL) ? const_launcher : *margv,
--- a/jdk/src/java.base/share/native/libjava/System.c Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/native/libjava/System.c Mon Jun 29 11:28:02 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2015, 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
@@ -208,13 +208,13 @@
CHECK_NULL_RETURN(getPropID, NULL);
PUTPROP(props, "java.specification.version",
- JDK_MAJOR_VERSION "." JDK_MINOR_VERSION);
+ VERSION_SPECIFICATION);
PUTPROP(props, "java.specification.name",
"Java Platform API Specification");
PUTPROP(props, "java.specification.vendor",
JAVA_SPECIFICATION_VENDOR);
- PUTPROP(props, "java.version", RELEASE);
+ PUTPROP(props, "java.version", VERSION_SHORT);
PUTPROP(props, "java.vendor", VENDOR);
PUTPROP(props, "java.vendor.url", VENDOR_URL);
PUTPROP(props, "java.vendor.url.bug", VENDOR_URL_BUG);
--- a/jdk/src/java.base/share/native/libjava/Version.c Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/native/libjava/Version.c Mon Jun 29 11:28:02 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, 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
@@ -30,8 +30,6 @@
#include "sun_misc_Version.h"
-char jvm_special_version = '\0';
-char jdk_special_version = '\0';
static void setStaticIntField(JNIEnv* env, jclass cls, const char* name, jint value)
{
jfieldID fid;
@@ -63,27 +61,16 @@
JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
setStaticIntField(env, cls, "jvm_minor_version", JVM_VERSION_MINOR(info.jvm_version));
JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
- setStaticIntField(env, cls, "jvm_micro_version", JVM_VERSION_MICRO(info.jvm_version));
+ setStaticIntField(env, cls, "jvm_security_version", JVM_VERSION_SECURITY(info.jvm_version));
JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
setStaticIntField(env, cls, "jvm_build_number", JVM_VERSION_BUILD(info.jvm_version));
JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
- setStaticIntField(env, cls, "jvm_update_version", info.update_version);
+ setStaticIntField(env, cls, "jvm_patch_version", info.patch_version);
JNU_CHECK_EXCEPTION_RETURN(env, JNI_FALSE);
- jvm_special_version = info.special_update_version;
return JNI_TRUE;
}
-JNIEXPORT jstring JNICALL
-Java_sun_misc_Version_getJvmSpecialVersion(JNIEnv *env, jclass cls) {
- char s[2];
- jstring special;
- s[0] = jvm_special_version;
- s[1] = '\0';
- special = (*env)->NewStringUTF(env, s);
- return special;
-}
-
JNIEXPORT void JNICALL
Java_sun_misc_Version_getJdkVersionInfo(JNIEnv *env, jclass cls)
{
@@ -94,21 +81,10 @@
JNU_CHECK_EXCEPTION(env);
setStaticIntField(env, cls, "jdk_minor_version", JDK_VERSION_MINOR(info.jdk_version));
JNU_CHECK_EXCEPTION(env);
- setStaticIntField(env, cls, "jdk_micro_version", JDK_VERSION_MICRO(info.jdk_version));
+ setStaticIntField(env, cls, "jdk_security_version", JDK_VERSION_SECURITY(info.jdk_version));
JNU_CHECK_EXCEPTION(env);
setStaticIntField(env, cls, "jdk_build_number", JDK_VERSION_BUILD(info.jdk_version));
JNU_CHECK_EXCEPTION(env);
- setStaticIntField(env, cls, "jdk_update_version", info.update_version);
+ setStaticIntField(env, cls, "jdk_patch_version", info.patch_version);
JNU_CHECK_EXCEPTION(env);
- jdk_special_version = info.special_update_version;
}
-
-JNIEXPORT jstring JNICALL
-Java_sun_misc_Version_getJdkSpecialVersion(JNIEnv *env, jclass cls) {
- char s[2];
- jstring special;
- s[0] = jdk_special_version;
- s[1] = '\0';
- special = (*env)->NewStringUTF(env, s);
- return special;
-}
--- a/jdk/src/java.base/share/native/libjava/jdk_util.c Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/native/libjava/jdk_util.c Mon Jun 29 11:28:02 2015 -0700
@@ -31,72 +31,21 @@
#include "jvm.h"
#include "jdk_util.h"
-#ifndef JDK_UPDATE_VERSION
- /* if not defined set to 00 */
- #define JDK_UPDATE_VERSION "00"
-#endif
-
JNIEXPORT void
JDK_GetVersionInfo0(jdk_version_info* info, size_t info_size) {
- /* These JDK_* macros are set at Makefile or the command line */
- const unsigned int jdk_major_version =
- (unsigned int) atoi(JDK_MAJOR_VERSION);
- const unsigned int jdk_minor_version =
- (unsigned int) atoi(JDK_MINOR_VERSION);
- const unsigned int jdk_micro_version =
- (unsigned int) atoi(JDK_MICRO_VERSION);
-
- const char* jdk_build_string = JDK_BUILD_NUMBER;
- char build_number[4];
- unsigned int jdk_build_number = 0;
-
- const char* jdk_update_string = JDK_UPDATE_VERSION;
- unsigned int jdk_update_version = 0;
- char update_ver[3];
- char jdk_special_version = '\0';
-
- /* If the JDK_BUILD_NUMBER is of format bXX and XX is an integer
- * XX is the jdk_build_number.
- */
- size_t len = strlen(jdk_build_string);
- if (jdk_build_string[0] == 'b' && len >= 2) {
- size_t i = 0;
- for (i = 1; i < len; i++) {
- if (isdigit(jdk_build_string[i])) {
- build_number[i-1] = jdk_build_string[i];
- } else {
- // invalid build number
- i = -1;
- break;
- }
- }
- if (i == len) {
- build_number[len-1] = '\0';
- jdk_build_number = (unsigned int) atoi(build_number) ;
- }
- }
-
- assert(jdk_build_number <= 255);
-
- if (strlen(jdk_update_string) == 2 || strlen(jdk_update_string) == 3) {
- if (isdigit(jdk_update_string[0]) && isdigit(jdk_update_string[1])) {
- update_ver[0] = jdk_update_string[0];
- update_ver[1] = jdk_update_string[1];
- update_ver[2] = '\0';
- jdk_update_version = (unsigned int) atoi(update_ver);
- if (strlen(jdk_update_string) == 3) {
- jdk_special_version = jdk_update_string[2];
- }
- }
- }
+ /* 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_patch = VERSION_PATCH;
+ const unsigned int version_build = VERSION_BUILD;
memset(info, 0, info_size);
- info->jdk_version = ((jdk_major_version & 0xFF) << 24) |
- ((jdk_minor_version & 0xFF) << 16) |
- ((jdk_micro_version & 0xFF) << 8) |
- (jdk_build_number & 0xFF);
- info->update_version = jdk_update_version;
- info->special_update_version = (unsigned int) jdk_special_version;
+ info->jdk_version = ((version_major & 0xFF) << 24) |
+ ((version_minor & 0xFF) << 16) |
+ ((version_security & 0xFF) << 8) |
+ (version_build & 0xFF);
+ info->patch_version = version_patch;
info->thread_park_blocker = 1;
// Advertise presence of sun.misc.PostVMInitHook:
// future optimization: detect if this is enabled.
--- a/jdk/src/java.base/share/native/libjli/java.c Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/java.c Mon Jun 29 11:28:02 2015 -0700
@@ -74,7 +74,6 @@
static const char *_launcher_name;
static jboolean _is_java_args = JNI_FALSE;
static const char *_fVersion;
-static const char *_dVersion;
static jboolean _wc_enabled = JNI_FALSE;
static jint _ergo_policy = DEFAULT_POLICY;
@@ -183,7 +182,7 @@
int jargc, const char** jargv, /* java args */
int appclassc, const char** appclassv, /* app classpath */
const char* fullversion, /* full version defined */
- const char* dotversion, /* dot version defined */
+ const char* dotversion, /* UNUSED dot version defined */
const char* pname, /* program name */
const char* lname, /* launcher name */
jboolean javaargs, /* JAVA_ARGS */
@@ -204,7 +203,6 @@
char jvmcfg[MAXPATHLEN];
_fVersion = fullversion;
- _dVersion = dotversion;
_launcher_name = lname;
_program_name = pname;
_is_java_args = javaargs;
@@ -1886,12 +1884,6 @@
}
const char*
-GetDotVersion()
-{
- return _dVersion;
-}
-
-const char*
GetFullVersion()
{
return _fVersion;
@@ -1978,7 +1970,6 @@
printf("\tlauncher name:%s\n", GetLauncherName());
printf("\tjavaw:%s\n", (IsJavaw() == JNI_TRUE) ? "on" : "off");
printf("\tfullversion:%s\n", GetFullVersion());
- printf("\tdotversion:%s\n", GetDotVersion());
printf("\tergo_policy:");
switch(GetErgoPolicy()) {
case NEVER_SERVER_CLASS:
--- a/jdk/src/java.base/share/native/libjli/java.h Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/share/native/libjli/java.h Mon Jun 29 11:28:02 2015 -0700
@@ -169,7 +169,6 @@
};
const char* GetProgramName();
-const char* GetDotVersion();
const char* GetFullVersion();
jboolean IsJavaArgs();
jboolean IsJavaw();
--- a/jdk/src/java.base/windows/native/common/version.rc Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.base/windows/native/common/version.rc Mon Jun 29 11:28:02 2015 -0700
@@ -1,5 +1,5 @@
//
-// Copyright (c) 2004, Oracle and/or its affiliates. All rights reserved.
+// Copyright (c) 2004, 2015, 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
@@ -58,7 +58,7 @@
VALUE "CompanyName", XSTR(JDK_COMPANY) "\0"
VALUE "FileDescription", XSTR(JDK_COMPONENT) "\0"
VALUE "FileVersion", XSTR(JDK_VER) "\0"
- VALUE "Full Version", XSTR(JDK_BUILD_ID) "\0"
+ VALUE "Full Version", XSTR(JDK_VERSION_STRING) "\0"
VALUE "InternalName", XSTR(JDK_INTERNAL_NAME) "\0"
VALUE "LegalCopyright", XSTR(JDK_COPYRIGHT) "\0"
VALUE "OriginalFilename", XSTR(JDK_FNAME) "\0"
--- a/jdk/src/java.desktop/windows/native/libawt/windows/awt.rc Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/java.desktop/windows/native/libawt/windows/awt.rc Mon Jun 29 11:28:02 2015 -0700
@@ -1,5 +1,5 @@
-//
-// Copyright (c) 1997, 2004, Oracle and/or its affiliates. All rights reserved.
+//
+// Copyright (c) 1997, 2015, 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
@@ -69,7 +69,7 @@
VALUE "CompanyName", XSTR(JDK_COMPANY) "\0"
VALUE "FileDescription", XSTR(JDK_COMPONENT) "\0"
VALUE "FileVersion", XSTR(JDK_VER) "\0"
- VALUE "Full Version", XSTR(JDK_BUILD_ID) "\0"
+ VALUE "Full Version", XSTR(JDK_VERSION_STRING) "\0"
VALUE "InternalName", XSTR(JDK_INTERNAL_NAME) "\0"
VALUE "LegalCopyright", XSTR(JDK_COPYRIGHT) "\0"
VALUE "OriginalFilename", XSTR(JDK_FNAME) "\0"
--- a/jdk/src/jdk.accessibility/windows/native/common/AccessBridgeStatusWindow.RC Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/src/jdk.accessibility/windows/native/common/AccessBridgeStatusWindow.RC Mon Jun 29 11:28:02 2015 -0700
@@ -44,7 +44,7 @@
LTEXT "Status:",IDC_STATIC,11,149,23,8
EDITTEXT cWindowsID,67,39,121,13,ES_READONLY
LTEXT "Windows ID:",IDC_STATIC,21,41,42,8
- EDITTEXT cCallInfo,12,65,184,75,ES_MULTILINE | ES_AUTOVSCROLL |
+ EDITTEXT cCallInfo,12,65,184,75,ES_MULTILINE | ES_AUTOVSCROLL |
ES_AUTOHSCROLL | ES_READONLY | WS_VSCROLL
GROUPBOX "Call info",IDC_STATIC,4,55,197,90
EDITTEXT cInvokedByText,67,1,121,13,ES_READONLY
@@ -67,12 +67,12 @@
// TEXTINCLUDE
//
-1 TEXTINCLUDE DISCARDABLE
+1 TEXTINCLUDE DISCARDABLE
BEGIN
"resource.h\0"
END
-2 TEXTINCLUDE DISCARDABLE
+2 TEXTINCLUDE DISCARDABLE
BEGIN
"#define APSTUDIO_HIDDEN_SYMBOLS\r\n"
"#include ""windows.h""\r\n"
@@ -80,7 +80,7 @@
"\0"
END
-3 TEXTINCLUDE DISCARDABLE
+3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
@@ -95,7 +95,7 @@
//
#ifdef APSTUDIO_INVOKED
-GUIDELINES DESIGNINFO DISCARDABLE
+GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"ACCESSBRIDGESTATUSWINDOW", DIALOG
BEGIN
@@ -142,7 +142,7 @@
VALUE "CompanyName", XSTR(JDK_COMPANY) "\0"
VALUE "FileDescription", XSTR(JDK_COMPONENT) "\0"
VALUE "FileVersion", XSTR(JDK_VER) "\0"
- VALUE "Full Version", XSTR(JDK_BUILD_ID) "\0"
+ VALUE "Full Version", XSTR(JDK_VERSION_STRING) "\0"
VALUE "InternalName", XSTR(JDK_INTERNAL_NAME) "\0"
VALUE "LegalCopyright", XSTR(JDK_COPYRIGHT) "\0"
VALUE "OriginalFilename", XSTR(JDK_FNAME) "\0"
@@ -172,4 +172,3 @@
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED
-
--- a/jdk/test/sun/misc/Version/Version.java Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/test/sun/misc/Version/Version.java Mon Jun 29 11:28:02 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2015, 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
@@ -31,15 +31,17 @@
*/
import static sun.misc.Version.*;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
+
public class Version {
public static void main(String[] args) throws Exception {
VersionInfo jdk = newVersionInfo(System.getProperty("java.runtime.version"));
VersionInfo v1 = new VersionInfo(jdkMajorVersion(),
jdkMinorVersion(),
- jdkMicroVersion(),
- jdkUpdateVersion(),
- jdkSpecialVersion(),
+ jdkSecurityVersion(),
+ jdkPatchVersion(),
jdkBuildNumber());
System.out.println("JDK version = " + jdk + " " + v1);
if (!jdk.equals(v1)) {
@@ -48,9 +50,8 @@
VersionInfo jvm = newVersionInfo(System.getProperty("java.vm.version"));
VersionInfo v2 = new VersionInfo(jvmMajorVersion(),
jvmMinorVersion(),
- jvmMicroVersion(),
- jvmUpdateVersion(),
- jvmSpecialVersion(),
+ jvmSecurityVersion(),
+ jvmPatchVersion(),
jvmBuildNumber());
System.out.println("JVM version = " + jvm + " " + v2);
if (!jvm.equals(v2)) {
@@ -61,108 +62,67 @@
static class VersionInfo {
final int major;
final int minor;
- final int micro;
- final int update;
- final String special;
+ final int security;
+ final int patch;
final int build;
- VersionInfo(int major, int minor, int micro,
- int update, String special, int build) {
+ VersionInfo(int major, int minor, int security,
+ int patch, int build) {
this.major = major;
this.minor = minor;
- this.micro = micro;
- this.update = update;
- this.special = special;
+ this.security = security;
+ this.patch = patch;
this.build = build;
}
+ VersionInfo(int[] fields) {
+ this.major = fields[0];
+ this.minor = fields[1];
+ this.security = fields[2];
+ this.patch = fields[3];
+ this.build = fields[4];
+ }
+
public boolean equals(VersionInfo v) {
return (this.major == v.major && this.minor == v.minor &&
- this.micro == v.micro && this.update == v.update &&
- this.special.equals(v.special) && this.build == v.build);
+ this.security == v.security && this.patch == v.patch &&
+ this.build == v.build);
}
public String toString() {
StringBuilder sb = new StringBuilder();
- sb.append(major + "." + minor + "." + micro);
- if (update > 0) {
- sb.append("_" + update);
+ sb.append(major + "." + minor + "." + security);
+ if (patch > 0) {
+ sb.append("." + patch);
}
- if (!special.isEmpty()) {
- sb.append(special);
- }
- sb.append("-b" + build);
+ sb.append("+" + build);
return sb.toString();
}
}
private static VersionInfo newVersionInfo(String version) throws Exception {
- // valid format of the version string is:
- // n.n.n[_uu[c]][-<identifer>]-bxx
- int major = 0;
- int minor = 0;
- int micro = 0;
- int update = 0;
- String special = "";
- int build = 0;
- CharSequence cs = version;
- if (cs.length() >= 5) {
- if (Character.isDigit(cs.charAt(0)) && cs.charAt(1) == '.' &&
- Character.isDigit(cs.charAt(2)) && cs.charAt(3) == '.' &&
- Character.isDigit(cs.charAt(4))) {
- major = Character.digit(cs.charAt(0), 10);
- minor = Character.digit(cs.charAt(2), 10);
- micro = Character.digit(cs.charAt(4), 10);
- cs = cs.subSequence(5, cs.length());
- } else if (Character.isDigit(cs.charAt(0)) &&
- Character.isDigit(cs.charAt(1)) && cs.charAt(2) == '.' &&
- Character.isDigit(cs.charAt(3))) {
- // HSX has nn.n[n] (major.minor) version
- major = Integer.valueOf(version.substring(0, 2)).intValue();
- if (Character.isDigit(cs.charAt(4))) {
- minor = Integer.valueOf(version.substring(3, 5)).intValue();
- cs = cs.subSequence(5, cs.length());
- }
- else {
- minor = Character.digit(cs.charAt(3), 10);
- cs = cs.subSequence(4, cs.length());
- }
- }
- if (cs.charAt(0) == '_' && cs.length() >= 3 &&
- Character.isDigit(cs.charAt(1)) &&
- Character.isDigit(cs.charAt(2))) {
- int nextChar = 3;
- String uu = cs.subSequence(1, 3).toString();
- update = Integer.valueOf(uu).intValue();
- if (cs.length() >= 4) {
- char c = cs.charAt(3);
- if (c >= 'a' && c <= 'z') {
- special = Character.toString(c);
- nextChar++;
- }
- }
- cs = cs.subSequence(nextChar, cs.length());
- }
- if (cs.charAt(0) == '-') {
- // skip the first character
- // valid format: <identifier>-bxx or bxx
- // non-product VM will have -debug|-release appended
- cs = cs.subSequence(1, cs.length());
- String[] res = cs.toString().split("-");
- for (int i = res.length - 1; i >= 0; i--) {
- String s = res[i];
- if (s.charAt(0) == 'b') {
- try {
- build = Integer.parseInt(s.substring(1, s.length()));
- break;
- } catch (NumberFormatException nfe) {
- // ignore
- }
- }
- }
+ // Version string fromat as defined by JEP-223
+ String jep223Pattern =
+ "^([0-9]+)(\\.([0-9]+))?(\\.([0-9]+))?(\\.([0-9]+))?" + // $VNUM
+ "(-([a-zA-Z]+))?(\\.([a-zA-Z]+))?" + // $PRE
+ "(\\+([0-9]+))?" + // Build Number
+ "(([-a-zA-Z0-9.]+))?$"; // $OPT
+
+ // Pattern group index for: Major, Minor, Security, Patch, Build
+ int[] groups = {1, 3, 5, 7, 13};
+ // Default values for Major, Minor, Security, Patch, Build
+ int[] versionFields = {0, 0, 0, 0, 0};
+
+ Pattern pattern = Pattern.compile(jep223Pattern);
+ Matcher matcher = pattern.matcher(version);
+ if (matcher.matches()) {
+ for (int i = 0; i < versionFields.length; i++) {
+ String field = matcher.group(groups[i]);
+ versionFields[i] = (field != null) ? Integer.parseInt(field) : 0;
}
}
- VersionInfo vi = new VersionInfo(major, minor, micro, update, special, build);
+
+ VersionInfo vi = new VersionInfo(versionFields);
System.out.printf("newVersionInfo: input=%s output=%s\n", version, vi);
return vi;
}
--- a/jdk/test/tools/launcher/VersionCheck.java Thu Jun 25 10:21:38 2015 -0700
+++ b/jdk/test/tools/launcher/VersionCheck.java Mon Jun 29 11:28:02 2015 -0700
@@ -183,13 +183,6 @@
"build".length() + 1,
refVersion.lastIndexOf(")"));
- String[] vStr = bStr.split("\\.|-|_");
- String jdkMajor = vStr[0];
- String jdkMinor = vStr[1];
- String jdkMicro = vStr[2];
- String jdkBuild = vStr[vStr.length - 1];
-
- String expectedDotVersion = "dotversion:" + jdkMajor + "." + jdkMinor;
String expectedFullVersion = "fullversion:" + bStr;
Map<String, String> envMap = new HashMap<>();
@@ -200,10 +193,6 @@
for (String x : tr.testOutput) {
alist.add(x.trim());
}
- if (!alist.contains(expectedDotVersion)) {
- System.out.println("Error: could not find " + expectedDotVersion);
- failcount++;
- }
if (!alist.contains(expectedFullVersion)) {
System.out.println("Error: could not find " + expectedFullVersion);