This commit is contained in:
Iris Clark 2015-11-09 10:57:01 -08:00
commit 2f8616e7b4
45 changed files with 258 additions and 467 deletions

View File

@ -55,7 +55,8 @@ $(eval $(call SetupTextFileProcessing, BUILD_JAVA_MANIFEST, \
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) , \
))

View File

@ -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@@

View File

@ -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)
$(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), \
))
$(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 $@
GENSRC_JAVA_BASE += $(SUPPORT_OUTPUTDIR)/gensrc/java.base/sun/misc/Version.java
GENSRC_JAVA_BASE += $(BUILD_VERSION_JAVA)
##########################################################################################

View File

@ -52,7 +52,7 @@ ifeq ($(OPENJDK_TARGET_OS), windows)
-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)

View File

@ -102,7 +102,7 @@ $(eval $(call SetupNativeCompilation,BUILD_UNPACKEXE, \
-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)

View File

@ -162,9 +162,7 @@ define SetupLauncher
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 @@ define SetupLauncher
-D "JDK_FTYPE=0x1L" \
$7, \
MANIFEST := $(JAVA_MANIFEST), \
MANIFEST_VERSION := $(JDK_VERSION_FOR_MANIFEST), \
MANIFEST_VERSION := $(VERSION_NUMBER_FOUR_POSITIONS), \
CODESIGN := $$($1_CODESIGN), \
)

View File

@ -119,15 +119,6 @@ LIBJAVA_CFLAGS := $(addprefix -I, $(LIBJAVA_SRC_DIRS)) \
-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 @@ $(eval $(call SetupNativeCompilation,BUILD_LIBJAVA, \
OPTIMIZATION := HIGH, \
CFLAGS := $(CFLAGS_JDKLIB) \
$(LIBJAVA_CFLAGS), \
System.c_CFLAGS := $(VERSION_CFLAGS), \
jdk_util.c_CFLAGS := $(VERSION_CFLAGS), \
DISABLED_WARNINGS_solstudio := E_STATEMENT_NOT_REACHED, \
MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjava/mapfile-vers, \
LDFLAGS := $(LDFLAGS_JDKLIB) \

View File

@ -267,9 +267,7 @@ SUNWprivate_1.1 {
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;

View File

@ -74,7 +74,7 @@ public final class AppleProvider extends Provider {
public AppleProvider() {
/* We are the Apple provider */
super("Apple", 1.9d, info);
super("Apple", 9.0d, info);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2014, 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
@ -104,7 +104,7 @@ public final class SunJCE extends Provider {
public SunJCE() {
/* We are the "SunJCE" provider */
super("SunJCE", 1.9d, info);
super("SunJCE", 9.0d, info);
final String BLOCK_MODES = "ECB|CBC|PCBC|CTR|CTS|CFB|OFB" +
"|CFB8|CFB16|CFB24|CFB32|CFB40|CFB48|CFB56|CFB64" +

View File

@ -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 @@ public class Version {
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 @@ public class Version {
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.
@ -100,7 +98,15 @@ public class Version {
/* Second line: runtime version (ie, libraries). */
ps.print(java_runtime_name + " (build " + java_runtime_version);
String jdk_debug_level = System.getProperty("jdk.debug", "release");
/* Debug level is not printed for "release" builds */
if ("release".equals(jdk_debug_level)) {
jdk_debug_level = "";
} else {
jdk_debug_level = jdk_debug_level + " ";
}
ps.print(java_runtime_name + " (" + jdk_debug_level + "build " + java_runtime_version);
if (java_runtime_name.indexOf("Embedded") != -1 && isHeadless) {
// embedded builds report headless state
@ -112,16 +118,14 @@ public class Version {
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 + " (build " + java_vm_version + ", " +
ps.println(java_vm_name + " (" + jdk_debug_level + "build " + java_vm_version + ", " +
java_vm_info + ")");
}
/**
* Returns the major 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 major version of the running JVM.
* @return the major version of the running JVM
* @since 1.6
*/
public static synchronized int jvmMajorVersion() {
@ -132,9 +136,8 @@ public class Version {
}
/**
* Returns the minor 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 minor version of the running JVM.
* @return the minor version of the running JVM
* @since 1.6
*/
public static synchronized int jvmMinorVersion() {
@ -146,44 +149,32 @@ public class Version {
/**
* 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.
* @since 1.6
* Returns the security version of the running JVM.
* @return the security version of the running JVM
* @since 9
*/
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.
* @return the patch release version of the running JVM
* @since 9
*/
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.
* @return the build number of the running JVM
* @since 1.6
*/
public static synchronized int jvmBuildNumber() {
@ -195,7 +186,7 @@ public class Version {
/**
* Returns the major version of the running JDK.
*
* @return the major version of the running JDK
* @since 1.6
*/
public static synchronized int jdkMajorVersion() {
@ -207,6 +198,7 @@ public class Version {
/**
* Returns the minor version of the running JDK.
* @return the minor version of the running JDK
* @since 1.6
*/
public static synchronized int jdkMinorVersion() {
@ -217,42 +209,32 @@ public class Version {
}
/**
* Returns the micro version of the running JDK.
* @since 1.6
* Returns the security version of the running JDK.
* @return the security version of the running JDK
* @since 9
*/
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.
* @return 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.
* @return the build number of the running JDK
* @since 1.6
*/
public static synchronized int jdkBuildNumber() {
@ -262,64 +244,12 @@ public class Version {
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 +257,6 @@ public class Version {
// 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();
}

View File

@ -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
@ -65,7 +65,7 @@ public final class MD4 extends DigestBase {
private static final Provider md4Provider;
static {
md4Provider = new Provider("MD4Provider", 1.9d, "MD4 MessageDigest") {
md4Provider = new Provider("MD4Provider", 9.0d, "MD4 MessageDigest") {
private static final long serialVersionUID = -8850464997518327965L;
};
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -47,7 +47,7 @@ public final class Sun extends Provider {
public Sun() {
/* We are the SUN provider */
super("SUN", 1.9d, INFO);
super("SUN", 9.0d, INFO);
// if there is no security manager installed, put directly into
// the provider. Otherwise, create a temporary map and use a

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1996, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1996, 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
@ -61,7 +61,7 @@ public final class VerificationProvider extends Provider {
}
public VerificationProvider() {
super("SunJarVerification", 1.9d, "Jar Verification Provider");
super("SunJarVerification", 9.0d, "Jar Verification Provider");
// register all algorithms normally registered by the Sun and SunRsaSign
// providers, but only if they are missing
if (ACTIVE == false) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 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
@ -43,7 +43,7 @@ public final class SunRsaSign extends Provider {
private static final long serialVersionUID = 866040293550393045L;
public SunRsaSign() {
super("SunRsaSign", 1.9d, "Sun RSA signature provider");
super("SunRsaSign", 9.0d, "Sun RSA signature provider");
// if there is no security manager installed, put directly into
// the provider. Otherwise, create a temporary map and use a

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2001, 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
@ -95,7 +95,7 @@ final class JsseJce {
private static final long serialVersionUID = -3284138292032213752L;
SunCertificates(final Provider p) {
super("SunCertificates", 1.9d, "SunJSSE internal");
super("SunCertificates", 9.0d, "SunJSSE internal");
AccessController.doPrivileged(new PrivilegedAction<Object>() {
@Override
public Object run() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2014, 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
@ -104,7 +104,7 @@ public abstract class SunJSSE extends java.security.Provider {
// standard constructor
protected SunJSSE() {
super("SunJSSE", 1.9d, info);
super("SunJSSE", 9.0d, info);
subclassCheck();
if (Boolean.TRUE.equals(fips)) {
throw new ProviderException
@ -132,7 +132,7 @@ public abstract class SunJSSE extends java.security.Provider {
private SunJSSE(java.security.Provider cryptoProvider,
String providerName) {
super("SunJSSE", 1.9d, fipsInfo + providerName + ")");
super("SunJSSE", 9.0d, fipsInfo + providerName + ")");
subclassCheck();
if (cryptoProvider == null) {
// Calling Security.getProvider() will cause other providers to be

View File

@ -49,7 +49,7 @@ extern "C" {
* 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 @@ JVM_GetEnclosingMethodInfo(JNIEnv* env, jclass ofClass);
* ==========================================================================
*/
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 @@ typedef struct {
#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 @@ typedef struct {
#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))
/*

View File

@ -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"
#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"
#error "VERSION_STRING 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

View File

@ -151,7 +151,7 @@ main(int argc, char **argv)
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,

View File

@ -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 @@ Java_java_lang_System_initProperties(JNIEnv *env, jclass cla, jobject props)
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);

View File

@ -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 @@ Java_sun_misc_Version_getJvmVersionInfo(JNIEnv *env, jclass cls)
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 @@ Java_sun_misc_Version_getJdkVersionInfo(JNIEnv *env, jclass cls)
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;
}

View File

@ -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.

View File

@ -74,7 +74,6 @@ static const char *_program_name;
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 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
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 @@ JLI_Launch(int argc, char ** argv, /* main argc, argc */
char jvmcfg[MAXPATHLEN];
_fVersion = fullversion;
_dVersion = dotversion;
_launcher_name = lname;
_program_name = pname;
_is_java_args = javaargs;
@ -1876,12 +1874,6 @@ ShowSplashScreen()
}
const char*
GetDotVersion()
{
return _dVersion;
}
const char*
GetFullVersion()
{
@ -1970,7 +1962,6 @@ DumpState()
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:

View File

@ -169,7 +169,6 @@ enum ergo_policy {
};
const char* GetProgramName();
const char* GetDotVersion();
const char* GetFullVersion();
jboolean IsJavaArgs();
jboolean IsJavaw();

View File

@ -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 @@ BEGIN
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"

View File

@ -68,7 +68,7 @@ BEGIN
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"

View File

@ -69,7 +69,7 @@ public final class JdkLDAP extends Provider {
}
public JdkLDAP() {
super("JdkLDAP", 1.9d, "JdkLDAP Provider (implements LDAP CertStore)");
super("JdkLDAP", 9.0d, "JdkLDAP Provider (implements LDAP CertStore)");
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -101,7 +101,7 @@ public final class SunProvider extends Provider {
public SunProvider() {
/* We are the Sun JGSS provider */
super("SunJGSS", 1.9d, INFO);
super("SunJGSS", 9.0d, INFO);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -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
@ -120,7 +120,7 @@ public final class SunNativeProvider extends Provider {
public SunNativeProvider() {
/* We are the Sun NativeGSS provider */
super(NAME, 1.9d, INFO);
super(NAME, 9.0d, INFO);
if (MECH_MAP != null) {
AccessController.doPrivileged(new PutAllAction(this, MECH_MAP));

View File

@ -98,7 +98,7 @@ public final class Provider extends java.security.Provider {
}
public Provider() {
super("SunSASL", 1.9d, info);
super("SunSASL", 9.0d, info);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -65,7 +65,7 @@ public final class SunPCSC extends Provider {
}
public SunPCSC() {
super("SunPCSC", 1.9d, "Sun PC/SC provider");
super("SunPCSC", 9.0d, "Sun PC/SC provider");
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -28,7 +28,7 @@
* ===========================================================================
*/
/*
* Copyright (c) 2005, 2015 Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
*/
/*
* $Id: XMLDSigRI.java 1400021 2012-10-19 10:16:04Z coheigea $
@ -129,7 +129,7 @@ public final class XMLDSigRI extends Provider {
public XMLDSigRI() {
/* We are the XMLDSig provider */
super("XMLDSig", 1.9d, INFO);
super("XMLDSig", 9.0d, INFO);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -44,7 +44,7 @@ BEGIN
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 @@ END
// 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 @@ BEGIN
"\0"
END
3 TEXTINCLUDE DISCARDABLE
3 TEXTINCLUDE DISCARDABLE
BEGIN
"\r\n"
"\0"
@ -95,7 +95,7 @@ END
//
#ifdef APSTUDIO_INVOKED
GUIDELINES DESIGNINFO DISCARDABLE
GUIDELINES DESIGNINFO DISCARDABLE
BEGIN
"ACCESSBRIDGESTATUSWINDOW", DIALOG
BEGIN
@ -142,7 +142,7 @@ BEGIN
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 @@ END
/////////////////////////////////////////////////////////////////////////////
#endif // not APSTUDIO_INVOKED

View File

@ -142,7 +142,7 @@ public final class SunEC extends Provider {
}
public SunEC() {
super("SunEC", 1.9d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)");
super("SunEC", 9.0d, "Sun Elliptic Curve provider (EC, ECDSA, ECDH)");
AccessController.doPrivileged(new PrivilegedAction<Void>() {
public Void run() {
putEntries(useFullImplementation);

View File

@ -124,7 +124,7 @@ public final class SunMSCAPI extends Provider {
}
public SunMSCAPI() {
super("SunMSCAPI", 1.9d, INFO);
super("SunMSCAPI", 9.0d, INFO);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -90,7 +90,7 @@ public final class SunPKCS11 extends AuthProvider {
}
public SunPKCS11() {
super("SunPKCS11", 1.9d, "Unconfigured and unusable PKCS11 provider");
super("SunPKCS11", 9.0d, "Unconfigured and unusable PKCS11 provider");
p11 = null;
config = null;
slotID = 0;
@ -133,7 +133,7 @@ public final class SunPKCS11 extends AuthProvider {
// Used by Secmod
SunPKCS11(Config c) {
super("SunPKCS11-" + c.getName(), 1.9d, c.getDescription());
super("SunPKCS11-" + c.getName(), 9.0d, c.getDescription());
this.config = c;
if (debug != null) {

View File

@ -224,7 +224,7 @@ public final class UcryptoProvider extends Provider {
}
public UcryptoProvider() {
super("OracleUcrypto", 1.9d, "Provider using Oracle Ucrypto API");
super("OracleUcrypto", 9.0d, "Provider using Oracle Ucrypto API");
AccessController.doPrivileged(new PrivilegedAction<>() {
public Void run() {

View File

@ -73,7 +73,7 @@ public final class JdkSASL extends Provider {
}
public JdkSASL() {
super("JdkSASL", 1.9d, info);
super("JdkSASL", 9.0d, info);
final Provider p = this;
AccessController.doPrivileged(new PrivilegedAction<Void>() {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 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
@ -27,7 +27,7 @@ import java.lang.Exception;
/*
* @test
* @bug 8030823
* @bug 8030823 8130696
* @run main/othervm ProviderVersionCheck
* @summary Verify all providers in the default Providers list have the proper
* version for the release
@ -42,7 +42,7 @@ public class ProviderVersionCheck {
for (Provider p: Security.getProviders()) {
System.out.print(p.getName() + " ");
if (p.getVersion() != 1.9d) {
if (p.getVersion() != 9.0d) {
System.out.println("failed. " + "Version received was " +
p.getVersion());
failure = true;

View File

@ -24,7 +24,7 @@
/*
* @test
* @summary Tests to send a not serializable notification.
* @bug 5022196
* @bug 5022196 8132003
* @author Shanliang JIANG
* @modules java.management
* @run clean NotSerializableNotifTest
@ -53,22 +53,13 @@ public class NotSerializableNotifTest {
private static final MBeanServer mbeanServer = MBeanServerFactory.createMBeanServer();
private static ObjectName emitter;
private static String[] protocols;
private static String[] protocols = new String[] {"rmi", "iiop", "jmxmp"};
private static final int sentNotifs = 10;
public static void main(String[] args) throws Exception {
System.out.println(">>> Test to send a not serializable notification");
// IIOP fails on JDK1.4, see 5034318
final String v = System.getProperty("java.version");
float f = Float.parseFloat(v.substring(0, 3));
if (f<1.5) {
protocols = new String[] {"rmi", "jmxmp"};
} else {
protocols = new String[] {"rmi", "iiop", "jmxmp"};
}
emitter = new ObjectName("Default:name=NotificationEmitter");
mbeanServer.registerMBean(new NotificationEmitter(), emitter);

View File

@ -31,7 +31,7 @@ public class Platform {
private static final String osName = System.getProperty("os.name");
private static final String dataModel = System.getProperty("sun.arch.data.model");
private static final String vmVersion = System.getProperty("java.vm.version");
private static final String javaVersion = System.getProperty("java.version");
private static final String jdkDebug = System.getProperty("jdk.debug");
private static final String osArch = System.getProperty("os.arch");
private static final String vmName = System.getProperty("java.vm.name");
private static final String userName = System.getProperty("user.name");
@ -99,8 +99,7 @@ public class Platform {
}
public static boolean isDebugBuild() {
return (vmVersion.toLowerCase().contains("debug") ||
javaVersion.toLowerCase().contains("debug"));
return (jdkDebug.toLowerCase().contains("debug"));
}
public static String getVMVersion() {

View File

@ -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
@ -22,24 +22,27 @@
*/
/* @test
* @bug 6994413
* @bug 6994413 8134365
* @summary Check the JDK and JVM version returned by sun.misc.Version
* matches the versions defined in the system properties
* matches the versions defined in the system properties.
* Should use the API described in JDK-8136651 when available
* @modules java.base/sun.misc
* @compile -XDignore.symbol.file Version.java
* @run main Version
*/
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 +51,8 @@ public class Version {
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 +63,76 @@ public class Version {
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);
// Do not include trailing zeros
if (patch > 0) {
sb.insert(0, "." + patch);
}
if (security > 0 || sb.length() > 0) {
sb.insert(0, "." + security);
}
if (minor > 0 || sb.length() > 0) {
sb.insert(0, "." + minor);
}
sb.insert(0, major);
if (build >= 0)
sb.append("+" + build);
if (!special.isEmpty()) {
sb.append(special);
}
sb.append("-b" + 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;
}

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2013, 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
@ -23,7 +23,7 @@
/*
* @test
* @bug 4811968 6908628 8006564
* @bug 4811968 6908628 8006564 8130696
* @modules java.base/sun.misc
* java.base/sun.security.util
* @run main S11N check
@ -66,8 +66,11 @@ public class S11N {
public static void main(String[] args) throws Exception {
if (args[0].equals("check")) {
int version = Integer.valueOf(System.getProperty("java.version")
.split("\\.")[1]);
String jv = System.getProperty("java.version");
// java.version format: $VNUM\-$PRE
String [] va = (jv.split("-")[0]).split("\\.");
String v = (va.length == 1 || !va[0].equals("1")) ? va[0] : va[1];
int version = Integer.valueOf(v);
System.out.println("version is " + version);
if (version >= 7) {
for (String oid: SMALL) {

View File

@ -1,5 +1,5 @@
/*
* Copyright (c) 2007, 2014, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2007, 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
@ -23,7 +23,7 @@
/**
* @test
* @bug 6545058 6611182 8016209
* @bug 6545058 6611182 8016209 8139986
* @summary validate and test -version, -fullversion, and internal, as well as
* sanity checks if a tool can be launched.
* @compile VersionCheck.java
@ -115,12 +115,20 @@ public class VersionCheck extends TestHelper {
static String refVersion;
static String refFullVersion;
static String getAllVersionLines(String... argv) {
return getVersion0(true, argv);
}
static String getVersion(String... argv) {
return getVersion0(false, argv);
}
static String getVersion0(boolean allLines, String... argv) {
TestHelper.TestResult tr = doExec(argv);
StringBuilder out = new StringBuilder();
// remove the HotSpot line
for (String x : tr.testOutput) {
if (!x.matches(".*Client.*VM.*|.*Server.*VM.*")) {
if (allLines || !x.matches(".*Client.*VM.*|.*Server.*VM.*")) {
out = out.append(x + "\n");
}
}
@ -183,13 +191,6 @@ public class VersionCheck extends TestHelper {
"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 +201,6 @@ public class VersionCheck extends TestHelper {
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);
@ -213,6 +210,28 @@ public class VersionCheck extends TestHelper {
return failcount == 0;
}
static boolean testDebugVersion() {
String jdkType = System.getProperty("jdk.debug", "release");
String versionLines = getAllVersionLines(javaCmd, "-version");
if ("release".equals(jdkType)) {
jdkType = "";
} else {
jdkType = jdkType + " ";
}
String tofind = "(" + jdkType + "build";
int idx = versionLines.indexOf(tofind);
if (idx < 0) {
System.out.println("Did not find first instance of " + tofind);
return false;
}
idx = versionLines.indexOf(tofind, idx + 1);
if (idx < 0) {
System.out.println("Did not find first instance of " + tofind);
return false;
}
return true;
}
// Initialize
static void init() {
refVersion = getVersion(javaCmd, "-version");
@ -223,7 +242,8 @@ public class VersionCheck extends TestHelper {
init();
if (compareJVersionStrings() &&
compareInternalStrings() &&
testToolVersion()) {
testToolVersion() &&
testDebugVersion()) {
System.out.println("All Version string comparisons: PASS");
} else {
throw new AssertionError("Some tests failed");
@ -231,7 +251,7 @@ public class VersionCheck extends TestHelper {
}
static class ToolFilter implements FileFilter {
final Iterable<String> exclude ;
final Iterable<String> exclude;
protected ToolFilter(String... exclude) {
List<String> tlist = new ArrayList<>();
this.exclude = tlist;