# HG changeset patch # User prr # Date 1442593097 25200 # Node ID 38169ef6e325d997c80684dfb884b1dab8dacf0a # Parent 7869179af0584ed6f0324cc26db7919305fff89b# Parent db2f9bbb40f6fbd4c29baf01fb1e10c2af3f5c6d Merge diff -r 7869179af058 -r 38169ef6e325 make/lib/CoreLibraries.gmk --- a/make/lib/CoreLibraries.gmk Tue Sep 15 15:31:34 2015 +0400 +++ b/make/lib/CoreLibraries.gmk Fri Sep 18 09:18:17 2015 -0700 @@ -239,6 +239,53 @@ ########################################################################################## +ifeq ($(OPENJDK_TARGET_OS), aix) + LIBJIMAGE_TOOLCHAIN := TOOLCHAIN_LINK_CXX +endif # OPENJDK_TARGET_OS aix + +$(eval $(call SetupNativeCompilation,BUILD_LIBJIMAGE, \ + LIBRARY := jimage, \ + TOOLCHAIN := $(LIBJIMAGE_TOOLCHAIN), \ + OUTPUT_DIR := $(INSTALL_LIBRARIES_HERE), \ + OPTIMIZATION := LOW, \ + SRC := $(JDK_TOPDIR)/src/java.base/share/native/libjimage \ + $(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjimage, \ + EXCLUDES := $(LIBJIMAGE_EXCLUDES), \ + CFLAGS := $(CFLAGS_JDKLIB) \ + $(JIMAGELIB_CPPFLAGS) \ + -I$(JDK_TOPDIR)/src/java.base/share/native/libjava \ + -I$(JDK_TOPDIR)/src/java.base/$(OPENJDK_TARGET_OS_TYPE)/native/libjava \ + -I$(JDK_TOPDIR)/src/java.base/share/native/libjimage \ + -I$(SUPPORT_OUTPUTDIR)/headers/java.base, \ + CFLAGS_unix := -UDEBUG, \ + MAPFILE := $(JDK_TOPDIR)/make/mapfiles/libjimage/mapfile-vers, \ + LDFLAGS := $(LDFLAGS_JDKLIB) \ + $(call SET_SHARED_LIBRARY_ORIGIN) \ + $(EXPORT_JIMAGE_FUNCS), \ + LDFLAGS_windows := -export:JIMAGE_Open -export:JIMAGE_Close \ + -export:JIMAGE_PackageToModule \ + -export:JIMAGE_FindResource -export:JIMAGE_GetResource \ + -export:JIMAGE_ResourceIterator, \ + LDFLAGS_SUFFIX_unix := -ljvm -ldl $(LIBCXX), \ + LDFLAGS_SUFFIX_linux := , \ + LDFLAGS_SUFFIX_solaris := -lc, \ + LDFLAGS_SUFFIX_aix := ,\ + LDFLAGS_SUFFIX_macosx := -lc++, \ + LDFLAGS_SUFFIX_windows := jvm.lib, \ + VERSIONINFO_RESOURCE := $(GLOBAL_VERSION_INFO_RESOURCE), \ + RC_FLAGS := $(RC_FLAGS) \ + -D "JDK_FNAME=jimage.dll" \ + -D "JDK_INTERNAL_NAME=jimage" \ + -D "JDK_FTYPE=0x2L", \ + OBJECT_DIR := $(SUPPORT_OUTPUTDIR)/native/$(MODULE)/libjimage, \ + DEBUG_SYMBOLS := $(DEBUG_ALL_BINARIES))) + +$(BUILD_LIBJIMAGE): $(BUILD_LIBJAVA) + +TARGETS += $(BUILD_LIBJIMAGE) + +########################################################################################## + LIBJLI_SRC_DIRS := $(call FindSrcDirsForLib, java.base, jli) LIBJLI_CFLAGS := $(CFLAGS_JDKLIB) diff -r 7869179af058 -r 38169ef6e325 make/mapfiles/libjava/mapfile-vers --- a/make/mapfiles/libjava/mapfile-vers Tue Sep 15 15:31:34 2015 +0400 +++ b/make/mapfiles/libjava/mapfile-vers Fri Sep 18 09:18:17 2015 -0700 @@ -150,7 +150,6 @@ Java_java_lang_StrictMath_exp; Java_java_lang_StrictMath_log; Java_java_lang_StrictMath_log10; - Java_java_lang_StrictMath_pow; Java_java_lang_StrictMath_sin; Java_java_lang_StrictMath_sqrt; Java_java_lang_StrictMath_cbrt; @@ -240,16 +239,6 @@ Java_java_util_TimeZone_getSystemTimeZoneID; Java_java_util_TimeZone_getSystemGMTOffsetID; Java_java_util_concurrent_atomic_AtomicLong_VMSupportsCS8; - Java_jdk_internal_jimage_ImageNativeSubstrate_openImage; - Java_jdk_internal_jimage_ImageNativeSubstrate_closeImage; - Java_jdk_internal_jimage_ImageNativeSubstrate_getIndexAddress; - Java_jdk_internal_jimage_ImageNativeSubstrate_getDataAddress; - Java_jdk_internal_jimage_ImageNativeSubstrate_read; - Java_jdk_internal_jimage_ImageNativeSubstrate_readCompressed; - Java_jdk_internal_jimage_ImageNativeSubstrate_getStringBytes; - Java_jdk_internal_jimage_ImageNativeSubstrate_getAttributes; - Java_jdk_internal_jimage_ImageNativeSubstrate_findAttributes; - Java_jdk_internal_jimage_ImageNativeSubstrate_attributeOffsets; Java_sun_misc_MessageUtils_toStderr; Java_sun_misc_MessageUtils_toStdout; Java_sun_misc_NativeSignalHandler_handle0; diff -r 7869179af058 -r 38169ef6e325 make/mapfiles/libjimage/mapfile-vers --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/make/mapfiles/libjimage/mapfile-vers Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,55 @@ +# +# Copyright (c) 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 +# under the terms of the GNU General Public License version 2 only, as +# published by the Free Software Foundation. Oracle designates this +# particular file as subject to the "Classpath" exception as provided +# by Oracle in the LICENSE file that accompanied this code. +# +# This code is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License +# version 2 for more details (a copy is included in the LICENSE file that +# accompanied this code). +# +# You should have received a copy of the GNU General Public License version +# 2 along with this work; if not, write to the Free Software Foundation, +# Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. +# +# Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA +# or visit www.oracle.com if you need additional information or have any +# questions. +# + +# Define public interface. + +SUNWprivate_1.1 { + global: + JNI_OnLoad; + Java_jdk_internal_jimage_ImageNativeSubstrate_openImage; + Java_jdk_internal_jimage_ImageNativeSubstrate_closeImage; + Java_jdk_internal_jimage_ImageNativeSubstrate_getIndexAddress; + Java_jdk_internal_jimage_ImageNativeSubstrate_getDataAddress; + Java_jdk_internal_jimage_ImageNativeSubstrate_read; + Java_jdk_internal_jimage_ImageNativeSubstrate_readCompressed; + Java_jdk_internal_jimage_ImageNativeSubstrate_getStringBytes; + Java_jdk_internal_jimage_ImageNativeSubstrate_getAttributes; + Java_jdk_internal_jimage_ImageNativeSubstrate_findAttributes; + Java_jdk_internal_jimage_ImageNativeSubstrate_attributeOffsets; + Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1Open; + Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1Close; + Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1FindResource; + Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1GetResource; + Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1PackageToModule; + Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1Resources; + JIMAGE_Open; + JIMAGE_Close; + JIMAGE_PackageToModule; + JIMAGE_FindResource; + JIMAGE_GetResource; + JIMAGE_ResourceIterator; + local: + *; +}; diff -r 7869179af058 -r 38169ef6e325 make/mapfiles/libzip/reorder-sparc --- a/make/mapfiles/libzip/reorder-sparc Tue Sep 15 15:31:34 2015 +0400 +++ b/make/mapfiles/libzip/reorder-sparc Fri Sep 18 09:18:17 2015 -0700 @@ -12,6 +12,7 @@ text: .text%addMetaName: OUTPUTDIR/zip_util.o; text: .text%ZIP_FindEntry; text: .text%ZIP_GetEntry; +text: .text%ZIP_InflateFully; text: .text%ZIP_Lock; text: .text%ZIP_Unlock; text: .text%ZIP_FreeEntry; diff -r 7869179af058 -r 38169ef6e325 make/mapfiles/libzip/reorder-sparcv9 --- a/make/mapfiles/libzip/reorder-sparcv9 Tue Sep 15 15:31:34 2015 +0400 +++ b/make/mapfiles/libzip/reorder-sparcv9 Fri Sep 18 09:18:17 2015 -0700 @@ -11,6 +11,7 @@ text: .text%addMetaName: OUTPUTDIR/zip_util.o; text: .text%ZIP_FindEntry; text: .text%ZIP_GetEntry; +text: .text%ZIP_InflateFully; text: .text%ZIP_Lock; text: .text%ZIP_Unlock; text: .text%ZIP_FreeEntry; diff -r 7869179af058 -r 38169ef6e325 make/mapfiles/libzip/reorder-x86 --- a/make/mapfiles/libzip/reorder-x86 Tue Sep 15 15:31:34 2015 +0400 +++ b/make/mapfiles/libzip/reorder-x86 Fri Sep 18 09:18:17 2015 -0700 @@ -12,6 +12,7 @@ text: .text%addMetaName: OUTPUTDIR/zip_util.o; text: .text%ZIP_FindEntry; text: .text%ZIP_GetEntry; +text: .text%ZIP_InflateFully; text: .text%ZIP_Lock; text: .text%ZIP_Unlock; text: .text%ZIP_FreeEntry; diff -r 7869179af058 -r 38169ef6e325 make/netbeans/jmx/build.xml --- a/make/netbeans/jmx/build.xml Tue Sep 15 15:31:34 2015 +0400 +++ b/make/netbeans/jmx/build.xml Fri Sep 18 09:18:17 2015 -0700 @@ -63,8 +63,8 @@ - @@ -90,44 +90,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff -r 7869179af058 -r 38169ef6e325 make/rmic/Rmic-java.management.gmk --- a/make/rmic/Rmic-java.management.gmk Tue Sep 15 15:31:34 2015 +0400 +++ b/make/rmic/Rmic-java.management.gmk Fri Sep 18 09:18:17 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 @@ -32,38 +32,31 @@ # Generate RMI stubs # -# For RMI/IIOP call rmic a second time with -standardPackage option -# so that *_tie classes are generated in package without the prefix -# org.omg.stub (6375696) JMX_RMI_CLASSES := javax.management.remote.rmi.RMIConnectionImpl \ javax.management.remote.rmi.RMIServerImpl -GENRMIIIOPCLASSES := -ifneq ($(RMICONNECTOR_IIOP), false) - GENRMIIIOPCLASSES := $(RMICONNECTOR_IIOP) -endif -$(eval $(call SetupRMICompilation,RMI_IIOP, \ + +# Generate into gensrc dir where sources get picked up for javadoc, then move the classes +# into the stub classes dir. +$(eval $(call SetupRMICompilation,RMI_GEN, \ CLASSES := $(JMX_RMI_CLASSES), \ CLASSES_DIR := $(CLASSES_DIR)/java.management, \ - STUB_CLASSES_DIR := $(STUB_CLASSES_DIR)/java.management, \ + STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR), \ RUN_V12 := true, \ - RUN_IIOP := $(GENRMIIIOPCLASSES), \ - RUN_IIOP_STDPKG := $(GENRMIIIOPCLASSES))) + KEEP_GENERATED := true, \ +)) -# Keep generated RMI/JRMP Stub source files and copy them to RMIC_GENSRC_DIR -# so that javadoc can include them in the API (4997471) -$(eval $(call SetupRMICompilation,RMI_SRC, \ - CLASSES := $(JMX_RMI_CLASSES), \ - CLASSES_DIR := $(CLASSES_DIR)/java.management, \ - STUB_CLASSES_DIR := $(RMIC_GENSRC_DIR)/java.management, \ - RUN_V12 := true, \ - KEEP_GENERATED := true)) +# Find all classes generated and move them from the gensrc dir to the stub classes dir +$(RMIC_GENSRC_DIR)/_classes.moved: $(RMI_GEN) + $(eval classfiles := $(shell $(FIND) $(RMIC_GENSRC_DIR) -name "*.class")) + $(foreach src, $(classfiles), \ + $(eval target := $(patsubst $(RMIC_GENSRC_DIR)/%, \ + $(STUB_CLASSES_DIR)/java.management/%, $(src))) \ + $(MKDIR) -p $(dir $(target)) ; \ + $(MV) $(src) $(target) $(NEWLINE)) + $(TOUCH) $@ ########################################################################################## -$(RMIC_GENSRC_DIR)/_the.classes.removed: $(RMI_IIOP) $(RMI_SRC) - $(FIND) $(RMIC_GENSRC_DIR) -name "*.class" $(FIND_DELETE) - $(TOUCH) $@ - -all: $(RMIC_GENSRC_DIR)/_the.classes.removed $(RMI_IIOP) $(RMI_SRC) +all: $(RMIC_GENSRC_DIR)/_classes.moved $(RMI_GEN) .PHONY: all diff -r 7869179af058 -r 38169ef6e325 src/java.base/macosx/classes/java/net/DefaultInterface.java --- a/src/java.base/macosx/classes/java/net/DefaultInterface.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/macosx/classes/java/net/DefaultInterface.java Fri Sep 18 09:18:17 2015 -0700 @@ -42,7 +42,7 @@ class DefaultInterface { - private final static NetworkInterface defaultInterface = + private static final NetworkInterface defaultInterface = chooseDefaultInterface(); static NetworkInterface getDefault() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java --- a/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -106,7 +106,7 @@ tmpSet.addAll(Control.getNoFallbackControl(Control.FORMAT_DEFAULT).getCandidateLocales("", l)); supportedLocaleSet = Collections.unmodifiableSet(tmpSet); } - private final static Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]); + private static final Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]); @SuppressWarnings("fallthrough") private static Locale convertMacOSXLocaleToJavaLocale(String macosxloc) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java --- a/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1998, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1998, 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 @@ -864,7 +864,9 @@ if (computed[i] != actual[i]) { throw new IOException( "Keystore was tampered with, or " - + "password was incorrect"); + + "password was incorrect", + new UnrecoverableKeyException( + "Password verification failed")); } } } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java --- a/src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java Fri Sep 18 09:18:17 2015 -0700 @@ -45,7 +45,7 @@ final class RC2Crypt extends SymmetricCipher { // PITABLE from the RFC, used in key setup - private final static int[] PI_TABLE = new int[] { + private static final int[] PI_TABLE = new int[] { 0xd9, 0x78, 0xf9, 0xc4, 0x19, 0xdd, 0xb5, 0xed, 0x28, 0xe9, 0xfd, 0x79, 0x4a, 0xa0, 0xd8, 0x9d, 0xc6, 0x7e, 0x37, 0x83, 0x2b, 0x76, 0x53, 0x8e, diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java --- a/src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java Fri Sep 18 09:18:17 2015 -0700 @@ -59,7 +59,7 @@ // TABLE[EKB] from section 6 of RFC 2268, used to convert effective key // size to/from encoded version number - private final static int[] EKB_TABLE = new int[] { + private static final int[] EKB_TABLE = new int[] { 0xbd, 0x56, 0xea, 0xf2, 0xa2, 0xf1, 0xac, 0x2a, 0xb0, 0x93, 0xd1, 0x9c, 0x1b, 0x33, 0xfd, 0xd0, 0x30, 0x04, 0xb6, 0xdc, 0x7d, 0xdf, 0x32, 0x4b, diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java --- a/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java Fri Sep 18 09:18:17 2015 -0700 @@ -66,23 +66,23 @@ public final class RSACipher extends CipherSpi { // constant for an empty byte array - private final static byte[] B0 = new byte[0]; + private static final byte[] B0 = new byte[0]; // mode constant for public key encryption - private final static int MODE_ENCRYPT = 1; + private static final int MODE_ENCRYPT = 1; // mode constant for private key decryption - private final static int MODE_DECRYPT = 2; + private static final int MODE_DECRYPT = 2; // mode constant for private key encryption (signing) - private final static int MODE_SIGN = 3; + private static final int MODE_SIGN = 3; // mode constant for public key decryption (verifying) - private final static int MODE_VERIFY = 4; + private static final int MODE_VERIFY = 4; // constant for raw RSA - private final static String PAD_NONE = "NoPadding"; + private static final String PAD_NONE = "NoPadding"; // constant for PKCS#1 v1.5 RSA - private final static String PAD_PKCS1 = "PKCS1Padding"; + private static final String PAD_PKCS1 = "PKCS1Padding"; // constant for PKCS#2 v2.0 OAEP with MGF1 - private final static String PAD_OAEP_MGF1 = "OAEP"; + private static final String PAD_OAEP_MGF1 = "OAEP"; // current mode, one of MODE_* above. Set when init() is called private int mode; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java --- a/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -43,7 +43,7 @@ */ public final class TlsKeyMaterialGenerator extends KeyGeneratorSpi { - private final static String MSG = "TlsKeyMaterialGenerator must be " + private static final String MSG = "TlsKeyMaterialGenerator must be " + "initialized using a TlsKeyMaterialParameterSpec"; @SuppressWarnings("deprecation") diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java --- a/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -43,7 +43,7 @@ */ public final class TlsMasterSecretGenerator extends KeyGeneratorSpi { - private final static String MSG = "TlsMasterSecretGenerator must be " + private static final String MSG = "TlsMasterSecretGenerator must be " + "initialized using a TlsMasterSecretParameterSpec"; @SuppressWarnings("deprecation") diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java --- a/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -50,23 +50,23 @@ // magic constants and utility functions, also used by other files // in this package - private final static byte[] B0 = new byte[0]; + private static final byte[] B0 = new byte[0]; - final static byte[] LABEL_MASTER_SECRET = // "master secret" + static final byte[] LABEL_MASTER_SECRET = // "master secret" { 109, 97, 115, 116, 101, 114, 32, 115, 101, 99, 114, 101, 116 }; - final static byte[] LABEL_KEY_EXPANSION = // "key expansion" + static final byte[] LABEL_KEY_EXPANSION = // "key expansion" { 107, 101, 121, 32, 101, 120, 112, 97, 110, 115, 105, 111, 110 }; - final static byte[] LABEL_CLIENT_WRITE_KEY = // "client write key" + static final byte[] LABEL_CLIENT_WRITE_KEY = // "client write key" { 99, 108, 105, 101, 110, 116, 32, 119, 114, 105, 116, 101, 32, 107, 101, 121 }; - final static byte[] LABEL_SERVER_WRITE_KEY = // "server write key" + static final byte[] LABEL_SERVER_WRITE_KEY = // "server write key" { 115, 101, 114, 118, 101, 114, 32, 119, 114, 105, 116, 101, 32, 107, 101, 121 }; - final static byte[] LABEL_IV_BLOCK = // "IV block" + static final byte[] LABEL_IV_BLOCK = // "IV block" { 73, 86, 32, 98, 108, 111, 99, 107 }; /* @@ -79,7 +79,7 @@ private static final byte[] HMAC_opad128 = genPad((byte)0x5c, 128); // SSL3 magic mix constants ("A", "BB", "CCC", ...) - final static byte[][] SSL3_CONST = genConst(); + static final byte[][] SSL3_CONST = genConst(); static byte[] genPad(byte b, int count) { byte[] padding = new byte[count]; @@ -109,7 +109,7 @@ // PRF implementation - private final static String MSG = "TlsPrfGenerator must be " + private static final String MSG = "TlsPrfGenerator must be " + "initialized using a TlsPrfParameterSpec"; @SuppressWarnings("deprecation") @@ -368,7 +368,7 @@ * appropriate supportsParamters() checks into KeyGenerators (not * currently there). */ - static public class V12 extends TlsPrfGenerator { + public static class V12 extends TlsPrfGenerator { protected SecretKey engineGenerateKey() { return engineGenerateKey0(true); } @@ -377,7 +377,7 @@ /** * A KeyGenerator implementation that supports TLS 1.0/1.1. */ - static public class V10 extends TlsPrfGenerator { + public static class V10 extends TlsPrfGenerator { protected SecretKey engineGenerateKey() { return engineGenerateKey0(false); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java --- a/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -41,7 +41,7 @@ */ public final class TlsRsaPremasterSecretGenerator extends KeyGeneratorSpi { - private final static String MSG = "TlsRsaPremasterSecretGenerator must be " + private static final String MSG = "TlsRsaPremasterSecretGenerator must be " + "initialized using a TlsRsaPremasterSecretParameterSpec"; @SuppressWarnings("deprecation") diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java Fri Sep 18 09:18:17 2015 -0700 @@ -342,7 +342,7 @@ * presence of attributes. That is, flags are a mix of modifier * bits and attribute indicators. */ - public static abstract + public abstract static class Holder { // We need this abstract method to interpret embedded CP refs. @@ -461,7 +461,7 @@ // Lightweight interface to hide details of band structure. // Also used for testing. - public static abstract + public abstract static class ValueStream { public int getInt(int bandIndex) { throw undef(); } public void putInt(int bandIndex, int value) { throw undef(); } @@ -667,7 +667,7 @@ public boolean hasCallables() { return (elems.length > 0 && elems[0].kind == EK_CBLE); } - static private final Element[] noElems = {}; + private static final Element[] noElems = {}; public Element[] getCallables() { if (hasCallables()) { Element[] nelems = Arrays.copyOf(elems, elems.length); @@ -783,7 +783,7 @@ * Replaces '\c' by the decimal code of the character c. * Replaces '0xNNN' by the decimal code of the hex number NNN. */ - static public + public static String normalizeLayoutString(String layout) { StringBuilder buf = new StringBuilder(); for (int i = 0, len = layout.length(); i < len; ) { @@ -1139,7 +1139,7 @@ bodies.toArray(res); return res; } - static private + private static int skipBody(String layout, int i) { assert(layout.charAt(i-1) == '['); if (layout.charAt(i) == ']') @@ -1156,7 +1156,7 @@ assert(layout.charAt(i) == ']'); return i; // return closing bracket } - static private + private static int tokenizeUInt(Layout.Element e, String layout, int i) { switch (layout.charAt(i++)) { case 'V': e.len = 0; break; @@ -1167,7 +1167,7 @@ } return i; } - static private + private static int tokenizeSInt(Layout.Element e, String layout, int i) { if (layout.charAt(i) == 'S') { e.flags |= EF_SIGN; @@ -1176,7 +1176,7 @@ return tokenizeUInt(e, layout, i); } - static private + private static boolean isDigit(char c) { return c >= '0' && c <= '9'; } @@ -1383,7 +1383,7 @@ return e.body[lastj]; } - static private + private static int parseInt(Layout.Element e, byte[] bytes, int pos, int[] buf) { int value = 0; int loBits = e.len * 8; @@ -1483,7 +1483,7 @@ } } - static private + private static void unparseInt(Layout.Element e, int value, ByteArrayOutputStream out) { int loBits = e.len * 8; if (loBits == 0) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java Fri Sep 18 09:18:17 2015 -0700 @@ -73,7 +73,7 @@ boolean optVaryCodings = !p200.getBoolean(Utils.COM_PREFIX+"no.vary.codings"); boolean optBigStrings = !p200.getBoolean(Utils.COM_PREFIX+"no.big.strings"); - abstract protected Index getCPIndex(byte tag); + protected abstract Index getCPIndex(byte tag); // Local copy of highest class version. private Package.Version highestClassVersion = null; @@ -97,27 +97,27 @@ protected BandStructure() {} - final static Coding BYTE1 = Coding.of(1,256); + static final Coding BYTE1 = Coding.of(1,256); - final static Coding CHAR3 = Coding.of(3,128); + static final Coding CHAR3 = Coding.of(3,128); // Note: Tried sharper (3,16) with no post-zip benefit. // This is best used with BCI values: - final static Coding BCI5 = Coding.of(5,4); // mostly 1-byte offsets - final static Coding BRANCH5 = Coding.of(5,4,2); // mostly forward branches + static final Coding BCI5 = Coding.of(5,4); // mostly 1-byte offsets + static final Coding BRANCH5 = Coding.of(5,4,2); // mostly forward branches - final static Coding UNSIGNED5 = Coding.of(5,64); - final static Coding UDELTA5 = UNSIGNED5.getDeltaCoding(); + static final Coding UNSIGNED5 = Coding.of(5,64); + static final Coding UDELTA5 = UNSIGNED5.getDeltaCoding(); // "sharp" (5,64) zips 0.4% better than "medium" (5,128) // It zips 1.1% better than "flat" (5,192) - final static Coding SIGNED5 = Coding.of(5,64,1); //sharp - final static Coding DELTA5 = SIGNED5.getDeltaCoding(); + static final Coding SIGNED5 = Coding.of(5,64,1); //sharp + static final Coding DELTA5 = SIGNED5.getDeltaCoding(); // Note: Tried (5,128,2) and (5,192,2) with no benefit. - final static Coding MDELTA5 = Coding.of(5,64,2).getDeltaCoding(); + static final Coding MDELTA5 = Coding.of(5,64,2).getDeltaCoding(); - final private static Coding[] basicCodings = { + private static final Coding[] basicCodings = { // Table of "Canonical BHSD Codings" from Pack200 spec. null, // _meta_default @@ -250,7 +250,7 @@ null }; - final private static Map basicCodingIndexes; + private static final Map basicCodingIndexes; static { assert(basicCodings[_meta_default] == null); assert(basicCodings[_meta_canon_min] != null); @@ -362,9 +362,9 @@ protected long outputSize = -1; // cache - final public Coding regularCoding; + public final Coding regularCoding; - final public int seqForDebug; + public final int seqForDebug; public int elementCountForDebug; @@ -430,7 +430,7 @@ protected abstract long computeOutputSize(); - abstract protected void writeDataTo(OutputStream out) throws IOException; + protected abstract void writeDataTo(OutputStream out) throws IOException; /** Expect a certain number of values. */ void expectLength(int l) { @@ -468,7 +468,7 @@ readDataFrom(in); readyToDisburse(); } - abstract protected void readDataFrom(InputStream in) throws IOException; + protected abstract void readDataFrom(InputStream in) throws IOException; protected void readyToDisburse() { if (verbose > 1) Utils.log.fine("readyToDisburse "+this); setPhase(DISBURSE_PHASE); @@ -1447,7 +1447,7 @@ return b; } - static private final boolean NULL_IS_OK = true; + private static final boolean NULL_IS_OK = true; MultiBand all_bands = (MultiBand) new MultiBand("(package)", UNSIGNED5).init(); @@ -2539,7 +2539,7 @@ return false; } - static private boolean assertDoneDisbursing(Band b) { + private static boolean assertDoneDisbursing(Band b) { if (b.phase != DISBURSE_PHASE) { Utils.log.warning("assertDoneDisbursing: still in phase "+b.phase+": "+b); if (verbose() <= 1) return false; // fail now @@ -2562,7 +2562,7 @@ return true; } - static private void printCDecl(Band b) { + private static void printCDecl(Band b) { if (b instanceof MultiBand) { MultiBand mb = (MultiBand) b; for (int i = 0; i < mb.bandCount; i++) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java Fri Sep 18 09:18:17 2015 -0700 @@ -56,7 +56,7 @@ return m.getCPMap(); } - static private final ConstantPool.Entry[] noRefs = ConstantPool.noRefs; + private static final ConstantPool.Entry[] noRefs = ConstantPool.noRefs; // The following fields are used directly by the ClassReader, etc. int max_stack; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java Fri Sep 18 09:18:17 2015 -0700 @@ -662,7 +662,7 @@ return lg; } - static private final byte[] byteBitWidths = new byte[0x100]; + private static final byte[] byteBitWidths = new byte[0x100]; static { for (int b = 0; b < byteBitWidths.length; b++) { byteBitWidths[b] = (byte) ceil_lg2(b + 1); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java Fri Sep 18 09:18:17 2015 -0700 @@ -1139,7 +1139,7 @@ } } - static private + private static String pct(double num, double den) { return (Math.round((num / den)*10000)/100.0)+"%"; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Fri Sep 18 09:18:17 2015 -0700 @@ -194,7 +194,7 @@ /** Entries in the constant pool. */ - public static abstract + public abstract static class Entry implements Comparable { protected final byte tag; // a CONSTANT_foo code protected int valueHash; // cached hashCode @@ -338,7 +338,7 @@ return (REF_getField <= refKind && refKind <= REF_invokeInterface); } - public static abstract + public abstract static class LiteralEntry extends Entry { protected LiteralEntry(byte tag) { super(tag); @@ -785,7 +785,7 @@ return new String(sig); } - static private int skipTo(char semi, String sig, int i) { + private static int skipTo(char semi, String sig, int i) { i = sig.indexOf(semi, i); return (i >= 0) ? i : sig.length(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Fri Sep 18 09:18:17 2015 -0700 @@ -36,7 +36,7 @@ private Constants(){} - public final static int JAVA_MAGIC = 0xCAFEBABE; + public static final int JAVA_MAGIC = 0xCAFEBABE; /* Java Class Version numbers history @@ -48,93 +48,93 @@ 1.8 to 1.7.x 52,0 */ - public final static Package.Version JAVA_MIN_CLASS_VERSION = + public static final Package.Version JAVA_MIN_CLASS_VERSION = Package.Version.of(45, 03); - public final static Package.Version JAVA5_MAX_CLASS_VERSION = + public static final Package.Version JAVA5_MAX_CLASS_VERSION = Package.Version.of(49, 00); - public final static Package.Version JAVA6_MAX_CLASS_VERSION = + public static final Package.Version JAVA6_MAX_CLASS_VERSION = Package.Version.of(50, 00); - public final static Package.Version JAVA7_MAX_CLASS_VERSION = + public static final Package.Version JAVA7_MAX_CLASS_VERSION = Package.Version.of(51, 00); - public final static Package.Version JAVA8_MAX_CLASS_VERSION = + public static final Package.Version JAVA8_MAX_CLASS_VERSION = Package.Version.of(52, 00); - public final static int JAVA_PACKAGE_MAGIC = 0xCAFED00D; + public static final int JAVA_PACKAGE_MAGIC = 0xCAFED00D; - public final static Package.Version JAVA5_PACKAGE_VERSION = + public static final Package.Version JAVA5_PACKAGE_VERSION = Package.Version.of(150, 7); - public final static Package.Version JAVA6_PACKAGE_VERSION = + public static final Package.Version JAVA6_PACKAGE_VERSION = Package.Version.of(160, 1); - public final static Package.Version JAVA7_PACKAGE_VERSION = + public static final Package.Version JAVA7_PACKAGE_VERSION = Package.Version.of(170, 1); - public final static Package.Version JAVA8_PACKAGE_VERSION = + public static final Package.Version JAVA8_PACKAGE_VERSION = Package.Version.of(171, 0); // upper limit, should point to the latest class version - public final static Package.Version JAVA_MAX_CLASS_VERSION = + public static final Package.Version JAVA_MAX_CLASS_VERSION = JAVA8_MAX_CLASS_VERSION; // upper limit should point to the latest package version, for version info!. - public final static Package.Version MAX_PACKAGE_VERSION = + public static final Package.Version MAX_PACKAGE_VERSION = JAVA7_PACKAGE_VERSION; - public final static int CONSTANT_POOL_INDEX_LIMIT = 0x10000; - public final static int CONSTANT_POOL_NARROW_LIMIT = 0x00100; + public static final int CONSTANT_POOL_INDEX_LIMIT = 0x10000; + public static final int CONSTANT_POOL_NARROW_LIMIT = 0x00100; - public final static String JAVA_SIGNATURE_CHARS = "BSCIJFDZLV(["; + public static final String JAVA_SIGNATURE_CHARS = "BSCIJFDZLV(["; - public final static byte CONSTANT_Utf8 = 1; - public final static byte CONSTANT_unused2 = 2; // unused, was Unicode - public final static byte CONSTANT_Integer = 3; - public final static byte CONSTANT_Float = 4; - public final static byte CONSTANT_Long = 5; - public final static byte CONSTANT_Double = 6; - public final static byte CONSTANT_Class = 7; - public final static byte CONSTANT_String = 8; - public final static byte CONSTANT_Fieldref = 9; - public final static byte CONSTANT_Methodref = 10; - public final static byte CONSTANT_InterfaceMethodref = 11; - public final static byte CONSTANT_NameandType = 12; - public final static byte CONSTANT_unused13 = 13; - public final static byte CONSTANT_unused14 = 14; - public final static byte CONSTANT_MethodHandle = 15; - public final static byte CONSTANT_MethodType = 16; - public final static byte CONSTANT_unused17 = 17; // unused - public final static byte CONSTANT_InvokeDynamic = 18; + public static final byte CONSTANT_Utf8 = 1; + public static final byte CONSTANT_unused2 = 2; // unused, was Unicode + public static final byte CONSTANT_Integer = 3; + public static final byte CONSTANT_Float = 4; + public static final byte CONSTANT_Long = 5; + public static final byte CONSTANT_Double = 6; + public static final byte CONSTANT_Class = 7; + public static final byte CONSTANT_String = 8; + public static final byte CONSTANT_Fieldref = 9; + public static final byte CONSTANT_Methodref = 10; + public static final byte CONSTANT_InterfaceMethodref = 11; + public static final byte CONSTANT_NameandType = 12; + public static final byte CONSTANT_unused13 = 13; + public static final byte CONSTANT_unused14 = 14; + public static final byte CONSTANT_MethodHandle = 15; + public static final byte CONSTANT_MethodType = 16; + public static final byte CONSTANT_unused17 = 17; // unused + public static final byte CONSTANT_InvokeDynamic = 18; // pseudo-constants: - public final static byte CONSTANT_None = 0; - public final static byte CONSTANT_Signature = CONSTANT_unused13; - public final static byte CONSTANT_BootstrapMethod = CONSTANT_unused17; // used only in InvokeDynamic constants - public final static byte CONSTANT_Limit = 19; + public static final byte CONSTANT_None = 0; + public static final byte CONSTANT_Signature = CONSTANT_unused13; + public static final byte CONSTANT_BootstrapMethod = CONSTANT_unused17; // used only in InvokeDynamic constants + public static final byte CONSTANT_Limit = 19; - public final static byte CONSTANT_All = 50; // combined global map - public final static byte CONSTANT_LoadableValue = 51; // used for 'KL' and qldc operands - public final static byte CONSTANT_AnyMember = 52; // union of refs to field or (interface) method - public final static byte CONSTANT_FieldSpecific = 53; // used only for 'KQ' ConstantValue attrs - public final static byte CONSTANT_GroupFirst = CONSTANT_All; - public final static byte CONSTANT_GroupLimit = CONSTANT_FieldSpecific+1; + public static final byte CONSTANT_All = 50; // combined global map + public static final byte CONSTANT_LoadableValue = 51; // used for 'KL' and qldc operands + public static final byte CONSTANT_AnyMember = 52; // union of refs to field or (interface) method + public static final byte CONSTANT_FieldSpecific = 53; // used only for 'KQ' ConstantValue attrs + public static final byte CONSTANT_GroupFirst = CONSTANT_All; + public static final byte CONSTANT_GroupLimit = CONSTANT_FieldSpecific+1; // CONSTANT_MethodHandle reference kinds - public final static byte REF_getField = 1; - public final static byte REF_getStatic = 2; - public final static byte REF_putField = 3; - public final static byte REF_putStatic = 4; - public final static byte REF_invokeVirtual = 5; - public final static byte REF_invokeStatic = 6; - public final static byte REF_invokeSpecial = 7; - public final static byte REF_newInvokeSpecial = 8; - public final static byte REF_invokeInterface = 9; + public static final byte REF_getField = 1; + public static final byte REF_getStatic = 2; + public static final byte REF_putField = 3; + public static final byte REF_putStatic = 4; + public static final byte REF_invokeVirtual = 5; + public static final byte REF_invokeStatic = 6; + public static final byte REF_invokeSpecial = 7; + public static final byte REF_newInvokeSpecial = 8; + public static final byte REF_invokeInterface = 9; // pseudo-access bits - public final static int ACC_IC_LONG_FORM = (1<<16); //for ic_flags + public static final int ACC_IC_LONG_FORM = (1<<16); //for ic_flags // attribute "context types" public static final int ATTR_CONTEXT_CLASS = 0; @@ -199,14 +199,14 @@ public static final int NO_MODTIME = 0; // null modtime value // some comstantly empty containers - public final static int[] noInts = {}; - public final static byte[] noBytes = {}; - public final static Object[] noValues = {}; - public final static String[] noStrings = {}; - public final static List emptyList = Arrays.asList(noValues); + public static final int[] noInts = {}; + public static final byte[] noBytes = {}; + public static final Object[] noValues = {}; + public static final String[] noStrings = {}; + public static final List emptyList = Arrays.asList(noValues); // meta-coding - public final static int + public static final int _meta_default = 0, _meta_canon_min = 1, _meta_canon_max = 115, @@ -216,7 +216,7 @@ _meta_limit = 189; // bytecodes - public final static int + public static final int _nop = 0, // 0x00 _aconst_null = 1, // 0x01 _iconst_m1 = 2, // 0x02 @@ -422,10 +422,10 @@ _bytecode_limit = 202; // 0xca // End marker, used to terminate bytecode sequences: - public final static int _end_marker = 255; + public static final int _end_marker = 255; // Escapes: - public final static int _byte_escape = 254; - public final static int _ref_escape = 253; + public static final int _byte_escape = 254; + public static final int _ref_escape = 253; // Self-relative pseudo-opcodes for better compression. // A "linker op" is a bytecode which links to a class member. @@ -440,26 +440,26 @@ // For simplicity, we define the full symmetric set of variants. // However, some of them are relatively useless. // Self linker ops are enabled by Pack.selfCallVariants (true). - public final static int _first_linker_op = _getstatic; - public final static int _last_linker_op = _invokestatic; - public final static int _num_linker_ops = (_last_linker_op - _first_linker_op) + 1; - public final static int _self_linker_op = _bytecode_limit; - public final static int _self_linker_aload_flag = 1*_num_linker_ops; - public final static int _self_linker_super_flag = 2*_num_linker_ops; - public final static int _self_linker_limit = _self_linker_op + 4*_num_linker_ops; + public static final int _first_linker_op = _getstatic; + public static final int _last_linker_op = _invokestatic; + public static final int _num_linker_ops = (_last_linker_op - _first_linker_op) + 1; + public static final int _self_linker_op = _bytecode_limit; + public static final int _self_linker_aload_flag = 1*_num_linker_ops; + public static final int _self_linker_super_flag = 2*_num_linker_ops; + public static final int _self_linker_limit = _self_linker_op + 4*_num_linker_ops; // An "invoke init" op is a variant of invokespecial which works // only with the method name "". There are variants which // link to the current class, the super class, or the class of the // immediately previous "newinstance" op. There are 3 of these ops. // They all take method signature references as operands. // Invoke init ops are enabled by Pack.initCallVariants (true). - public final static int _invokeinit_op = _self_linker_limit; - public final static int _invokeinit_self_option = 0; - public final static int _invokeinit_super_option = 1; - public final static int _invokeinit_new_option = 2; - public final static int _invokeinit_limit = _invokeinit_op+3; + public static final int _invokeinit_op = _self_linker_limit; + public static final int _invokeinit_self_option = 0; + public static final int _invokeinit_super_option = 1; + public static final int _invokeinit_new_option = 2; + public static final int _invokeinit_limit = _invokeinit_op+3; - public final static int _pseudo_instruction_limit = _invokeinit_limit; + public static final int _pseudo_instruction_limit = _invokeinit_limit; // linker variant limit == 202+(7*4)+3 == 233 // Ldc variants support strongly typed references to constants. @@ -467,25 +467,25 @@ // which is a great simplification. // Ldc variants gain us only 0.007% improvement in compression ratio, // but they simplify the file format greatly. - public final static int _xldc_op = _invokeinit_limit; - public final static int _sldc = _ldc; // previously named _aldc - public final static int _cldc = _xldc_op+0; - public final static int _ildc = _xldc_op+1; - public final static int _fldc = _xldc_op+2; - public final static int _sldc_w = _ldc_w; // previously named _aldc_w - public final static int _cldc_w = _xldc_op+3; - public final static int _ildc_w = _xldc_op+4; - public final static int _fldc_w = _xldc_op+5; - public final static int _lldc2_w = _ldc2_w; - public final static int _dldc2_w = _xldc_op+6; + public static final int _xldc_op = _invokeinit_limit; + public static final int _sldc = _ldc; // previously named _aldc + public static final int _cldc = _xldc_op+0; + public static final int _ildc = _xldc_op+1; + public static final int _fldc = _xldc_op+2; + public static final int _sldc_w = _ldc_w; // previously named _aldc_w + public static final int _cldc_w = _xldc_op+3; + public static final int _ildc_w = _xldc_op+4; + public static final int _fldc_w = _xldc_op+5; + public static final int _lldc2_w = _ldc2_w; + public static final int _dldc2_w = _xldc_op+6; // anything other than primitive, string, or class must be handled with qldc: - public final static int _qldc = _xldc_op+7; - public final static int _qldc_w = _xldc_op+8; - public final static int _xldc_limit = _xldc_op+9; + public static final int _qldc = _xldc_op+7; + public static final int _qldc_w = _xldc_op+8; + public static final int _xldc_limit = _xldc_op+9; // handling of InterfaceMethodRef - public final static int _invoke_int_op = _xldc_limit; - public final static int _invokespecial_int = _invoke_int_op+0; - public final static int _invokestatic_int = _invoke_int_op+1; - public final static int _invoke_int_limit = _invoke_int_op+2; + public static final int _invoke_int_op = _xldc_limit; + public static final int _invokespecial_int = _invoke_int_op+0; + public static final int _invokestatic_int = _invoke_int_op+1; + public static final int _invoke_int_limit = _invoke_int_op+2; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java Fri Sep 18 09:18:17 2015 -0700 @@ -376,7 +376,7 @@ } } - static private + private static File createTempFile(String basefile, String suffix) throws IOException { File base = new File(basefile); String prefix = base.getName(); @@ -393,7 +393,7 @@ return tmpfile.toFile(); } - static private + private static void printUsage(boolean doPack, boolean full, PrintStream out) { String prog = doPack ? "pack200" : "unpack200"; String[] packUsage = (String[])RESOURCE.getObject(DriverResource.PACK_HELP); @@ -408,7 +408,7 @@ } } - static private + private static String getZipComment(String jarfile) throws IOException { byte[] tail = new byte[1000]; long filelen = new File(jarfile).length(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java Fri Sep 18 09:18:17 2015 -0700 @@ -218,7 +218,7 @@ return sum; } - static private + private static double round(double x, double scale) { return Math.round(x * scale) / scale; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java Fri Sep 18 09:18:17 2015 -0700 @@ -471,14 +471,14 @@ /// Format definitions. - static private final byte[][] BC_LENGTH = new byte[2][0x100]; - static private final byte[][] BC_INDEX = new byte[2][0x100]; - static private final byte[][] BC_TAG = new byte[2][0x100]; - static private final byte[][] BC_BRANCH = new byte[2][0x100]; - static private final byte[][] BC_SLOT = new byte[2][0x100]; - static private final byte[][] BC_CON = new byte[2][0x100]; - static private final String[] BC_NAME = new String[0x100]; // debug only - static private final String[][] BC_FORMAT = new String[2][_bytecode_limit]; // debug only + private static final byte[][] BC_LENGTH = new byte[2][0x100]; + private static final byte[][] BC_INDEX = new byte[2][0x100]; + private static final byte[][] BC_TAG = new byte[2][0x100]; + private static final byte[][] BC_BRANCH = new byte[2][0x100]; + private static final byte[][] BC_SLOT = new byte[2][0x100]; + private static final byte[][] BC_CON = new byte[2][0x100]; + private static final String[] BC_NAME = new String[0x100]; // debug only + private static final String[][] BC_FORMAT = new String[2][_bytecode_limit]; // debug only static { for (int i = 0; i < _bytecode_limit; i++) { BC_LENGTH[0][i] = -1; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java Fri Sep 18 09:18:17 2015 -0700 @@ -104,7 +104,7 @@ } // for JNI callbacks - static private Object currentInstance() { + private static Object currentInstance() { UnpackerImpl p200 = (UnpackerImpl) Utils.getTLGlobals(); return (p200 == null)? null: p200._nunp; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java Fri Sep 18 09:18:17 2015 -0700 @@ -990,7 +990,7 @@ } // Helper for building InnerClasses attributes. - static private + private static void visitInnerClassRefs(Collection innerClasses, int mode, Collection refs) { if (innerClasses == null) { return; // no attribute; nothing to do diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java Fri Sep 18 09:18:17 2015 -0700 @@ -218,7 +218,7 @@ return res; } - final static int MAGIC_BYTES = 4; + static final int MAGIC_BYTES = 4; void readArchiveMagic() throws IOException { // Read a minimum of bytes in the first gulp. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java --- a/src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java Fri Sep 18 09:18:17 2015 -0700 @@ -265,7 +265,7 @@ } } // Wrapper to prevent closing of client-supplied stream. - static private + private static class NonCloser extends FilterOutputStream { NonCloser(OutputStream out) { super(out); } public void close() throws IOException { flush(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java --- a/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java Fri Sep 18 09:18:17 2015 -0700 @@ -46,7 +46,7 @@ * replaced by {@link javax.net.ssl.HttpsURLConnection}. */ @Deprecated -abstract public +public abstract class HttpsURLConnection extends HttpURLConnection { /* diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java --- a/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,7 +61,7 @@ * * @see java.security.Security security properties */ - public final static String getDefaultAlgorithm() { + public static final String getDefaultAlgorithm() { String type; type = AccessController.doPrivileged(new PrivilegedAction<>() { public String run() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java --- a/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,7 +61,7 @@ * * @see java.security.Security security properties */ - public final static String getDefaultAlgorithm() { + public static final String getDefaultAlgorithm() { String type; type = AccessController.doPrivileged(new PrivilegedAction<>() { public String run() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java --- a/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -56,7 +56,7 @@ static final long serialVersionUID = -2048442350420423405L; private java.security.cert.X509Certificate wrappedCert; - synchronized private static java.security.cert.CertificateFactory + private static synchronized java.security.cert.CertificateFactory getFactory() throws java.security.cert.CertificateException { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/security/ntlm/Client.java --- a/src/java.base/share/classes/com/sun/security/ntlm/Client.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/security/ntlm/Client.java Fri Sep 18 09:18:17 2015 -0700 @@ -43,8 +43,8 @@ * */ public final class Client extends NTLM { - final private String hostname; - final private String username; + private final String hostname; + private final String username; private String domain; private byte[] pw1, pw2; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java --- a/src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java Fri Sep 18 09:18:17 2015 -0700 @@ -36,13 +36,13 @@ /** * If the incoming packet is invalid. */ - public final static int PACKET_READ_ERROR = 1; + public static final int PACKET_READ_ERROR = 1; /** * If the client cannot get a domain value from the server and the * caller has not provided one. */ - public final static int NO_DOMAIN_INFO = 2; + public static final int NO_DOMAIN_INFO = 2; /** * If the domain provided by the client does not match the one received @@ -53,22 +53,22 @@ /** * If the client name is not found on server's user database. */ - public final static int USER_UNKNOWN = 3; + public static final int USER_UNKNOWN = 3; /** * If authentication fails. */ - public final static int AUTH_FAILED = 4; + public static final int AUTH_FAILED = 4; /** * If an illegal version string is provided. */ - public final static int BAD_VERSION = 5; + public static final int BAD_VERSION = 5; /** * Protocol errors. */ - public final static int PROTOCOL = 6; + public static final int PROTOCOL = 6; private int errorCode; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/com/sun/security/ntlm/Server.java --- a/src/java.base/share/classes/com/sun/security/ntlm/Server.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/com/sun/security/ntlm/Server.java Fri Sep 18 09:18:17 2015 -0700 @@ -49,8 +49,8 @@ * */ public abstract class Server extends NTLM { - final private String domain; - final private boolean allVersion; + private final String domain; + private final boolean allVersion; /** * Creates a Server instance. * @param version the NTLM version to use, which can be: diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/Console.java --- a/src/java.base/share/classes/java/io/Console.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/Console.java Fri Sep 18 09:18:17 2015 -0700 @@ -554,7 +554,7 @@ }); } private static Console cons; - private native static boolean istty(); + private static native boolean istty(); private Console() { readLock = new Object(); writeLock = new Object(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/DataInputStream.java --- a/src/java.base/share/classes/java/io/DataInputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/DataInputStream.java Fri Sep 18 09:18:17 2015 -0700 @@ -585,7 +585,7 @@ * valid modified UTF-8 encoding of a Unicode string. * @see java.io.DataInputStream#readUnsignedShort() */ - public final static String readUTF(DataInput in) throws IOException { + public static final String readUTF(DataInput in) throws IOException { int utflen = in.readUnsignedShort(); byte[] bytearr = null; char[] chararr = null; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/File.java --- a/src/java.base/share/classes/java/io/File.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/File.java Fri Sep 18 09:18:17 2015 -0700 @@ -2204,7 +2204,7 @@ // -- Integration with java.nio.file -- - private volatile transient Path filePath; + private transient volatile Path filePath; /** * Returns a {@link Path java.nio.file.Path} object constructed from the diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/FilePermission.java --- a/src/java.base/share/classes/java/io/FilePermission.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/FilePermission.java Fri Sep 18 09:18:17 2015 -0700 @@ -101,32 +101,32 @@ /** * Execute action. */ - private final static int EXECUTE = 0x1; + private static final int EXECUTE = 0x1; /** * Write action. */ - private final static int WRITE = 0x2; + private static final int WRITE = 0x2; /** * Read action. */ - private final static int READ = 0x4; + private static final int READ = 0x4; /** * Delete action. */ - private final static int DELETE = 0x8; + private static final int DELETE = 0x8; /** * Read link action. */ - private final static int READLINK = 0x10; + private static final int READLINK = 0x10; /** * All actions (read,write,execute,delete,readlink) */ - private final static int ALL = READ|WRITE|EXECUTE|DELETE|READLINK; + private static final int ALL = READ|WRITE|EXECUTE|DELETE|READLINK; /** * No actions. */ - private final static int NONE = 0x0; + private static final int NONE = 0x0; // the actions mask private transient int mask; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/ObjectInputStream.java --- a/src/java.base/share/classes/java/io/ObjectInputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/ObjectInputStream.java Fri Sep 18 09:18:17 2015 -0700 @@ -1079,7 +1079,7 @@ /** * Provide access to the persistent fields read from the input stream. */ - public static abstract class GetField { + public abstract static class GetField { /** * Get the ObjectStreamClass that describes the fields in the stream. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/ObjectOutputStream.java --- a/src/java.base/share/classes/java/io/ObjectOutputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/ObjectOutputStream.java Fri Sep 18 09:18:17 2015 -0700 @@ -875,7 +875,7 @@ * * @since 1.2 */ - public static abstract class PutField { + public abstract static class PutField { /** * Put the value of the named boolean field into the persistent field. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/ObjectStreamClass.java --- a/src/java.base/share/classes/java/io/ObjectStreamClass.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/ObjectStreamClass.java Fri Sep 18 09:18:17 2015 -0700 @@ -1839,7 +1839,7 @@ * Returns true if the given class defines a static initializer method, * false otherwise. */ - private native static boolean hasStaticInitializer(Class cl); + private static native boolean hasStaticInitializer(Class cl); /** * Class for computing and caching field/constructor/method signatures diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/ObjectStreamConstants.java --- a/src/java.base/share/classes/java/io/ObjectStreamConstants.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/ObjectStreamConstants.java Fri Sep 18 09:18:17 2015 -0700 @@ -36,12 +36,12 @@ /** * Magic number that is written to the stream header. */ - final static short STREAM_MAGIC = (short)0xaced; + static final short STREAM_MAGIC = (short)0xaced; /** * Version number that is written to the stream header. */ - final static short STREAM_VERSION = 5; + static final short STREAM_VERSION = 5; /* Each item in the stream is preceded by a tag */ @@ -49,95 +49,95 @@ /** * First tag value. */ - final static byte TC_BASE = 0x70; + static final byte TC_BASE = 0x70; /** * Null object reference. */ - final static byte TC_NULL = (byte)0x70; + static final byte TC_NULL = (byte)0x70; /** * Reference to an object already written into the stream. */ - final static byte TC_REFERENCE = (byte)0x71; + static final byte TC_REFERENCE = (byte)0x71; /** * new Class Descriptor. */ - final static byte TC_CLASSDESC = (byte)0x72; + static final byte TC_CLASSDESC = (byte)0x72; /** * new Object. */ - final static byte TC_OBJECT = (byte)0x73; + static final byte TC_OBJECT = (byte)0x73; /** * new String. */ - final static byte TC_STRING = (byte)0x74; + static final byte TC_STRING = (byte)0x74; /** * new Array. */ - final static byte TC_ARRAY = (byte)0x75; + static final byte TC_ARRAY = (byte)0x75; /** * Reference to Class. */ - final static byte TC_CLASS = (byte)0x76; + static final byte TC_CLASS = (byte)0x76; /** * Block of optional data. Byte following tag indicates number * of bytes in this block data. */ - final static byte TC_BLOCKDATA = (byte)0x77; + static final byte TC_BLOCKDATA = (byte)0x77; /** * End of optional block data blocks for an object. */ - final static byte TC_ENDBLOCKDATA = (byte)0x78; + static final byte TC_ENDBLOCKDATA = (byte)0x78; /** * Reset stream context. All handles written into stream are reset. */ - final static byte TC_RESET = (byte)0x79; + static final byte TC_RESET = (byte)0x79; /** * long Block data. The long following the tag indicates the * number of bytes in this block data. */ - final static byte TC_BLOCKDATALONG= (byte)0x7A; + static final byte TC_BLOCKDATALONG= (byte)0x7A; /** * Exception during write. */ - final static byte TC_EXCEPTION = (byte)0x7B; + static final byte TC_EXCEPTION = (byte)0x7B; /** * Long string. */ - final static byte TC_LONGSTRING = (byte)0x7C; + static final byte TC_LONGSTRING = (byte)0x7C; /** * new Proxy Class Descriptor. */ - final static byte TC_PROXYCLASSDESC = (byte)0x7D; + static final byte TC_PROXYCLASSDESC = (byte)0x7D; /** * new Enum constant. * @since 1.5 */ - final static byte TC_ENUM = (byte)0x7E; + static final byte TC_ENUM = (byte)0x7E; /** * Last tag value. */ - final static byte TC_MAX = (byte)0x7E; + static final byte TC_MAX = (byte)0x7E; /** * First wire handle to be assigned. */ - final static int baseWireHandle = 0x7e0000; + static final int baseWireHandle = 0x7e0000; /******************************************************/ @@ -147,7 +147,7 @@ * Bit mask for ObjectStreamClass flag. Indicates a Serializable class * defines its own writeObject method. */ - final static byte SC_WRITE_METHOD = 0x01; + static final byte SC_WRITE_METHOD = 0x01; /** * Bit mask for ObjectStreamClass flag. Indicates Externalizable data @@ -157,23 +157,23 @@ * @see #PROTOCOL_VERSION_2 * @since 1.2 */ - final static byte SC_BLOCK_DATA = 0x08; + static final byte SC_BLOCK_DATA = 0x08; /** * Bit mask for ObjectStreamClass flag. Indicates class is Serializable. */ - final static byte SC_SERIALIZABLE = 0x02; + static final byte SC_SERIALIZABLE = 0x02; /** * Bit mask for ObjectStreamClass flag. Indicates class is Externalizable. */ - final static byte SC_EXTERNALIZABLE = 0x04; + static final byte SC_EXTERNALIZABLE = 0x04; /** * Bit mask for ObjectStreamClass flag. Indicates class is an enum type. * @since 1.5 */ - final static byte SC_ENUM = 0x10; + static final byte SC_ENUM = 0x10; /* *******************************************************************/ @@ -187,7 +187,7 @@ * @see java.io.ObjectInputStream#enableResolveObject(boolean) * @since 1.2 */ - final static SerializablePermission SUBSTITUTION_PERMISSION = + static final SerializablePermission SUBSTITUTION_PERMISSION = new SerializablePermission("enableSubstitution"); /** @@ -197,7 +197,7 @@ * @see java.io.ObjectInputStream#readObjectOverride() * @since 1.2 */ - final static SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION = + static final SerializablePermission SUBCLASS_IMPLEMENTATION_PERMISSION = new SerializablePermission("enableSubclassImplementation"); /** * A Stream Protocol Version.

@@ -210,7 +210,7 @@ * @see java.io.ObjectOutputStream#useProtocolVersion(int) * @since 1.2 */ - public final static int PROTOCOL_VERSION_1 = 1; + public static final int PROTOCOL_VERSION_1 = 1; /** @@ -231,5 +231,5 @@ * @see #SC_BLOCK_DATA * @since 1.2 */ - public final static int PROTOCOL_VERSION_2 = 2; + public static final int PROTOCOL_VERSION_2 = 2; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/Reader.java --- a/src/java.base/share/classes/java/io/Reader.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/Reader.java Fri Sep 18 09:18:17 2015 -0700 @@ -157,7 +157,7 @@ * If {@code off} is negative, or {@code len} is negative, * or {@code len} is greater than {@code cbuf.length - off} */ - abstract public int read(char cbuf[], int off, int len) throws IOException; + public abstract int read(char cbuf[], int off, int len) throws IOException; /** Maximum skip-buffer size */ private static final int maxSkipBufferSize = 8192; @@ -260,6 +260,6 @@ * * @exception IOException If an I/O error occurs */ - abstract public void close() throws IOException; + public abstract void close() throws IOException; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/io/Writer.java --- a/src/java.base/share/classes/java/io/Writer.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/io/Writer.java Fri Sep 18 09:18:17 2015 -0700 @@ -142,7 +142,7 @@ * @throws IOException * If an I/O error occurs */ - abstract public void write(char cbuf[], int off, int len) throws IOException; + public abstract void write(char cbuf[], int off, int len) throws IOException; /** * Writes a string. @@ -312,7 +312,7 @@ * @throws IOException * If an I/O error occurs */ - abstract public void flush() throws IOException; + public abstract void flush() throws IOException; /** * Closes the stream, flushing it first. Once the stream has been closed, @@ -322,6 +322,6 @@ * @throws IOException * If an I/O error occurs */ - abstract public void close() throws IOException; + public abstract void close() throws IOException; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/Class.java --- a/src/java.base/share/classes/java/lang/Class.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/Class.java Fri Sep 18 09:18:17 2015 -0700 @@ -469,8 +469,8 @@ return null; } } - private volatile transient Constructor cachedConstructor; - private volatile transient Class newInstanceCallerCache; + private transient volatile Constructor cachedConstructor; + private transient volatile Class newInstanceCallerCache; /** @@ -1123,7 +1123,7 @@ } } - private final static class EnclosingMethodInfo { + private static final class EnclosingMethodInfo { private Class enclosingClass; private String name; private String descriptor; @@ -2514,11 +2514,11 @@ } } - private volatile transient SoftReference> reflectionData; + private transient volatile SoftReference> reflectionData; // Incremented by the VM on each call to JVM TI RedefineClasses() // that redefines this class or a superclass. - private volatile transient int classRedefinedCount = 0; + private transient volatile int classRedefinedCount = 0; // Lazily create and cache ReflectionData private ReflectionData reflectionData() { @@ -2561,7 +2561,7 @@ private native String getGenericSignature0(); // Generic info repository; lazily initialized - private volatile transient ClassRepository genericInfo; + private transient volatile ClassRepository genericInfo; // accessor for factory private GenericsFactory getFactory() { @@ -3353,7 +3353,7 @@ } return enumConstants; } - private volatile transient T[] enumConstants = null; + private transient volatile T[] enumConstants = null; /** * Returns a map from simple name to enum constant. This package-private @@ -3375,7 +3375,7 @@ } return enumConstantDirectory; } - private volatile transient Map enumConstantDirectory = null; + private transient volatile Map enumConstantDirectory = null; /** * Casts an object to the class or interface represented @@ -3523,7 +3523,7 @@ // Annotations cache @SuppressWarnings("UnusedDeclaration") - private volatile transient AnnotationData annotationData; + private transient volatile AnnotationData annotationData; private AnnotationData annotationData() { while (true) { // retry loop @@ -3578,7 +3578,7 @@ // Annotation types cache their internal (AnnotationType) form @SuppressWarnings("UnusedDeclaration") - private volatile transient AnnotationType annotationType; + private transient volatile AnnotationType annotationType; boolean casAnnotationType(AnnotationType oldType, AnnotationType newType) { return Atomic.casAnnotationType(this, oldType, newType); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/ClassLoader.java --- a/src/java.base/share/classes/java/lang/ClassLoader.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/ClassLoader.java Fri Sep 18 09:18:17 2015 -0700 @@ -1030,7 +1030,7 @@ return findLoadedClass0(name); } - private native final Class findLoadedClass0(String name); + private final native Class findLoadedClass0(String name); /** * Sets the signers of a class. This should be invoked after defining a diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java --- a/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java Fri Sep 18 09:18:17 2015 -0700 @@ -47,14 +47,14 @@ final class ConditionalSpecialCasing { // context conditions. - final static int FINAL_CASED = 1; - final static int AFTER_SOFT_DOTTED = 2; - final static int MORE_ABOVE = 3; - final static int AFTER_I = 4; - final static int NOT_BEFORE_DOT = 5; + static final int FINAL_CASED = 1; + static final int AFTER_SOFT_DOTTED = 2; + static final int MORE_ABOVE = 3; + static final int AFTER_I = 4; + static final int NOT_BEFORE_DOT = 5; // combining class definitions - final static int COMBINING_CLASS_ABOVE = 230; + static final int COMBINING_CLASS_ABOVE = 230; // Special case mapping entries static Entry[] entry = { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/FdLibm.java --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/classes/java/lang/FdLibm.java Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,383 @@ +/* + * Copyright (c) 1998, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. Oracle designates this + * particular file as subject to the "Classpath" exception as provided + * by Oracle in the LICENSE file that accompanied this code. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ + +package java.lang; + +/** + * Port of the "Freely Distributable Math Library", version 5.3, from C to Java. + * + *

The C version of fdlibm relied on the idiom of pointer aliasing + * a 64-bit double floating-point value as a two-element array of + * 32-bit integers and reading and writing the two halves of the + * double independently. This coding pattern was problematic to C + * optimizers and not directly expressible in Java. Therefore, rather + * than a memory level overlay, if portions of a double need to be + * operated on as integer values, the standard library methods for + * bitwise floating-point to integer conversion, + * Double.longBitsToDouble and Double.doubleToRawLongBits, are directly + * or indirectly used . + * + *

The C version of fdlibm also took some pains to signal the + * correct IEEE 754 exceptional conditions divide by zero, invalid, + * overflow and underflow. For example, overflow would be signaled by + * {@code huge * huge} where {@code huge} was a large constant that + * would overflow when squared. Since IEEE floating-point exceptional + * handling is not supported natively in the JVM, such coding patterns + * have been omitted from this port. For example, rather than {@code + * return huge * huge}, this port will use {@code return INFINITY}. + */ +class FdLibm { + // Constants used by multiple algorithms + private static final double INFINITY = Double.POSITIVE_INFINITY; + + private FdLibm() { + throw new UnsupportedOperationException("No instances for you."); + } + + /** + * Return the low-order 32 bits of the double argument as an int. + */ + private static int __LO(double x) { + long transducer = Double.doubleToRawLongBits(x); + return (int)transducer; + } + + /** + * Return a double with its low-order bits of the second argument + * and the high-order bits of the first argument.. + */ + private static double __LO(double x, int low) { + long transX = Double.doubleToRawLongBits(x); + return Double.longBitsToDouble((transX & 0xFFFF_FFFF_0000_0000L)|low ); + } + + /** + * Return the high-order 32 bits of the double argument as an int. + */ + private static int __HI(double x) { + long transducer = Double.doubleToRawLongBits(x); + return (int)(transducer >> 32); + } + + /** + * Return a double with its high-order bits of the second argument + * and the low-order bits of the first argument.. + */ + private static double __HI(double x, int high) { + long transX = Double.doubleToRawLongBits(x); + return Double.longBitsToDouble((transX & 0x0000_0000_FFFF_FFFFL)|( ((long)high)) << 32 ); + } + + /** + * Compute x**y + * n + * Method: Let x = 2 * (1+f) + * 1. Compute and return log2(x) in two pieces: + * log2(x) = w1 + w2, + * where w1 has 53 - 24 = 29 bit trailing zeros. + * 2. Perform y*log2(x) = n+y' by simulating muti-precision + * arithmetic, where |y'| <= 0.5. + * 3. Return x**y = 2**n*exp(y'*log2) + * + * Special cases: + * 1. (anything) ** 0 is 1 + * 2. (anything) ** 1 is itself + * 3. (anything) ** NAN is NAN + * 4. NAN ** (anything except 0) is NAN + * 5. +-(|x| > 1) ** +INF is +INF + * 6. +-(|x| > 1) ** -INF is +0 + * 7. +-(|x| < 1) ** +INF is +0 + * 8. +-(|x| < 1) ** -INF is +INF + * 9. +-1 ** +-INF is NAN + * 10. +0 ** (+anything except 0, NAN) is +0 + * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 + * 12. +0 ** (-anything except 0, NAN) is +INF + * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF + * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) + * 15. +INF ** (+anything except 0,NAN) is +INF + * 16. +INF ** (-anything except 0,NAN) is +0 + * 17. -INF ** (anything) = -0 ** (-anything) + * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) + * 19. (-anything except 0 and inf) ** (non-integer) is NAN + * + * Accuracy: + * pow(x,y) returns x**y nearly rounded. In particular + * pow(integer,integer) + * always returns the correct integer provided it is + * representable. + */ + public static class Pow { + public static strictfp double compute(final double x, final double y) { + double z; + double r, s, t, u, v, w; + int i, j, k, n; + + // y == zero: x**0 = 1 + if (y == 0.0) + return 1.0; + + // +/-NaN return x + y to propagate NaN significands + if (Double.isNaN(x) || Double.isNaN(y)) + return x + y; + + final double y_abs = Math.abs(y); + double x_abs = Math.abs(x); + // Special values of y + if (y == 2.0) { + return x * x; + } else if (y == 0.5) { + if (x >= -Double.MAX_VALUE) // Handle x == -infinity later + return Math.sqrt(x + 0.0); // Add 0.0 to properly handle x == -0.0 + } else if (y_abs == 1.0) { // y is +/-1 + return (y == 1.0) ? x : 1.0 / x; + } else if (y_abs == INFINITY) { // y is +/-infinity + if (x_abs == 1.0) + return y - y; // inf**+/-1 is NaN + else if (x_abs > 1.0) // (|x| > 1)**+/-inf = inf, 0 + return (y >= 0) ? y : 0.0; + else // (|x| < 1)**-/+inf = inf, 0 + return (y < 0) ? -y : 0.0; + } + + final int hx = __HI(x); + int ix = hx & 0x7fffffff; + + /* + * When x < 0, determine if y is an odd integer: + * y_is_int = 0 ... y is not an integer + * y_is_int = 1 ... y is an odd int + * y_is_int = 2 ... y is an even int + */ + int y_is_int = 0; + if (hx < 0) { + if (y_abs >= 0x1.0p53) // |y| >= 2^53 = 9.007199254740992E15 + y_is_int = 2; // y is an even integer since ulp(2^53) = 2.0 + else if (y_abs >= 1.0) { // |y| >= 1.0 + long y_abs_as_long = (long) y_abs; + if ( ((double) y_abs_as_long) == y_abs) { + y_is_int = 2 - (int)(y_abs_as_long & 0x1L); + } + } + } + + // Special value of x + if (x_abs == 0.0 || + x_abs == INFINITY || + x_abs == 1.0) { + z = x_abs; // x is +/-0, +/-inf, +/-1 + if (y < 0.0) + z = 1.0/z; // z = (1/|x|) + if (hx < 0) { + if (((ix - 0x3ff00000) | y_is_int) == 0) { + z = (z-z)/(z-z); // (-1)**non-int is NaN + } else if (y_is_int == 1) + z = -1.0 * z; // (x < 0)**odd = -(|x|**odd) + } + return z; + } + + n = (hx >> 31) + 1; + + // (x < 0)**(non-int) is NaN + if ((n | y_is_int) == 0) + return (x-x)/(x-x); + + s = 1.0; // s (sign of result -ve**odd) = -1 else = 1 + if ( (n | (y_is_int - 1)) == 0) + s = -1.0; // (-ve)**(odd int) + + double p_h, p_l, t1, t2; + // |y| is huge + if (y_abs > 0x1.0p31) { // if |y| > 2**31 + final double INV_LN2 = 0x1.7154_7652_b82fep0; // 1.44269504088896338700e+00 = 1/ln2 + final double INV_LN2_H = 0x1.715476p0; // 1.44269502162933349609e+00 = 24 bits of 1/ln2 + final double INV_LN2_L = 0x1.4ae0_bf85_ddf44p-26; // 1.92596299112661746887e-08 = 1/ln2 tail + + // Over/underflow if x is not close to one + if (x_abs < 0x1.fffffp-1) // |x| < 0.9999995231628418 + return (y < 0.0) ? s * INFINITY : s * 0.0; + if (x_abs > 1.0) // |x| > 1.0 + return (y > 0.0) ? s * INFINITY : s * 0.0; + /* + * now |1-x| is tiny <= 2**-20, sufficient to compute + * log(x) by x - x^2/2 + x^3/3 - x^4/4 + */ + t = x_abs - 1.0; // t has 20 trailing zeros + w = (t * t) * (0.5 - t * (0.3333333333333333333333 - t * 0.25)); + u = INV_LN2_H * t; // INV_LN2_H has 21 sig. bits + v = t * INV_LN2_L - w * INV_LN2; + t1 = u + v; + t1 =__LO(t1, 0); + t2 = v - (t1 - u); + } else { + final double CP = 0x1.ec70_9dc3_a03fdp-1; // 9.61796693925975554329e-01 = 2/(3ln2) + final double CP_H = 0x1.ec709ep-1; // 9.61796700954437255859e-01 = (float)cp + final double CP_L = -0x1.e2fe_0145_b01f5p-28; // -7.02846165095275826516e-09 = tail of CP_H + + double z_h, z_l, ss, s2, s_h, s_l, t_h, t_l; + n = 0; + // Take care of subnormal numbers + if (ix < 0x00100000) { + x_abs *= 0x1.0p53; // 2^53 = 9007199254740992.0 + n -= 53; + ix = __HI(x_abs); + } + n += ((ix) >> 20) - 0x3ff; + j = ix & 0x000fffff; + // Determine interval + ix = j | 0x3ff00000; // Normalize ix + if (j <= 0x3988E) + k = 0; // |x| > 1) | 0x20000000) + 0x00080000 + (k << 18) ); + t_l = x_abs - (t_h - BP[k]); + s_l = v * ((u - s_h * t_h) - s_h * t_l); + // Compute log(x_abs) + s2 = ss * ss; + r = s2 * s2* (L1 + s2 * (L2 + s2 * (L3 + s2 * (L4 + s2 * (L5 + s2 * L6))))); + r += s_l * (s_h + ss); + s2 = s_h * s_h; + t_h = 3.0 + s2 + r; + t_h = __LO(t_h, 0); + t_l = r - ((t_h - 3.0) - s2); + // u+v = ss*(1+...) + u = s_h * t_h; + v = s_l * t_h + t_l * ss; + // 2/(3log2)*(ss + ...) + p_h = u + v; + p_h = __LO(p_h, 0); + p_l = v - (p_h - u); + z_h = CP_H * p_h; // CP_H + CP_L = 2/(3*log2) + z_l = CP_L * p_h + p_l * CP + DP_L[k]; + // log2(x_abs) = (ss + ..)*2/(3*log2) = n + DP_H + z_h + z_l + t = (double)n; + t1 = (((z_h + z_l) + DP_H[k]) + t); + t1 = __LO(t1, 0); + t2 = z_l - (((t1 - t) - DP_H[k]) - z_h); + } + + // Split up y into (y1 + y2) and compute (y1 + y2) * (t1 + t2) + double y1 = y; + y1 = __LO(y1, 0); + p_l = (y - y1) * t1 + y * t2; + p_h = y1 * t1; + z = p_l + p_h; + j = __HI(z); + i = __LO(z); + if (j >= 0x40900000) { // z >= 1024 + if (((j - 0x40900000) | i)!=0) // if z > 1024 + return s * INFINITY; // Overflow + else { + final double OVT = 8.0085662595372944372e-0017; // -(1024-log2(ovfl+.5ulp)) + if (p_l + OVT > z - p_h) + return s * INFINITY; // Overflow + } + } else if ((j & 0x7fffffff) >= 0x4090cc00 ) { // z <= -1075 + if (((j - 0xc090cc00) | i)!=0) // z < -1075 + return s * 0.0; // Underflow + else { + if (p_l <= z - p_h) + return s * 0.0; // Underflow + } + } + /* + * Compute 2**(p_h+p_l) + */ + // Poly coefs for (3/2)*(log(x)-2s-2/3*s**3 + final double P1 = 0x1.5555_5555_5553ep-3; // 1.66666666666666019037e-01 + final double P2 = -0x1.6c16_c16b_ebd93p-9; // -2.77777777770155933842e-03 + final double P3 = 0x1.1566_aaf2_5de2cp-14; // 6.61375632143793436117e-05 + final double P4 = -0x1.bbd4_1c5d_26bf1p-20; // -1.65339022054652515390e-06 + final double P5 = 0x1.6376_972b_ea4d0p-25; // 4.13813679705723846039e-08 + final double LG2 = 0x1.62e4_2fef_a39efp-1; // 6.93147180559945286227e-01 + final double LG2_H = 0x1.62e43p-1; // 6.93147182464599609375e-01 + final double LG2_L = -0x1.05c6_10ca_86c39p-29; // -1.90465429995776804525e-09 + i = j & 0x7fffffff; + k = (i >> 20) - 0x3ff; + n = 0; + if (i > 0x3fe00000) { // if |z| > 0.5, set n = [z + 0.5] + n = j + (0x00100000 >> (k + 1)); + k = ((n & 0x7fffffff) >> 20) - 0x3ff; // new k for n + t = 0.0; + t = __HI(t, (n & ~(0x000fffff >> k)) ); + n = ((n & 0x000fffff) | 0x00100000) >> (20 - k); + if (j < 0) + n = -n; + p_h -= t; + } + t = p_l + p_h; + t = __LO(t, 0); + u = t * LG2_H; + v = (p_l - (t - p_h)) * LG2 + t * LG2_L; + z = u + v; + w = v - (z - u); + t = z * z; + t1 = z - t * (P1 + t * (P2 + t * (P3 + t * (P4 + t * P5)))); + r = (z * t1)/(t1 - 2.0) - (w + z * w); + z = 1.0 - (r - z); + j = __HI(z); + j += (n << 20); + if ((j >> 20) <= 0) + z = Math.scalb(z, n); // subnormal output + else { + int z_hi = __HI(z); + z_hi += (n << 20); + z = __HI(z, z_hi); + } + return s * z; + } + } +} diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/Integer.java --- a/src/java.base/share/classes/java/lang/Integer.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/Integer.java Fri Sep 18 09:18:17 2015 -0700 @@ -76,7 +76,7 @@ /** * All possible chars for representing a number as a String */ - final static char[] digits = { + static final char[] digits = { '0' , '1' , '2' , '3' , '4' , '5' , '6' , '7' , '8' , '9' , 'a' , 'b' , 'c' , 'd' , 'e' , 'f' , 'g' , 'h' , @@ -344,7 +344,7 @@ } while (charPos > offset); } - final static char [] DigitTens = { + static final char [] DigitTens = { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', @@ -357,7 +357,7 @@ '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', } ; - final static char [] DigitOnes = { + static final char [] DigitOnes = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', @@ -467,7 +467,7 @@ } } - final static int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999, + static final int [] sizeTable = { 9, 99, 999, 9999, 99999, 999999, 9999999, 99999999, 999999999, Integer.MAX_VALUE }; // Requires positive x diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/Package.java --- a/src/java.base/share/classes/java/lang/Package.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/Package.java Fri Sep 18 09:18:17 2015 -0700 @@ -656,6 +656,6 @@ private final String implVersion; private final String implVendor; private final URL sealBase; - private transient final ClassLoader loader; + private final transient ClassLoader loader; private transient Class packageInfo; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/ProcessBuilder.java --- a/src/java.base/share/classes/java/lang/ProcessBuilder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/ProcessBuilder.java Fri Sep 18 09:18:17 2015 -0700 @@ -458,7 +458,7 @@ * * @since 1.7 */ - public static abstract class Redirect { + public abstract static class Redirect { /** * The type of a {@link Redirect}. */ diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/StrictMath.java --- a/src/java.base/share/classes/java/lang/StrictMath.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/StrictMath.java Fri Sep 18 09:18:17 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 @@ -643,7 +643,9 @@ * @param b the exponent. * @return the value {@code a}{@code b}. */ - public static native double pow(double a, double b); + public static double pow(double a, double b) { + return FdLibm.Pow.compute(a, b); + } /** * Returns the closest {@code int} to the argument, with ties diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/StringCoding.java --- a/src/java.base/share/classes/java/lang/StringCoding.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/StringCoding.java Fri Sep 18 09:18:17 2015 -0700 @@ -52,9 +52,9 @@ private StringCoding() { } /** The cached coders for each thread */ - private final static ThreadLocal> decoder = + private static final ThreadLocal> decoder = new ThreadLocal<>(); - private final static ThreadLocal> encoder = + private static final ThreadLocal> encoder = new ThreadLocal<>(); private static boolean warnUnsupportedCharset = true; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/System.java --- a/src/java.base/share/classes/java/lang/System.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/System.java Fri Sep 18 09:18:17 2015 -0700 @@ -81,7 +81,7 @@ * corresponds to keyboard input or another input source specified by * the host environment or user. */ - public final static InputStream in = null; + public static final InputStream in = null; /** * The "standard" output stream. This stream is already @@ -108,7 +108,7 @@ * @see java.io.PrintStream#println(java.lang.Object) * @see java.io.PrintStream#println(java.lang.String) */ - public final static PrintStream out = null; + public static final PrintStream out = null; /** * The "standard" error output stream. This stream is already @@ -122,7 +122,7 @@ * variable out, has been redirected to a file or other * destination that is typically not continuously monitored. */ - public final static PrintStream err = null; + public static final PrintStream err = null; /* The security manager for the system. */ diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/Thread.java --- a/src/java.base/share/classes/java/lang/Thread.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/Thread.java Fri Sep 18 09:18:17 2015 -0700 @@ -244,17 +244,17 @@ /** * The minimum priority that a thread can have. */ - public final static int MIN_PRIORITY = 1; + public static final int MIN_PRIORITY = 1; /** * The default priority that is assigned to a thread. */ - public final static int NORM_PRIORITY = 5; + public static final int NORM_PRIORITY = 5; /** * The maximum priority that a thread can have. */ - public final static int MAX_PRIORITY = 10; + public static final int MAX_PRIORITY = 10; /** * Returns a reference to the currently executing thread object. @@ -1688,8 +1688,8 @@ return result.booleanValue(); } - private native static StackTraceElement[][] dumpThreads(Thread[] threads); - private native static Thread[] getThreads(); + private static native StackTraceElement[][] dumpThreads(Thread[] threads); + private static native Thread[] getThreads(); /** * Returns the identifier of this Thread. The thread ID is a positive diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/VirtualMachineError.java --- a/src/java.base/share/classes/java/lang/VirtualMachineError.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/VirtualMachineError.java Fri Sep 18 09:18:17 2015 -0700 @@ -33,7 +33,7 @@ * @author Frank Yellin * @since 1.0 */ -abstract public class VirtualMachineError extends Error { +public abstract class VirtualMachineError extends Error { private static final long serialVersionUID = 4161983926571568670L; /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java --- a/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java Fri Sep 18 09:18:17 2015 -0700 @@ -49,7 +49,7 @@ } /** Define this to extract the delegated target which supplies the invocation behavior. */ - abstract protected MethodHandle getTarget(); + protected abstract MethodHandle getTarget(); @Override abstract MethodHandle asTypeUncached(MethodType newType); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java --- a/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Fri Sep 18 09:18:17 2015 -0700 @@ -445,9 +445,9 @@ /** This subclass handles static field references. */ static class StaticAccessor extends DirectMethodHandle { - final private Class fieldType; - final private Object staticBase; - final private long staticOffset; + private final Class fieldType; + private final Object staticBase; + private final long staticOffset; private StaticAccessor(MethodType mtype, LambdaForm form, MemberName member, Object staticBase, long staticOffset) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java --- a/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -140,9 +140,9 @@ /** instance counters for dumped classes */ - private final static HashMap DUMP_CLASS_FILES_COUNTERS; + private static final HashMap DUMP_CLASS_FILES_COUNTERS; /** debugging flag for saving generated class files */ - private final static File DUMP_CLASS_FILES_DIR; + private static final File DUMP_CLASS_FILES_DIR; static { if (DUMP_CLASS_FILES) { @@ -771,7 +771,7 @@ mv.visitMethodInsn(Opcodes.INVOKEVIRTUAL, MH, "invokeBasic", type.basicType().toMethodDescriptorString(), false); } - static private Class[] STATICALLY_INVOCABLE_PACKAGES = { + private static Class[] STATICALLY_INVOCABLE_PACKAGES = { // Sample classes from each package we are willing to bind to statically: java.lang.Object.class, java.util.Arrays.class, diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java --- a/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java Fri Sep 18 09:18:17 2015 -0700 @@ -440,7 +440,7 @@ * Use best possible cause for err.initCause(), substituting the * cause for err itself if the cause has the same (or better) type. */ - static private Error initCauseFrom(Error err, Exception ex) { + private static Error initCauseFrom(Error err, Exception ex) { Throwable th = ex.getCause(); if (err.getClass().isInstance(th)) return (Error) th; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/invoke/MethodHandles.java --- a/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Fri Sep 18 09:18:17 2015 -0700 @@ -147,7 +147,7 @@ return lookup.revealDirect(target).reflectAs(expected, lookup); } // Copied from AccessibleObject, as used by Method.setAccessible, etc.: - static final private java.security.Permission ACCESS_PERMISSION = + private static final java.security.Permission ACCESS_PERMISSION = new ReflectPermission("suppressAccessChecks"); /** @@ -1884,7 +1884,7 @@ * or if the resulting method handle's type would have * too many parameters */ - static public + public static MethodHandle spreadInvoker(MethodType type, int leadingArgCount) { if (leadingArgCount < 0 || leadingArgCount > type.parameterCount()) throw newIllegalArgumentException("bad argument count", leadingArgCount); @@ -1927,7 +1927,7 @@ * @throws IllegalArgumentException if the resulting method handle's type would have * too many parameters */ - static public + public static MethodHandle exactInvoker(MethodType type) { return type.invokers().exactInvoker(); } @@ -1966,7 +1966,7 @@ * @throws IllegalArgumentException if the resulting method handle's type would have * too many parameters */ - static public + public static MethodHandle invoker(MethodType type) { return type.invokers().genericInvoker(); } @@ -2322,7 +2322,7 @@ return MethodHandleImpl.makeIntrinsic(mtype, lform, Intrinsic.ZERO); } - synchronized private static MethodHandle setCachedMethodHandle(MethodHandle[] cache, int pos, MethodHandle value) { + private static synchronized MethodHandle setCachedMethodHandle(MethodHandle[] cache, int pos, MethodHandle value) { // Simulate a CAS, to avoid racy duplication of results. MethodHandle prev = cache[pos]; if (prev != null) return prev; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java --- a/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java Fri Sep 18 09:18:17 2015 -0700 @@ -111,7 +111,7 @@ return (entry != null) ? entry.get() : null; } - synchronized public MethodHandle setCachedMethodHandle(int which, MethodHandle mh) { + public synchronized MethodHandle setCachedMethodHandle(int which, MethodHandle mh) { // Simulate a CAS, to avoid racy duplication of results. SoftReference entry = methodHandles[which]; if (entry != null) { @@ -130,7 +130,7 @@ return (entry != null) ? entry.get() : null; } - synchronized public LambdaForm setCachedLambdaForm(int which, LambdaForm form) { + public synchronized LambdaForm setCachedLambdaForm(int which, LambdaForm form) { // Simulate a CAS, to avoid racy duplication of results. SoftReference entry = lambdaForms[which]; if (entry != null) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/ref/Reference.java --- a/src/java.base/share/classes/java/lang/ref/Reference.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/ref/Reference.java Fri Sep 18 09:18:17 2015 -0700 @@ -107,7 +107,7 @@ * pending: next element in the pending list (or null if last) * otherwise: NULL */ - transient private Reference discovered; /* used by VM */ + private transient Reference discovered; /* used by VM */ /* Object used to synchronize with the garbage collector. The collector @@ -115,7 +115,7 @@ * therefore critical that any code holding this lock complete as quickly * as possible, allocate no new objects, and avoid calling user code. */ - static private class Lock { } + private static class Lock { } private static Lock lock = new Lock(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/ref/ReferenceQueue.java --- a/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java Fri Sep 18 09:18:17 2015 -0700 @@ -51,7 +51,7 @@ static ReferenceQueue NULL = new Null<>(); static ReferenceQueue ENQUEUED = new Null<>(); - static private class Lock { }; + private static class Lock { }; private Lock lock = new Lock(); private volatile Reference head = null; private long queueLength = 0; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/ref/SoftReference.java --- a/src/java.base/share/classes/java/lang/ref/SoftReference.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/ref/SoftReference.java Fri Sep 18 09:18:17 2015 -0700 @@ -66,7 +66,7 @@ /** * Timestamp clock, updated by the garbage collector */ - static private long clock; + private static long clock; /** * Timestamp updated by each invocation of the get method. The VM may use diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/lang/reflect/AccessibleObject.java --- a/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,7 +61,7 @@ * has sufficient privilege to defeat Java language access * control checks. */ - static final private java.security.Permission ACCESS_PERMISSION = + private static final java.security.Permission ACCESS_PERMISSION = new ReflectPermission("suppressAccessChecks"); /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/math/BigDecimal.java --- a/src/java.base/share/classes/java/math/BigDecimal.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/math/BigDecimal.java Fri Sep 18 09:18:17 2015 -0700 @@ -2268,14 +2268,14 @@ * digit prior to a nonzero discarded fraction. Note that this rounding * mode never decreases the magnitude of the calculated value. */ - public final static int ROUND_UP = 0; + public static final int ROUND_UP = 0; /** * Rounding mode to round towards zero. Never increments the digit * prior to a discarded fraction (i.e., truncates). Note that this * rounding mode never increases the magnitude of the calculated value. */ - public final static int ROUND_DOWN = 1; + public static final int ROUND_DOWN = 1; /** * Rounding mode to round towards positive infinity. If the @@ -2284,7 +2284,7 @@ * {@code ROUND_DOWN}. Note that this rounding mode never * decreases the calculated value. */ - public final static int ROUND_CEILING = 2; + public static final int ROUND_CEILING = 2; /** * Rounding mode to round towards negative infinity. If the @@ -2293,7 +2293,7 @@ * {@code ROUND_UP}. Note that this rounding mode never * increases the calculated value. */ - public final static int ROUND_FLOOR = 3; + public static final int ROUND_FLOOR = 3; /** * Rounding mode to round towards {@literal "nearest neighbor"} @@ -2303,7 +2303,7 @@ * that this is the rounding mode that most of us were taught in * grade school. */ - public final static int ROUND_HALF_UP = 4; + public static final int ROUND_HALF_UP = 4; /** * Rounding mode to round towards {@literal "nearest neighbor"} @@ -2312,7 +2312,7 @@ * fraction is {@literal >} 0.5; otherwise, behaves as for * {@code ROUND_DOWN}. */ - public final static int ROUND_HALF_DOWN = 5; + public static final int ROUND_HALF_DOWN = 5; /** * Rounding mode to round towards the {@literal "nearest neighbor"} @@ -2324,7 +2324,7 @@ * rounding mode that minimizes cumulative error when applied * repeatedly over a sequence of calculations. */ - public final static int ROUND_HALF_EVEN = 6; + public static final int ROUND_HALF_EVEN = 6; /** * Rounding mode to assert that the requested operation has an exact @@ -2332,7 +2332,7 @@ * specified on an operation that yields an inexact result, an * {@code ArithmeticException} is thrown. */ - public final static int ROUND_UNNECESSARY = 7; + public static final int ROUND_UNNECESSARY = 7; // Scaling/Rounding Operations @@ -3398,7 +3398,7 @@ return charPos; } - final static char[] DIGIT_TENS = { + static final char[] DIGIT_TENS = { '0', '0', '0', '0', '0', '0', '0', '0', '0', '0', '1', '1', '1', '1', '1', '1', '1', '1', '1', '1', '2', '2', '2', '2', '2', '2', '2', '2', '2', '2', @@ -3411,7 +3411,7 @@ '9', '9', '9', '9', '9', '9', '9', '9', '9', '9', }; - final static char[] DIGIT_ONES = { + static final char[] DIGIT_ONES = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/math/BigInteger.java --- a/src/java.base/share/classes/java/math/BigInteger.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/math/BigInteger.java Fri Sep 18 09:18:17 2015 -0700 @@ -184,7 +184,7 @@ /** * This mask is used to obtain the value of an int as if it were unsigned. */ - final static long LONG_MASK = 0xffffffffL; + static final long LONG_MASK = 0xffffffffL; /** * This constant limits {@code mag.length} of BigIntegers to the supported @@ -1212,7 +1212,7 @@ /** * Initialize static constant array when class is loaded. */ - private final static int MAX_CONSTANT = 16; + private static final int MAX_CONSTANT = 16; private static BigInteger posConst[] = new BigInteger[MAX_CONSTANT+1]; private static BigInteger negConst[] = new BigInteger[MAX_CONSTANT+1]; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java --- a/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -55,7 +55,7 @@ /** * flag set if the native connect() call not to be used */ - private final static boolean connectDisabled = os.contains("OS X"); + private static final boolean connectDisabled = os.contains("OS X"); /** * Load net library into runtime. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java --- a/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -721,6 +721,6 @@ abstract void socketSendUrgentData(int data) throws IOException; - public final static int SHUT_RD = 0; - public final static int SHUT_WR = 1; + public static final int SHUT_RD = 0; + public static final int SHUT_WR = 1; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/Authenticator.java --- a/src/java.base/share/classes/java/net/Authenticator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/Authenticator.java Fri Sep 18 09:18:17 2015 -0700 @@ -119,7 +119,7 @@ * @see SecurityManager#checkPermission * @see java.net.NetPermission */ - public synchronized static void setDefault(Authenticator a) { + public static synchronized void setDefault(Authenticator a) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { NetPermission setDefaultPermission diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/ContentHandler.java --- a/src/java.base/share/classes/java/net/ContentHandler.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/ContentHandler.java Fri Sep 18 09:18:17 2015 -0700 @@ -81,7 +81,7 @@ * @see java.net.URLConnection#setContentHandlerFactory(java.net.ContentHandlerFactory) * @since 1.0 */ -abstract public class ContentHandler { +public abstract class ContentHandler { /** * Given a URL connect stream positioned at the beginning of the @@ -92,7 +92,7 @@ * @return the object read by the {@code ContentHandler}. * @exception IOException if an I/O error occurs while reading the object. */ - abstract public Object getContent(URLConnection urlc) throws IOException; + public abstract Object getContent(URLConnection urlc) throws IOException; /** * Given a URL connect stream positioned at the beginning of the diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/CookieHandler.java --- a/src/java.base/share/classes/java/net/CookieHandler.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/CookieHandler.java Fri Sep 18 09:18:17 2015 -0700 @@ -69,7 +69,7 @@ * {@link NetPermission}{@code ("getCookieHandler")} * @see #setDefault(CookieHandler) */ - public synchronized static CookieHandler getDefault() { + public static synchronized CookieHandler getDefault() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(SecurityConstants.GET_COOKIEHANDLER_PERMISSION); @@ -89,7 +89,7 @@ * {@link NetPermission}{@code ("setCookieHandler")} * @see #getDefault() */ - public synchronized static void setDefault(CookieHandler cHandler) { + public static synchronized void setDefault(CookieHandler cHandler) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(SecurityConstants.SET_COOKIEHANDLER_PERMISSION); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/CookieManager.java --- a/src/java.base/share/classes/java/net/CookieManager.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/CookieManager.java Fri Sep 18 09:18:17 2015 -0700 @@ -362,7 +362,7 @@ } - static private boolean isInPortList(String lst, int port) { + private static boolean isInPortList(String lst, int port) { int i = lst.indexOf(','); int val = -1; while (i > 0) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/DatagramPacket.java --- a/src/java.base/share/classes/java/net/DatagramPacket.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/DatagramPacket.java Fri Sep 18 09:18:17 2015 -0700 @@ -384,5 +384,5 @@ /** * Perform class load-time initializations. */ - private native static void init(); + private static native void init(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/HostPortrange.java --- a/src/java.base/share/classes/java/net/HostPortrange.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/HostPortrange.java Fri Sep 18 09:18:17 2015 -0700 @@ -225,9 +225,9 @@ } // these shouldn't leak outside the implementation - final static int[] HTTP_PORT = {80, 80}; - final static int[] HTTPS_PORT = {443, 443}; - final static int[] NO_PORT = {-1, -1}; + static final int[] HTTP_PORT = {80, 80}; + static final int[] HTTPS_PORT = {443, 443}; + static final int[] NO_PORT = {-1, -1}; int[] defaultPort() { if (scheme.equals("http")) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/HttpCookie.java --- a/src/java.base/share/classes/java/net/HttpCookie.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/HttpCookie.java Fri Sep 18 09:18:17 2015 -0700 @@ -84,11 +84,11 @@ // Since the positive and zero max-age have their meanings, // this value serves as a hint as 'not specify max-age' - private final static long MAX_AGE_UNSPECIFIED = -1; + private static final long MAX_AGE_UNSPECIFIED = -1; // date formats used by Netscape's cookie draft // as well as formats seen on various sites - private final static String[] COOKIE_DATE_FORMATS = { + private static final String[] COOKIE_DATE_FORMATS = { "EEE',' dd-MMM-yyyy HH:mm:ss 'GMT'", "EEE',' dd MMM yyyy HH:mm:ss 'GMT'", "EEE MMM dd yyyy HH:mm:ss 'GMT'Z", @@ -98,8 +98,8 @@ }; // constant strings represent set-cookie header token - private final static String SET_COOKIE = "set-cookie:"; - private final static String SET_COOKIE2 = "set-cookie2:"; + private static final String SET_COOKIE = "set-cookie:"; + private static final String SET_COOKIE2 = "set-cookie2:"; // ---------------- Ctors -------------- diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/HttpURLConnection.java --- a/src/java.base/share/classes/java/net/HttpURLConnection.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/HttpURLConnection.java Fri Sep 18 09:18:17 2015 -0700 @@ -66,7 +66,7 @@ * @see java.net.HttpURLConnection#disconnect() * @since 1.1 */ -abstract public class HttpURLConnection extends URLConnection { +public abstract class HttpURLConnection extends URLConnection { /* instance variables */ /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/Inet4Address.java --- a/src/java.base/share/classes/java/net/Inet4Address.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/Inet4Address.java Fri Sep 18 09:18:17 2015 -0700 @@ -84,7 +84,7 @@ public final class Inet4Address extends InetAddress { - final static int INADDRSZ = 4; + static final int INADDRSZ = 4; /** use serialVersionUID from InetAddress, but Inet4Address instance * is always replaced by an InetAddress instance before being diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/Inet6Address.java --- a/src/java.base/share/classes/java/net/Inet6Address.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/Inet6Address.java Fri Sep 18 09:18:17 2015 -0700 @@ -173,7 +173,7 @@ public final class Inet6Address extends InetAddress { - final static int INADDRSZ = 16; + static final int INADDRSZ = 16; /* * cached scope_id - for link-local address use only. @@ -922,7 +922,7 @@ } // Utilities - private final static int INT16SZ = 2; + private static final int INT16SZ = 2; /* * Convert IPv6 binary address into presentation (printable) format. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/NetworkInterface.java --- a/src/java.base/share/classes/java/net/NetworkInterface.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/NetworkInterface.java Fri Sep 18 09:18:17 2015 -0700 @@ -400,16 +400,16 @@ false); } - private native static NetworkInterface[] getAll() + private static native NetworkInterface[] getAll() throws SocketException; - private native static NetworkInterface getByName0(String name) + private static native NetworkInterface getByName0(String name) throws SocketException; - private native static NetworkInterface getByIndex0(int index) + private static native NetworkInterface getByIndex0(int index) throws SocketException; - private native static NetworkInterface getByInetAddress0(InetAddress addr) + private static native NetworkInterface getByInetAddress0(InetAddress addr) throws SocketException; /** @@ -525,12 +525,12 @@ return virtual; } - private native static boolean isUp0(String name, int ind) throws SocketException; - private native static boolean isLoopback0(String name, int ind) throws SocketException; - private native static boolean supportsMulticast0(String name, int ind) throws SocketException; - private native static boolean isP2P0(String name, int ind) throws SocketException; - private native static byte[] getMacAddr0(byte[] inAddr, String name, int ind) throws SocketException; - private native static int getMTU0(String name, int ind) throws SocketException; + private static native boolean isUp0(String name, int ind) throws SocketException; + private static native boolean isLoopback0(String name, int ind) throws SocketException; + private static native boolean supportsMulticast0(String name, int ind) throws SocketException; + private static native boolean isP2P0(String name, int ind) throws SocketException; + private static native byte[] getMacAddr0(byte[] inAddr, String name, int ind) throws SocketException; + private static native int getMTU0(String name, int ind) throws SocketException; /** * Compares this object against the specified object. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/Proxy.java --- a/src/java.base/share/classes/java/net/Proxy.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/Proxy.java Fri Sep 18 09:18:17 2015 -0700 @@ -69,7 +69,7 @@ * {@code Socket s = new Socket(Proxy.NO_PROXY);} * */ - public final static Proxy NO_PROXY = new Proxy(); + public static final Proxy NO_PROXY = new Proxy(); // Creates the proxy that represents a {@code DIRECT} connection. private Proxy() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/ResponseCache.java --- a/src/java.base/share/classes/java/net/ResponseCache.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/ResponseCache.java Fri Sep 18 09:18:17 2015 -0700 @@ -80,7 +80,7 @@ * @return the system-wide {@code ResponseCache} * @since 1.5 */ - public synchronized static ResponseCache getDefault() { + public static synchronized ResponseCache getDefault() { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(SecurityConstants.GET_RESPONSECACHE_PERMISSION); @@ -103,7 +103,7 @@ * @see #getDefault() * @since 1.5 */ - public synchronized static void setDefault(ResponseCache responseCache) { + public static synchronized void setDefault(ResponseCache responseCache) { SecurityManager sm = System.getSecurityManager(); if (sm != null) { sm.checkPermission(SecurityConstants.SET_RESPONSECACHE_PERMISSION); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/SocketInputStream.java --- a/src/java.base/share/classes/java/net/SocketInputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/SocketInputStream.java Fri Sep 18 09:18:17 2015 -0700 @@ -287,5 +287,5 @@ /** * Perform class load-time initializations. */ - private native static void init(); + private static native void init(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/SocketOptions.java --- a/src/java.base/share/classes/java/net/SocketOptions.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/net/SocketOptions.java Fri Sep 18 09:18:17 2015 -0700 @@ -139,7 +139,7 @@ * @see Socket#getTcpNoDelay */ - @Native public final static int TCP_NODELAY = 0x0001; + @Native public static final int TCP_NODELAY = 0x0001; /** * Fetch the local address binding of a socket (this option cannot @@ -160,7 +160,7 @@ * @see DatagramSocket#getLocalAddress */ - @Native public final static int SO_BINDADDR = 0x000F; + @Native public static final int SO_BINDADDR = 0x000F; /** Sets SO_REUSEADDR for a socket. This is used only for MulticastSockets * in java, and it is set by default for MulticastSockets. @@ -168,7 +168,7 @@ * Valid for: DatagramSocketImpl */ - @Native public final static int SO_REUSEADDR = 0x04; + @Native public static final int SO_REUSEADDR = 0x04; /** * Sets SO_BROADCAST for a socket. This option enables and disables @@ -179,7 +179,7 @@ * @since 1.4 */ - @Native public final static int SO_BROADCAST = 0x0020; + @Native public static final int SO_BROADCAST = 0x0020; /** Set which outgoing interface on which to send multicast packets. * Useful on hosts with multiple network interfaces, where applications @@ -191,7 +191,7 @@ * @see MulticastSocket#getInterface() */ - @Native public final static int IP_MULTICAST_IF = 0x10; + @Native public static final int IP_MULTICAST_IF = 0x10; /** Same as above. This option is introduced so that the behaviour * with IP_MULTICAST_IF will be kept the same as before, while @@ -203,7 +203,7 @@ * @see MulticastSocket#getNetworkInterface() * @since 1.4 */ - @Native public final static int IP_MULTICAST_IF2 = 0x1f; + @Native public static final int IP_MULTICAST_IF2 = 0x1f; /** * This option enables or disables local loopback of multicast datagrams. @@ -211,7 +211,7 @@ * @since 1.4 */ - @Native public final static int IP_MULTICAST_LOOP = 0x12; + @Native public static final int IP_MULTICAST_LOOP = 0x12; /** * This option sets the type-of-service or traffic class field @@ -219,7 +219,7 @@ * @since 1.4 */ - @Native public final static int IP_TOS = 0x3; + @Native public static final int IP_TOS = 0x3; /** * Specify a linger-on-close timeout. This option disables/enables @@ -237,7 +237,7 @@ * @see Socket#setSoLinger * @see Socket#getSoLinger */ - @Native public final static int SO_LINGER = 0x0080; + @Native public static final int SO_LINGER = 0x0080; /** Set a timeout on blocking Socket operations: *
@@ -258,7 +258,7 @@
      * @see ServerSocket#setSoTimeout
      * @see DatagramSocket#setSoTimeout
      */
-    @Native public final static int SO_TIMEOUT = 0x1006;
+    @Native public static final int SO_TIMEOUT = 0x1006;
 
     /**
      * Set a hint the size of the underlying buffers used by the
@@ -275,7 +275,7 @@
      * @see DatagramSocket#setSendBufferSize
      * @see DatagramSocket#getSendBufferSize
      */
-    @Native public final static int SO_SNDBUF = 0x1001;
+    @Native public static final int SO_SNDBUF = 0x1001;
 
     /**
      * Set a hint the size of the underlying buffers used by the
@@ -293,7 +293,7 @@
      * @see DatagramSocket#setReceiveBufferSize
      * @see DatagramSocket#getReceiveBufferSize
      */
-    @Native public final static int SO_RCVBUF = 0x1002;
+    @Native public static final int SO_RCVBUF = 0x1002;
 
     /**
      * When the keepalive option is set for a TCP socket and no data
@@ -316,7 +316,7 @@
      * @see Socket#setKeepAlive
      * @see Socket#getKeepAlive
      */
-    @Native public final static int SO_KEEPALIVE = 0x0008;
+    @Native public static final int SO_KEEPALIVE = 0x0008;
 
     /**
      * When the OOBINLINE option is set, any TCP urgent data received on
@@ -327,5 +327,5 @@
      * @see Socket#setOOBInline
      * @see Socket#getOOBInline
      */
-    @Native public final static int SO_OOBINLINE = 0x1003;
+    @Native public static final int SO_OOBINLINE = 0x1003;
 }
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/SocketOutputStream.java
--- a/src/java.base/share/classes/java/net/SocketOutputStream.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/net/SocketOutputStream.java	Fri Sep 18 09:18:17 2015 -0700
@@ -178,6 +178,6 @@
     /**
      * Perform class load-time initializations.
      */
-    private native static void init();
+    private static native void init();
 
 }
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/SocketPermission.java
--- a/src/java.base/share/classes/java/net/SocketPermission.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/net/SocketPermission.java	Fri Sep 18 09:18:17 2015 -0700
@@ -154,32 +154,32 @@
     /**
      * Connect to host:port
      */
-    private final static int CONNECT    = 0x1;
+    private static final int CONNECT    = 0x1;
 
     /**
      * Listen on host:port
      */
-    private final static int LISTEN     = 0x2;
+    private static final int LISTEN     = 0x2;
 
     /**
      * Accept a connection from host:port
      */
-    private final static int ACCEPT     = 0x4;
+    private static final int ACCEPT     = 0x4;
 
     /**
      * Resolve DNS queries
      */
-    private final static int RESOLVE    = 0x8;
+    private static final int RESOLVE    = 0x8;
 
     /**
      * No actions
      */
-    private final static int NONE               = 0x0;
+    private static final int NONE               = 0x0;
 
     /**
      * All actions
      */
-    private final static int ALL        = CONNECT|LISTEN|ACCEPT|RESOLVE;
+    private static final int ALL        = CONNECT|LISTEN|ACCEPT|RESOLVE;
 
     // various port constants
     private static final int PORT_MIN = 0;
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/URI.java
--- a/src/java.base/share/classes/java/net/URI.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/net/URI.java	Fri Sep 18 09:18:17 2015 -0700
@@ -492,15 +492,15 @@
 
     // The remaining fields may be computed on demand
 
-    private volatile transient String schemeSpecificPart;
-    private volatile transient int hash;        // Zero ==> undefined
-
-    private volatile transient String decodedUserInfo = null;
-    private volatile transient String decodedAuthority = null;
-    private volatile transient String decodedPath = null;
-    private volatile transient String decodedQuery = null;
-    private volatile transient String decodedFragment = null;
-    private volatile transient String decodedSchemeSpecificPart = null;
+    private transient volatile String schemeSpecificPart;
+    private transient volatile int hash;        // Zero ==> undefined
+
+    private transient volatile String decodedUserInfo = null;
+    private transient volatile String decodedAuthority = null;
+    private transient volatile String decodedPath = null;
+    private transient volatile String decodedQuery = null;
+    private transient volatile String decodedFragment = null;
+    private transient volatile String decodedSchemeSpecificPart = null;
 
     /**
      * The string form of this URI.
@@ -2175,7 +2175,7 @@
     // This method takes a string argument rather than a char array so that
     // this test can be performed without invoking path.toCharArray().
     //
-    static private int needsNormalization(String path) {
+    private static int needsNormalization(String path) {
         boolean normal = true;
         int ns = 0;                     // Number of segments
         int end = path.length() - 1;    // Index of last char in path
@@ -2232,7 +2232,7 @@
     //   All slashes in path replaced by '\0'
     //   segs[i] == Index of first char in segment i (0 <= i < segs.length)
     //
-    static private void split(char[] path, int[] segs) {
+    private static void split(char[] path, int[] segs) {
         int end = path.length - 1;      // Index of last char in path
         int p = 0;                      // Index of next char in path
         int i = 0;                      // Index of current segment
@@ -2281,7 +2281,7 @@
     // Postconditions:
     //   path[0] .. path[return value] == Resulting path
     //
-    static private int join(char[] path, int[] segs) {
+    private static int join(char[] path, int[] segs) {
         int ns = segs.length;           // Number of segments
         int end = path.length - 1;      // Index of last char in path
         int p = 0;                      // Index of next path char to write
@@ -2645,7 +2645,7 @@
 
     // -- Escaping and encoding --
 
-    private final static char[] hexDigits = {
+    private static final char[] hexDigits = {
         '0', '1', '2', '3', '4', '5', '6', '7',
         '8', '9', 'A', 'B', 'C', 'D', 'E', 'F'
     };
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/URLConnection.java
--- a/src/java.base/share/classes/java/net/URLConnection.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/net/URLConnection.java	Fri Sep 18 09:18:17 2015 -0700
@@ -365,7 +365,7 @@
      * @see #getConnectTimeout()
      * @see #setConnectTimeout(int)
      */
-    abstract public void connect() throws IOException;
+    public abstract void connect() throws IOException;
 
     /**
      * Sets a specified timeout value, in milliseconds, to be used
@@ -1440,7 +1440,7 @@
      * @see        java.io.InputStream#markSupported()
      * @see        java.net.URLConnection#getContentType()
      */
-    static public String guessContentTypeFromStream(InputStream is)
+    public static String guessContentTypeFromStream(InputStream is)
                         throws IOException {
         // If we can't read ahead safely, just give up on guessing
         if (!is.markSupported())
@@ -1605,7 +1605,7 @@
      * method, the stream should have already been checked to be sure it
      * contains Microsoft Structured Storage data.
      */
-    static private boolean checkfpx(InputStream is) throws IOException {
+    private static boolean checkfpx(InputStream is) throws IOException {
 
         /* Test for FlashPix image data in Microsoft Structured Storage format.
          * In general, should do this with calls to an SS implementation.
@@ -1766,7 +1766,7 @@
      * Returns -1, If EOF is reached before len bytes are read, returns 0
      * otherwise
      */
-    static private int readBytes(int c[], int len, InputStream is)
+    private static int readBytes(int c[], int len, InputStream is)
                 throws IOException {
 
         byte buf[] = new byte[len];
@@ -1787,7 +1787,7 @@
      * until either EOF is reached, or the specified
      * number of bytes have been skipped
      */
-    static private long skipForward(InputStream is, long toSkip)
+    private static long skipForward(InputStream is, long toSkip)
                 throws IOException {
 
         long eachSkip = 0;
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/net/URLStreamHandler.java
--- a/src/java.base/share/classes/java/net/URLStreamHandler.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/net/URLStreamHandler.java	Fri Sep 18 09:18:17 2015 -0700
@@ -68,7 +68,7 @@
      * @exception  IOException  if an I/O error occurs while opening the
      *               connection.
      */
-    abstract protected URLConnection openConnection(URL u) throws IOException;
+    protected abstract URLConnection openConnection(URL u) throws IOException;
 
     /**
      * Same as openConnection(URL), except that the connection will be
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/nio/Bits.java
--- a/src/java.base/share/classes/java/nio/Bits.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/nio/Bits.java	Fri Sep 18 09:18:17 2015 -0700
@@ -64,7 +64,7 @@
 
     // -- get/put char --
 
-    static private char makeChar(byte b1, byte b0) {
+    private static char makeChar(byte b1, byte b0) {
         return (char)((b1 << 8) | (b0 & 0xff));
     }
 
@@ -136,7 +136,7 @@
 
     // -- get/put short --
 
-    static private short makeShort(byte b1, byte b0) {
+    private static short makeShort(byte b1, byte b0) {
         return (short)((b1 << 8) | (b0 & 0xff));
     }
 
@@ -208,7 +208,7 @@
 
     // -- get/put int --
 
-    static private int makeInt(byte b3, byte b2, byte b1, byte b0) {
+    private static int makeInt(byte b3, byte b2, byte b1, byte b0) {
         return (((b3       ) << 24) |
                 ((b2 & 0xff) << 16) |
                 ((b1 & 0xff) <<  8) |
@@ -301,7 +301,7 @@
 
     // -- get/put long --
 
-    static private long makeLong(byte b7, byte b6, byte b5, byte b4,
+    private static long makeLong(byte b7, byte b6, byte b5, byte b4,
                                  byte b3, byte b2, byte b1, byte b0)
     {
         return ((((long)b7       ) << 56) |
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/nio/channels/Pipe.java
--- a/src/java.base/share/classes/java/nio/channels/Pipe.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/nio/channels/Pipe.java	Fri Sep 18 09:18:17 2015 -0700
@@ -56,7 +56,7 @@
      *
      * @since 1.4
      */
-    public static abstract class SourceChannel
+    public abstract static class SourceChannel
         extends AbstractSelectableChannel
         implements ReadableByteChannel, ScatteringByteChannel
     {
@@ -90,7 +90,7 @@
      *
      * @since 1.4
      */
-    public static abstract class SinkChannel
+    public abstract static class SinkChannel
         extends AbstractSelectableChannel
         implements WritableByteChannel, GatheringByteChannel
     {
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/nio/charset/CoderResult.java
--- a/src/java.base/share/classes/java/nio/charset/CoderResult.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/nio/charset/CoderResult.java	Fri Sep 18 09:18:17 2015 -0700
@@ -191,7 +191,7 @@
     public static final CoderResult OVERFLOW
         = new CoderResult(CR_OVERFLOW, 0);
 
-    private static abstract class Cache {
+    private abstract static class Cache {
 
         private Map> cache = null;
 
diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java
--- a/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java	Tue Sep 15 15:31:34 2015 +0400
+++ b/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java	Fri Sep 18 09:18:17 2015 -0700
@@ -1,5 +1,5 @@
 /*
- * Copyright (c) 1997, 2013, 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
@@ -70,8 +70,8 @@
  * following standard {@code AlgorithmParameterGenerator} algorithms and
  * keysizes in parentheses:
  * 
    - *
  • {@code DiffieHellman} (1024)
  • - *
  • {@code DSA} (1024)
  • + *
  • {@code DiffieHellman} (1024, 2048, 4096)
  • + *
  • {@code DSA} (1024, 2048)
  • *
* These algorithms are described in the diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/KeyPairGenerator.java --- a/src/java.base/share/classes/java/security/KeyPairGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/KeyPairGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -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 @@ -109,9 +109,9 @@ * following standard {@code KeyPairGenerator} algorithms and keysizes in * parentheses: *
    - *
  • {@code DiffieHellman} (1024)
  • - *
  • {@code DSA} (1024)
  • - *
  • {@code RSA} (1024, 2048)
  • + *
  • {@code DiffieHellman} (1024, 2048, 4096)
  • + *
  • {@code DSA} (1024, 2048)
  • + *
  • {@code RSA} (1024, 2048, 4096)
  • *
* These algorithms are described in the
@@ -547,9 +547,9 @@ private Iterator serviceIterator; - private final static int I_NONE = 1; - private final static int I_SIZE = 2; - private final static int I_PARAMS = 3; + private static final int I_NONE = 1; + private static final int I_SIZE = 2; + private static final int I_PARAMS = 3; private int initType; private int initKeySize; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/KeyStore.java --- a/src/java.base/share/classes/java/security/KeyStore.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/KeyStore.java Fri Sep 18 09:18:17 2015 -0700 @@ -974,7 +974,7 @@ * if no such property exists. * @see java.security.Security security properties */ - public final static String getDefaultType() { + public static final String getDefaultType() { String kstype; kstype = AccessController.doPrivileged(new PrivilegedAction<>() { public String run() { @@ -1811,7 +1811,7 @@ * @see javax.net.ssl.KeyStoreBuilderParameters * @since 1.5 */ - public static abstract class Builder { + public abstract static class Builder { // maximum times to try the callbackhandler if the password is wrong static final int MAX_CALLBACK_TRIES = 3; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/Provider.java --- a/src/java.base/share/classes/java/security/Provider.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/Provider.java Fri Sep 18 09:18:17 2015 -0700 @@ -998,9 +998,9 @@ return new String[] {type, alg}; } - private final static String ALIAS_PREFIX = "Alg.Alias."; - private final static String ALIAS_PREFIX_LOWER = "alg.alias."; - private final static int ALIAS_LENGTH = ALIAS_PREFIX.length(); + private static final String ALIAS_PREFIX = "Alg.Alias."; + private static final String ALIAS_PREFIX_LOWER = "alg.alias."; + private static final int ALIAS_LENGTH = ALIAS_PREFIX.length(); private void parseLegacyPut(String name, String value) { if (name.toLowerCase(ENGLISH).startsWith(ALIAS_PREFIX_LOWER)) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/SecureRandom.java --- a/src/java.base/share/classes/java/security/SecureRandom.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/SecureRandom.java Fri Sep 18 09:18:17 2015 -0700 @@ -424,7 +424,7 @@ * * @see #getSeed */ - synchronized public void setSeed(byte[] seed) { + public synchronized void setSeed(byte[] seed) { secureRandomSpi.engineSetSeed(seed); } @@ -465,7 +465,7 @@ * @param bytes the array to be filled in with random bytes. */ @Override - synchronized public void nextBytes(byte[] bytes) { + public synchronized void nextBytes(byte[] bytes) { secureRandomSpi.engineNextBytes(bytes); } @@ -484,7 +484,7 @@ * of pseudo-random bits (right justified, with leading zeros). */ @Override - final protected int next(int numBits) { + protected final int next(int numBits) { int numBytes = (numBits+7)/8; byte[] b = new byte[numBytes]; int next = 0; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/Signature.java --- a/src/java.base/share/classes/java/security/Signature.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/Signature.java Fri Sep 18 09:18:17 2015 -0700 @@ -102,6 +102,7 @@ * following standard {@code Signature} algorithms: *
    *
  • {@code SHA1withDSA}
  • + *
  • {@code SHA256withDSA}
  • *
  • {@code SHA1withRSA}
  • *
  • {@code SHA256withRSA}
  • *
@@ -140,19 +141,19 @@ * Possible {@link #state} value, signifying that * this signature object has not yet been initialized. */ - protected final static int UNINITIALIZED = 0; + protected static final int UNINITIALIZED = 0; /** * Possible {@link #state} value, signifying that * this signature object has been initialized for signing. */ - protected final static int SIGN = 2; + protected static final int SIGN = 2; /** * Possible {@link #state} value, signifying that * this signature object has been initialized for verification. */ - protected final static int VERIFY = 3; + protected static final int VERIFY = 3; /** * Current state of this signature object. @@ -173,13 +174,13 @@ } // name of the special signature alg - private final static String RSA_SIGNATURE = "NONEwithRSA"; + private static final String RSA_SIGNATURE = "NONEwithRSA"; // name of the equivalent cipher alg - private final static String RSA_CIPHER = "RSA/ECB/PKCS1Padding"; + private static final String RSA_CIPHER = "RSA/ECB/PKCS1Padding"; // all the services we need to lookup for compatibility with Cipher - private final static List rsaIds = Arrays.asList( + private static final List rsaIds = Arrays.asList( new ServiceId[] { new ServiceId("Signature", "NONEwithRSA"), new ServiceId("Cipher", "RSA/ECB/PKCS1Padding"), @@ -262,7 +263,7 @@ return sig; } - private final static Map signatureInfo; + private static final Map signatureInfo; static { signatureInfo = new ConcurrentHashMap<>(); @@ -1146,9 +1147,9 @@ } } - private final static int I_PUB = 1; - private final static int I_PRIV = 2; - private final static int I_PRIV_SR = 3; + private static final int I_PUB = 1; + private static final int I_PRIV = 2; + private static final int I_PRIV_SR = 3; private void init(SignatureSpi spi, int type, Key key, SecureRandom random) throws InvalidKeyException { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/cert/CertPathBuilder.java --- a/src/java.base/share/classes/java/security/cert/CertPathBuilder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/cert/CertPathBuilder.java Fri Sep 18 09:18:17 2015 -0700 @@ -299,7 +299,7 @@ * by the {@code certpathbuilder.type} security property, or the string * {@literal "PKIX"} if no such property exists. */ - public final static String getDefaultType() { + public static final String getDefaultType() { String cpbtype = AccessController.doPrivileged(new PrivilegedAction<>() { public String run() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/cert/CertPathHelperImpl.java --- a/src/java.base/share/classes/java/security/cert/CertPathHelperImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/cert/CertPathHelperImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -49,7 +49,7 @@ * the methods in this class. This ensures that the helper is initialized * prior to a tunneled call from the Sun provider. */ - synchronized static void initialize() { + static synchronized void initialize() { if (CertPathHelper.instance == null) { CertPathHelper.instance = new CertPathHelperImpl(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/cert/CertPathValidator.java --- a/src/java.base/share/classes/java/security/cert/CertPathValidator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/cert/CertPathValidator.java Fri Sep 18 09:18:17 2015 -0700 @@ -311,7 +311,7 @@ * by the {@code certpathvalidator.type} security property, or the string * {@literal "PKIX"} if no such property exists. */ - public final static String getDefaultType() { + public static final String getDefaultType() { String cpvtype = AccessController.doPrivileged(new PrivilegedAction<>() { public String run() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/cert/CertStore.java --- a/src/java.base/share/classes/java/security/cert/CertStore.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/cert/CertStore.java Fri Sep 18 09:18:17 2015 -0700 @@ -407,7 +407,7 @@ * {@code certstore.type} security property, or the string * {@literal "LDAP"} if no such property exists. */ - public final static String getDefaultType() { + public static final String getDefaultType() { String cstype; cstype = AccessController.doPrivileged(new PrivilegedAction<>() { public String run() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/security/cert/X509CertSelector.java --- a/src/java.base/share/classes/java/security/cert/X509CertSelector.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/security/cert/X509CertSelector.java Fri Sep 18 09:18:17 2015 -0700 @@ -87,7 +87,7 @@ private static final Debug debug = Debug.getInstance("certpath"); - private final static ObjectIdentifier ANY_EXTENDED_KEY_USAGE = + private static final ObjectIdentifier ANY_EXTENDED_KEY_USAGE = ObjectIdentifier.newInternal(new int[] {2, 5, 29, 37, 0}); static { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/AttributedString.java --- a/src/java.base/share/classes/java/text/AttributedString.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/AttributedString.java Fri Sep 18 09:18:17 2015 -0700 @@ -667,7 +667,7 @@ } // returns whether the two objects are either both null or equal - private final static boolean valuesMatch(Object value1, Object value2) { + private static final boolean valuesMatch(Object value1, Object value2) { if (value1 == null) { return value2 == null; } else { @@ -732,7 +732,7 @@ // the iterator class associated with this string class - final private class AttributedStringIterator implements AttributedCharacterIterator { + private final class AttributedStringIterator implements AttributedCharacterIterator { // note on synchronization: // we don't synchronize on the iterator, assuming that an iterator is only used in one thread. @@ -1045,7 +1045,7 @@ // the map class associated with this string class, giving access to the attributes of one run - final private class AttributeMap extends AbstractMap { + private final class AttributeMap extends AbstractMap { int runIndex; int beginIndex; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/CollationElementIterator.java --- a/src/java.base/share/classes/java/text/CollationElementIterator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/CollationElementIterator.java Fri Sep 18 09:18:17 2015 -0700 @@ -111,7 +111,7 @@ * Null order which indicates the end of string is reached by the * cursor. */ - public final static int NULLORDER = 0xffffffff; + public static final int NULLORDER = 0xffffffff; /** * CollationElementIterator constructor. This takes the source string and @@ -358,7 +358,7 @@ * @param order the collation element * @return the element's primary component */ - public final static int primaryOrder(int order) + public static final int primaryOrder(int order) { order &= RBCollationTables.PRIMARYORDERMASK; return (order >>> RBCollationTables.PRIMARYORDERSHIFT); @@ -368,7 +368,7 @@ * @param order the collation element * @return the element's secondary component */ - public final static short secondaryOrder(int order) + public static final short secondaryOrder(int order) { order = order & RBCollationTables.SECONDARYORDERMASK; return ((short)(order >> RBCollationTables.SECONDARYORDERSHIFT)); @@ -378,7 +378,7 @@ * @param order the collation element * @return the element's tertiary component */ - public final static short tertiaryOrder(int order) + public static final short tertiaryOrder(int order) { return ((short)(order &= RBCollationTables.TERTIARYORDERMASK)); } @@ -540,14 +540,14 @@ * Determine if a character is a Thai vowel (which sorts after * its base consonant). */ - private final static boolean isThaiPreVowel(int ch) { + private static final boolean isThaiPreVowel(int ch) { return (ch >= 0x0e40) && (ch <= 0x0e44); } /** * Determine if a character is a Thai base consonant */ - private final static boolean isThaiBaseConsonant(int ch) { + private static final boolean isThaiBaseConsonant(int ch) { return (ch >= 0x0e01) && (ch <= 0x0e2e); } @@ -555,14 +555,14 @@ * Determine if a character is a Lao vowel (which sorts after * its base consonant). */ - private final static boolean isLaoPreVowel(int ch) { + private static final boolean isLaoPreVowel(int ch) { return (ch >= 0x0ec0) && (ch <= 0x0ec4); } /** * Determine if a character is a Lao base consonant */ - private final static boolean isLaoBaseConsonant(int ch) { + private static final boolean isLaoBaseConsonant(int ch) { return (ch >= 0x0e81) && (ch <= 0x0eae); } @@ -634,7 +634,7 @@ * Check if a comparison order is ignorable. * @return true if a character is ignorable, false otherwise. */ - final static boolean isIgnorable(int order) + static final boolean isIgnorable(int order) { return ((primaryOrder(order) == 0) ? true : false); } @@ -770,7 +770,7 @@ return order; } - final static int UNMAPPEDCHARVALUE = 0x7FFF0000; + static final int UNMAPPEDCHARVALUE = 0x7FFF0000; private NormalizerBase text = null; private int[] buffer = null; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/CollationKey.java --- a/src/java.base/share/classes/java/text/CollationKey.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/CollationKey.java Fri Sep 18 09:18:17 2015 -0700 @@ -108,7 +108,7 @@ * zero if this is greater than target. * @see java.text.Collator#compare */ - abstract public int compareTo(CollationKey target); + public abstract int compareTo(CollationKey target); /** * Returns the String that this CollationKey represents. @@ -128,7 +128,7 @@ * * @return a byte array representation of the CollationKey */ - abstract public byte[] toByteArray(); + public abstract byte[] toByteArray(); /** @@ -145,5 +145,5 @@ this.source = source; } - final private String source; + private final String source; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/Collator.java --- a/src/java.base/share/classes/java/text/Collator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/Collator.java Fri Sep 18 09:18:17 2015 -0700 @@ -136,7 +136,7 @@ * @see java.text.Collator#setStrength * @see java.text.Collator#getStrength */ - public final static int PRIMARY = 0; + public static final int PRIMARY = 0; /** * Collator strength value. When set, only SECONDARY and above differences are * considered significant during comparison. The assignment of strengths @@ -146,7 +146,7 @@ * @see java.text.Collator#setStrength * @see java.text.Collator#getStrength */ - public final static int SECONDARY = 1; + public static final int SECONDARY = 1; /** * Collator strength value. When set, only TERTIARY and above differences are * considered significant during comparison. The assignment of strengths @@ -155,7 +155,7 @@ * @see java.text.Collator#setStrength * @see java.text.Collator#getStrength */ - public final static int TERTIARY = 2; + public static final int TERTIARY = 2; /** * Collator strength value. When set, all differences are @@ -168,7 +168,7 @@ * (A, combining-grave) will be considered significant at the IDENTICAL * level if decomposition is set to NO_DECOMPOSITION. */ - public final static int IDENTICAL = 3; + public static final int IDENTICAL = 3; /** * Decomposition mode value. With NO_DECOMPOSITION @@ -178,7 +178,7 @@ * @see java.text.Collator#getDecomposition * @see java.text.Collator#setDecomposition */ - public final static int NO_DECOMPOSITION = 0; + public static final int NO_DECOMPOSITION = 0; /** * Decomposition mode value. With CANONICAL_DECOMPOSITION @@ -193,7 +193,7 @@ * @see java.text.Collator#getDecomposition * @see java.text.Collator#setDecomposition */ - public final static int CANONICAL_DECOMPOSITION = 1; + public static final int CANONICAL_DECOMPOSITION = 1; /** * Decomposition mode value. With FULL_DECOMPOSITION @@ -212,7 +212,7 @@ * @see java.text.Collator#getDecomposition * @see java.text.Collator#setDecomposition */ - public final static int FULL_DECOMPOSITION = 2; + public static final int FULL_DECOMPOSITION = 2; /** * Gets the Collator for the current default locale. @@ -472,7 +472,7 @@ * Generates the hash code for this Collator. */ @Override - abstract public int hashCode(); + public abstract int hashCode(); /** * Default constructor. This constructor is @@ -499,17 +499,17 @@ * string in the compare() method. * @see java.text.Collator#compare */ - final static int LESS = -1; + static final int LESS = -1; /** * EQUAL is returned if source string is compared to be equal to target * string in the compare() method. * @see java.text.Collator#compare */ - final static int EQUAL = 0; + static final int EQUAL = 0; /** * GREATER is returned if source string is compared to be greater than * target string in the compare() method. * @see java.text.Collator#compare */ - final static int GREATER = 1; + static final int GREATER = 1; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/DateFormat.java --- a/src/java.base/share/classes/java/text/DateFormat.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/DateFormat.java Fri Sep 18 09:18:17 2015 -0700 @@ -175,100 +175,100 @@ * Useful constant for ERA field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int ERA_FIELD = 0; + public static final int ERA_FIELD = 0; /** * Useful constant for YEAR field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int YEAR_FIELD = 1; + public static final int YEAR_FIELD = 1; /** * Useful constant for MONTH field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int MONTH_FIELD = 2; + public static final int MONTH_FIELD = 2; /** * Useful constant for DATE field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int DATE_FIELD = 3; + public static final int DATE_FIELD = 3; /** * Useful constant for one-based HOUR_OF_DAY field alignment. * Used in FieldPosition of date/time formatting. * HOUR_OF_DAY1_FIELD is used for the one-based 24-hour clock. * For example, 23:59 + 01:00 results in 24:59. */ - public final static int HOUR_OF_DAY1_FIELD = 4; + public static final int HOUR_OF_DAY1_FIELD = 4; /** * Useful constant for zero-based HOUR_OF_DAY field alignment. * Used in FieldPosition of date/time formatting. * HOUR_OF_DAY0_FIELD is used for the zero-based 24-hour clock. * For example, 23:59 + 01:00 results in 00:59. */ - public final static int HOUR_OF_DAY0_FIELD = 5; + public static final int HOUR_OF_DAY0_FIELD = 5; /** * Useful constant for MINUTE field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int MINUTE_FIELD = 6; + public static final int MINUTE_FIELD = 6; /** * Useful constant for SECOND field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int SECOND_FIELD = 7; + public static final int SECOND_FIELD = 7; /** * Useful constant for MILLISECOND field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int MILLISECOND_FIELD = 8; + public static final int MILLISECOND_FIELD = 8; /** * Useful constant for DAY_OF_WEEK field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int DAY_OF_WEEK_FIELD = 9; + public static final int DAY_OF_WEEK_FIELD = 9; /** * Useful constant for DAY_OF_YEAR field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int DAY_OF_YEAR_FIELD = 10; + public static final int DAY_OF_YEAR_FIELD = 10; /** * Useful constant for DAY_OF_WEEK_IN_MONTH field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int DAY_OF_WEEK_IN_MONTH_FIELD = 11; + public static final int DAY_OF_WEEK_IN_MONTH_FIELD = 11; /** * Useful constant for WEEK_OF_YEAR field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int WEEK_OF_YEAR_FIELD = 12; + public static final int WEEK_OF_YEAR_FIELD = 12; /** * Useful constant for WEEK_OF_MONTH field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int WEEK_OF_MONTH_FIELD = 13; + public static final int WEEK_OF_MONTH_FIELD = 13; /** * Useful constant for AM_PM field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int AM_PM_FIELD = 14; + public static final int AM_PM_FIELD = 14; /** * Useful constant for one-based HOUR field alignment. * Used in FieldPosition of date/time formatting. * HOUR1_FIELD is used for the one-based 12-hour clock. * For example, 11:30 PM + 1 hour results in 12:30 AM. */ - public final static int HOUR1_FIELD = 15; + public static final int HOUR1_FIELD = 15; /** * Useful constant for zero-based HOUR field alignment. * Used in FieldPosition of date/time formatting. * HOUR0_FIELD is used for the zero-based 12-hour clock. * For example, 11:30 PM + 1 hour results in 00:30 AM. */ - public final static int HOUR0_FIELD = 16; + public static final int HOUR0_FIELD = 16; /** * Useful constant for TIMEZONE field alignment. * Used in FieldPosition of date/time formatting. */ - public final static int TIMEZONE_FIELD = 17; + public static final int TIMEZONE_FIELD = 17; // Proclaim serial compatibility with 1.1 FCS private static final long serialVersionUID = 7218322306649953788L; @@ -455,7 +455,7 @@ * @see java.util.Locale.Category#FORMAT * @return a time formatter. */ - public final static DateFormat getTimeInstance() + public static final DateFormat getTimeInstance() { return get(DEFAULT, 0, 1, Locale.getDefault(Locale.Category.FORMAT)); } @@ -472,7 +472,7 @@ * SHORT for "h:mm a" in the US locale. * @return a time formatter. */ - public final static DateFormat getTimeInstance(int style) + public static final DateFormat getTimeInstance(int style) { return get(style, 0, 1, Locale.getDefault(Locale.Category.FORMAT)); } @@ -485,7 +485,7 @@ * @param aLocale the given locale. * @return a time formatter. */ - public final static DateFormat getTimeInstance(int style, + public static final DateFormat getTimeInstance(int style, Locale aLocale) { return get(style, 0, 1, aLocale); @@ -501,7 +501,7 @@ * @see java.util.Locale.Category#FORMAT * @return a date formatter. */ - public final static DateFormat getDateInstance() + public static final DateFormat getDateInstance() { return get(0, DEFAULT, 2, Locale.getDefault(Locale.Category.FORMAT)); } @@ -518,7 +518,7 @@ * SHORT for "M/d/yy" in the US locale. * @return a date formatter. */ - public final static DateFormat getDateInstance(int style) + public static final DateFormat getDateInstance(int style) { return get(0, style, 2, Locale.getDefault(Locale.Category.FORMAT)); } @@ -531,7 +531,7 @@ * @param aLocale the given locale. * @return a date formatter. */ - public final static DateFormat getDateInstance(int style, + public static final DateFormat getDateInstance(int style, Locale aLocale) { return get(0, style, 2, aLocale); @@ -547,7 +547,7 @@ * @see java.util.Locale.Category#FORMAT * @return a date/time formatter. */ - public final static DateFormat getDateTimeInstance() + public static final DateFormat getDateTimeInstance() { return get(DEFAULT, DEFAULT, 3, Locale.getDefault(Locale.Category.FORMAT)); } @@ -566,7 +566,7 @@ * SHORT for "h:mm a" in the US locale. * @return a date/time formatter. */ - public final static DateFormat getDateTimeInstance(int dateStyle, + public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle) { return get(timeStyle, dateStyle, 3, Locale.getDefault(Locale.Category.FORMAT)); @@ -580,7 +580,7 @@ * @param aLocale the given locale. * @return a date/time formatter. */ - public final static DateFormat + public static final DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale aLocale) { return get(timeStyle, dateStyle, 3, aLocale); @@ -592,7 +592,7 @@ * * @return a date/time formatter */ - public final static DateFormat getInstance() { + public static final DateFormat getInstance() { return getDateTimeInstance(SHORT, SHORT); } @@ -934,107 +934,107 @@ /** * Constant identifying the era field. */ - public final static Field ERA = new Field("era", Calendar.ERA); + public static final Field ERA = new Field("era", Calendar.ERA); /** * Constant identifying the year field. */ - public final static Field YEAR = new Field("year", Calendar.YEAR); + public static final Field YEAR = new Field("year", Calendar.YEAR); /** * Constant identifying the month field. */ - public final static Field MONTH = new Field("month", Calendar.MONTH); + public static final Field MONTH = new Field("month", Calendar.MONTH); /** * Constant identifying the day of month field. */ - public final static Field DAY_OF_MONTH = new + public static final Field DAY_OF_MONTH = new Field("day of month", Calendar.DAY_OF_MONTH); /** * Constant identifying the hour of day field, where the legal values * are 1 to 24. */ - public final static Field HOUR_OF_DAY1 = new Field("hour of day 1",-1); + public static final Field HOUR_OF_DAY1 = new Field("hour of day 1",-1); /** * Constant identifying the hour of day field, where the legal values * are 0 to 23. */ - public final static Field HOUR_OF_DAY0 = new + public static final Field HOUR_OF_DAY0 = new Field("hour of day", Calendar.HOUR_OF_DAY); /** * Constant identifying the minute field. */ - public final static Field MINUTE =new Field("minute", Calendar.MINUTE); + public static final Field MINUTE =new Field("minute", Calendar.MINUTE); /** * Constant identifying the second field. */ - public final static Field SECOND =new Field("second", Calendar.SECOND); + public static final Field SECOND =new Field("second", Calendar.SECOND); /** * Constant identifying the millisecond field. */ - public final static Field MILLISECOND = new + public static final Field MILLISECOND = new Field("millisecond", Calendar.MILLISECOND); /** * Constant identifying the day of week field. */ - public final static Field DAY_OF_WEEK = new + public static final Field DAY_OF_WEEK = new Field("day of week", Calendar.DAY_OF_WEEK); /** * Constant identifying the day of year field. */ - public final static Field DAY_OF_YEAR = new + public static final Field DAY_OF_YEAR = new Field("day of year", Calendar.DAY_OF_YEAR); /** * Constant identifying the day of week field. */ - public final static Field DAY_OF_WEEK_IN_MONTH = + public static final Field DAY_OF_WEEK_IN_MONTH = new Field("day of week in month", Calendar.DAY_OF_WEEK_IN_MONTH); /** * Constant identifying the week of year field. */ - public final static Field WEEK_OF_YEAR = new + public static final Field WEEK_OF_YEAR = new Field("week of year", Calendar.WEEK_OF_YEAR); /** * Constant identifying the week of month field. */ - public final static Field WEEK_OF_MONTH = new + public static final Field WEEK_OF_MONTH = new Field("week of month", Calendar.WEEK_OF_MONTH); /** * Constant identifying the time of day indicator * (e.g. "a.m." or "p.m.") field. */ - public final static Field AM_PM = new + public static final Field AM_PM = new Field("am pm", Calendar.AM_PM); /** * Constant identifying the hour field, where the legal values are * 1 to 12. */ - public final static Field HOUR1 = new Field("hour 1", -1); + public static final Field HOUR1 = new Field("hour 1", -1); /** * Constant identifying the hour field, where the legal values are * 0 to 11. */ - public final static Field HOUR0 = new + public static final Field HOUR0 = new Field("hour", Calendar.HOUR); /** * Constant identifying the time zone field. */ - public final static Field TIME_ZONE = new Field("time zone", -1); + public static final Field TIME_ZONE = new Field("time zone", -1); } } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/MessageFormat.java --- a/src/java.base/share/classes/java/text/MessageFormat.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/MessageFormat.java Fri Sep 18 09:18:17 2015 -0700 @@ -1168,7 +1168,7 @@ * indicating the index in the arguments array of the * argument from which the text was generated. */ - public final static Field ARGUMENT = + public static final Field ARGUMENT = new Field("message argument field"); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/NumberFormat.java --- a/src/java.base/share/classes/java/text/NumberFormat.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/NumberFormat.java Fri Sep 18 09:18:17 2015 -0700 @@ -425,7 +425,7 @@ * @return the {@code NumberFormat} instance for general-purpose number * formatting */ - public final static NumberFormat getInstance() { + public static final NumberFormat getInstance() { return getInstance(Locale.getDefault(Locale.Category.FORMAT), NUMBERSTYLE); } @@ -454,7 +454,7 @@ * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT */ - public final static NumberFormat getNumberInstance() { + public static final NumberFormat getNumberInstance() { return getInstance(Locale.getDefault(Locale.Category.FORMAT), NUMBERSTYLE); } @@ -487,7 +487,7 @@ * @return a number format for integer values * @since 1.4 */ - public final static NumberFormat getIntegerInstance() { + public static final NumberFormat getIntegerInstance() { return getInstance(Locale.getDefault(Locale.Category.FORMAT), INTEGERSTYLE); } @@ -519,7 +519,7 @@ * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT */ - public final static NumberFormat getCurrencyInstance() { + public static final NumberFormat getCurrencyInstance() { return getInstance(Locale.getDefault(Locale.Category.FORMAT), CURRENCYSTYLE); } @@ -544,7 +544,7 @@ * @see java.util.Locale#getDefault(java.util.Locale.Category) * @see java.util.Locale.Category#FORMAT */ - public final static NumberFormat getPercentInstance() { + public static final NumberFormat getPercentInstance() { return getInstance(Locale.getDefault(Locale.Category.FORMAT), PERCENTSTYLE); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/RBCollationTables.java --- a/src/java.base/share/classes/java/text/RBCollationTables.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/RBCollationTables.java Fri Sep 18 09:18:17 2015 -0700 @@ -258,7 +258,7 @@ } } - final static int getEntry(Vector list, String name, boolean fwd) { + static final int getEntry(Vector list, String name, boolean fwd) { for (int i = 0; i < list.size(); i++) { EntryPair pair = list.elementAt(i); if (pair.fwd == fwd && pair.entryName.equals(name)) { @@ -272,17 +272,17 @@ // constants // ============================================================== //sherman/Todo: is the value big enough????? - final static int EXPANDCHARINDEX = 0x7E000000; // Expand index follows - final static int CONTRACTCHARINDEX = 0x7F000000; // contract indexes follow - final static int UNMAPPED = 0xFFFFFFFF; + static final int EXPANDCHARINDEX = 0x7E000000; // Expand index follows + static final int CONTRACTCHARINDEX = 0x7F000000; // contract indexes follow + static final int UNMAPPED = 0xFFFFFFFF; - final static int PRIMARYORDERMASK = 0xffff0000; - final static int SECONDARYORDERMASK = 0x0000ff00; - final static int TERTIARYORDERMASK = 0x000000ff; - final static int PRIMARYDIFFERENCEONLY = 0xffff0000; - final static int SECONDARYDIFFERENCEONLY = 0xffffff00; - final static int PRIMARYORDERSHIFT = 16; - final static int SECONDARYORDERSHIFT = 8; + static final int PRIMARYORDERMASK = 0xffff0000; + static final int SECONDARYORDERMASK = 0x0000ff00; + static final int TERTIARYORDERMASK = 0x000000ff; + static final int PRIMARYDIFFERENCEONLY = 0xffff0000; + static final int SECONDARYDIFFERENCEONLY = 0xffffff00; + static final int PRIMARYORDERSHIFT = 16; + static final int SECONDARYORDERSHIFT = 8; // ============================================================== // instance variables diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/RBTableBuilder.java --- a/src/java.base/share/classes/java/text/RBTableBuilder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/RBTableBuilder.java Fri Sep 18 09:18:17 2015 -0700 @@ -583,14 +583,14 @@ // ============================================================== // constants // ============================================================== - final static int CHARINDEX = 0x70000000; // need look up in .commit() + static final int CHARINDEX = 0x70000000; // need look up in .commit() - private final static int IGNORABLEMASK = 0x0000ffff; - private final static int PRIMARYORDERINCREMENT = 0x00010000; - private final static int SECONDARYORDERINCREMENT = 0x00000100; - private final static int TERTIARYORDERINCREMENT = 0x00000001; - private final static int INITIALTABLESIZE = 20; - private final static int MAXKEYSIZE = 5; + private static final int IGNORABLEMASK = 0x0000ffff; + private static final int PRIMARYORDERINCREMENT = 0x00010000; + private static final int SECONDARYORDERINCREMENT = 0x00000100; + private static final int TERTIARYORDERINCREMENT = 0x00000001; + private static final int INITIALTABLESIZE = 20; + private static final int MAXKEYSIZE = 5; // ============================================================== // instance variables diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/RuleBasedCollator.java --- a/src/java.base/share/classes/java/text/RuleBasedCollator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/RuleBasedCollator.java Fri Sep 18 09:18:17 2015 -0700 @@ -750,12 +750,12 @@ // private // ============================================================== - final static int CHARINDEX = 0x70000000; // need look up in .commit() - final static int EXPANDCHARINDEX = 0x7E000000; // Expand index follows - final static int CONTRACTCHARINDEX = 0x7F000000; // contract indexes follow - final static int UNMAPPED = 0xFFFFFFFF; + static final int CHARINDEX = 0x70000000; // need look up in .commit() + static final int EXPANDCHARINDEX = 0x7E000000; // Expand index follows + static final int CONTRACTCHARINDEX = 0x7F000000; // contract indexes follow + static final int UNMAPPED = 0xFFFFFFFF; - private final static int COLLATIONKEYOFFSET = 1; + private static final int COLLATIONKEYOFFSET = 1; private RBCollationTables tables = null; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/text/SimpleDateFormat.java --- a/src/java.base/share/classes/java/text/SimpleDateFormat.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/text/SimpleDateFormat.java Fri Sep 18 09:18:17 2015 -0700 @@ -456,42 +456,42 @@ * Saved numberFormat and pattern. * @see SimpleDateFormat#checkNegativeNumberExpression */ - transient private NumberFormat originalNumberFormat; - transient private String originalNumberPattern; + private transient NumberFormat originalNumberFormat; + private transient String originalNumberPattern; /** * The minus sign to be used with format and parse. */ - transient private char minusSign = '-'; + private transient char minusSign = '-'; /** * True when a negative sign follows a number. * (True as default in Arabic.) */ - transient private boolean hasFollowingMinusSign = false; + private transient boolean hasFollowingMinusSign = false; /** * True if standalone form needs to be used. */ - transient private boolean forceStandaloneForm = false; + private transient boolean forceStandaloneForm = false; /** * The compiled pattern. */ - transient private char[] compiledPattern; + private transient char[] compiledPattern; /** * Tags for the compiled pattern. */ - private final static int TAG_QUOTE_ASCII_CHAR = 100; - private final static int TAG_QUOTE_CHARS = 101; + private static final int TAG_QUOTE_ASCII_CHAR = 100; + private static final int TAG_QUOTE_CHARS = 101; /** * Locale dependent digit zero. * @see #zeroPaddingNumber * @see java.text.DecimalFormatSymbols#getZeroDigit */ - transient private char zeroDigit; + private transient char zeroDigit; /** * The symbols used by this formatter for week names, month names, @@ -510,7 +510,7 @@ */ private Date defaultCenturyStart; - transient private int defaultCenturyStartYear; + private transient int defaultCenturyStartYear; private static final int MILLIS_PER_MINUTE = 60 * 1000; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/AbstractList.java --- a/src/java.base/share/classes/java/util/AbstractList.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/AbstractList.java Fri Sep 18 09:18:17 2015 -0700 @@ -115,7 +115,7 @@ * * @throws IndexOutOfBoundsException {@inheritDoc} */ - abstract public E get(int index); + public abstract E get(int index); /** * {@inheritDoc} diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/BitSet.java --- a/src/java.base/share/classes/java/util/BitSet.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/BitSet.java Fri Sep 18 09:18:17 2015 -0700 @@ -68,9 +68,9 @@ * a long, which consists of 64 bits, requiring 6 address bits. * The choice of word size is determined purely by performance concerns. */ - private final static int ADDRESS_BITS_PER_WORD = 6; - private final static int BITS_PER_WORD = 1 << ADDRESS_BITS_PER_WORD; - private final static int BIT_INDEX_MASK = BITS_PER_WORD - 1; + private static final int ADDRESS_BITS_PER_WORD = 6; + private static final int BITS_PER_WORD = 1 << ADDRESS_BITS_PER_WORD; + private static final int BIT_INDEX_MASK = BITS_PER_WORD - 1; /* Used to shift left or right for a partial word mask */ private static final long WORD_MASK = 0xffffffffffffffffL; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Calendar.java --- a/src/java.base/share/classes/java/util/Calendar.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Calendar.java Fri Sep 18 09:18:17 2015 -0700 @@ -370,13 +370,13 @@ * @see GregorianCalendar#AD * @see GregorianCalendar#BC */ - public final static int ERA = 0; + public static final int ERA = 0; /** * Field number for get and set indicating the * year. This is a calendar-specific value; see subclass documentation. */ - public final static int YEAR = 1; + public static final int YEAR = 1; /** * Field number for get and set indicating the @@ -399,7 +399,7 @@ * @see #DECEMBER * @see #UNDECIMBER */ - public final static int MONTH = 2; + public static final int MONTH = 2; /** * Field number for get and set indicating the @@ -412,7 +412,7 @@ * @see #getFirstDayOfWeek * @see #getMinimalDaysInFirstWeek */ - public final static int WEEK_OF_YEAR = 3; + public static final int WEEK_OF_YEAR = 3; /** * Field number for get and set indicating the @@ -425,7 +425,7 @@ * @see #getFirstDayOfWeek * @see #getMinimalDaysInFirstWeek */ - public final static int WEEK_OF_MONTH = 4; + public static final int WEEK_OF_MONTH = 4; /** * Field number for get and set indicating the @@ -434,7 +434,7 @@ * * @see #DAY_OF_MONTH */ - public final static int DATE = 5; + public static final int DATE = 5; /** * Field number for get and set indicating the @@ -443,13 +443,13 @@ * * @see #DATE */ - public final static int DAY_OF_MONTH = 5; + public static final int DAY_OF_MONTH = 5; /** * Field number for get and set indicating the day * number within the current year. The first day of the year has value 1. */ - public final static int DAY_OF_YEAR = 6; + public static final int DAY_OF_YEAR = 6; /** * Field number for get and set indicating the day @@ -465,7 +465,7 @@ * @see #FRIDAY * @see #SATURDAY */ - public final static int DAY_OF_WEEK = 7; + public static final int DAY_OF_WEEK = 7; /** * Field number for get and set indicating the @@ -490,7 +490,7 @@ * @see #DAY_OF_WEEK * @see #WEEK_OF_MONTH */ - public final static int DAY_OF_WEEK_IN_MONTH = 8; + public static final int DAY_OF_WEEK_IN_MONTH = 8; /** * Field number for get and set indicating @@ -501,7 +501,7 @@ * @see #PM * @see #HOUR */ - public final static int AM_PM = 9; + public static final int AM_PM = 9; /** * Field number for get and set indicating the @@ -512,7 +512,7 @@ * @see #AM_PM * @see #HOUR_OF_DAY */ - public final static int HOUR = 10; + public static final int HOUR = 10; /** * Field number for get and set indicating the @@ -521,28 +521,28 @@ * * @see #HOUR */ - public final static int HOUR_OF_DAY = 11; + public static final int HOUR_OF_DAY = 11; /** * Field number for get and set indicating the * minute within the hour. * E.g., at 10:04:15.250 PM the MINUTE is 4. */ - public final static int MINUTE = 12; + public static final int MINUTE = 12; /** * Field number for get and set indicating the * second within the minute. * E.g., at 10:04:15.250 PM the SECOND is 15. */ - public final static int SECOND = 13; + public static final int SECOND = 13; /** * Field number for get and set indicating the * millisecond within the second. * E.g., at 10:04:15.250 PM the MILLISECOND is 250. */ - public final static int MILLISECOND = 14; + public static final int MILLISECOND = 14; /** * Field number for get and set @@ -553,7 +553,7 @@ * TimeZone implementation subclass supports * historical GMT offset changes. */ - public final static int ZONE_OFFSET = 15; + public static final int ZONE_OFFSET = 15; /** * Field number for get and set indicating the @@ -564,146 +564,146 @@ * TimeZone implementation subclass supports * historical Daylight Saving Time schedule changes. */ - public final static int DST_OFFSET = 16; + public static final int DST_OFFSET = 16; /** * The number of distinct fields recognized by get and set. * Field numbers range from 0..FIELD_COUNT-1. */ - public final static int FIELD_COUNT = 17; + public static final int FIELD_COUNT = 17; /** * Value of the {@link #DAY_OF_WEEK} field indicating * Sunday. */ - public final static int SUNDAY = 1; + public static final int SUNDAY = 1; /** * Value of the {@link #DAY_OF_WEEK} field indicating * Monday. */ - public final static int MONDAY = 2; + public static final int MONDAY = 2; /** * Value of the {@link #DAY_OF_WEEK} field indicating * Tuesday. */ - public final static int TUESDAY = 3; + public static final int TUESDAY = 3; /** * Value of the {@link #DAY_OF_WEEK} field indicating * Wednesday. */ - public final static int WEDNESDAY = 4; + public static final int WEDNESDAY = 4; /** * Value of the {@link #DAY_OF_WEEK} field indicating * Thursday. */ - public final static int THURSDAY = 5; + public static final int THURSDAY = 5; /** * Value of the {@link #DAY_OF_WEEK} field indicating * Friday. */ - public final static int FRIDAY = 6; + public static final int FRIDAY = 6; /** * Value of the {@link #DAY_OF_WEEK} field indicating * Saturday. */ - public final static int SATURDAY = 7; + public static final int SATURDAY = 7; /** * Value of the {@link #MONTH} field indicating the * first month of the year in the Gregorian and Julian calendars. */ - public final static int JANUARY = 0; + public static final int JANUARY = 0; /** * Value of the {@link #MONTH} field indicating the * second month of the year in the Gregorian and Julian calendars. */ - public final static int FEBRUARY = 1; + public static final int FEBRUARY = 1; /** * Value of the {@link #MONTH} field indicating the * third month of the year in the Gregorian and Julian calendars. */ - public final static int MARCH = 2; + public static final int MARCH = 2; /** * Value of the {@link #MONTH} field indicating the * fourth month of the year in the Gregorian and Julian calendars. */ - public final static int APRIL = 3; + public static final int APRIL = 3; /** * Value of the {@link #MONTH} field indicating the * fifth month of the year in the Gregorian and Julian calendars. */ - public final static int MAY = 4; + public static final int MAY = 4; /** * Value of the {@link #MONTH} field indicating the * sixth month of the year in the Gregorian and Julian calendars. */ - public final static int JUNE = 5; + public static final int JUNE = 5; /** * Value of the {@link #MONTH} field indicating the * seventh month of the year in the Gregorian and Julian calendars. */ - public final static int JULY = 6; + public static final int JULY = 6; /** * Value of the {@link #MONTH} field indicating the * eighth month of the year in the Gregorian and Julian calendars. */ - public final static int AUGUST = 7; + public static final int AUGUST = 7; /** * Value of the {@link #MONTH} field indicating the * ninth month of the year in the Gregorian and Julian calendars. */ - public final static int SEPTEMBER = 8; + public static final int SEPTEMBER = 8; /** * Value of the {@link #MONTH} field indicating the * tenth month of the year in the Gregorian and Julian calendars. */ - public final static int OCTOBER = 9; + public static final int OCTOBER = 9; /** * Value of the {@link #MONTH} field indicating the * eleventh month of the year in the Gregorian and Julian calendars. */ - public final static int NOVEMBER = 10; + public static final int NOVEMBER = 10; /** * Value of the {@link #MONTH} field indicating the * twelfth month of the year in the Gregorian and Julian calendars. */ - public final static int DECEMBER = 11; + public static final int DECEMBER = 11; /** * Value of the {@link #MONTH} field indicating the * thirteenth month of the year. Although GregorianCalendar * does not use this value, lunar calendars do. */ - public final static int UNDECIMBER = 12; + public static final int UNDECIMBER = 12; /** * Value of the {@link #AM_PM} field indicating the * period of the day from midnight to just before noon. */ - public final static int AM = 0; + public static final int AM = 0; /** * Value of the {@link #AM_PM} field indicating the * period of the day from noon to just before midnight. */ - public final static int PM = 1; + public static final int PM = 1; /** * A style specifier for {@link #getDisplayNames(int, int, Locale) @@ -856,7 +856,7 @@ * are two special values, UNSET and COMPUTED. Values from * MINIMUM_USER_SET to Integer.MAX_VALUE are legal user set values. */ - transient private int stamp[]; + private transient int stamp[]; /** * The currently set time for this calendar, expressed in milliseconds after @@ -911,7 +911,7 @@ /** * True if zone references to a shared TimeZone object. */ - transient private boolean sharedZone = false; + private transient boolean sharedZone = false; /** * The first day of the week, with possible values SUNDAY, @@ -1003,24 +1003,24 @@ // Mask values for calendar fields @SuppressWarnings("PointlessBitwiseExpression") - final static int ERA_MASK = (1 << ERA); - final static int YEAR_MASK = (1 << YEAR); - final static int MONTH_MASK = (1 << MONTH); - final static int WEEK_OF_YEAR_MASK = (1 << WEEK_OF_YEAR); - final static int WEEK_OF_MONTH_MASK = (1 << WEEK_OF_MONTH); - final static int DAY_OF_MONTH_MASK = (1 << DAY_OF_MONTH); - final static int DATE_MASK = DAY_OF_MONTH_MASK; - final static int DAY_OF_YEAR_MASK = (1 << DAY_OF_YEAR); - final static int DAY_OF_WEEK_MASK = (1 << DAY_OF_WEEK); - final static int DAY_OF_WEEK_IN_MONTH_MASK = (1 << DAY_OF_WEEK_IN_MONTH); - final static int AM_PM_MASK = (1 << AM_PM); - final static int HOUR_MASK = (1 << HOUR); - final static int HOUR_OF_DAY_MASK = (1 << HOUR_OF_DAY); - final static int MINUTE_MASK = (1 << MINUTE); - final static int SECOND_MASK = (1 << SECOND); - final static int MILLISECOND_MASK = (1 << MILLISECOND); - final static int ZONE_OFFSET_MASK = (1 << ZONE_OFFSET); - final static int DST_OFFSET_MASK = (1 << DST_OFFSET); + static final int ERA_MASK = (1 << ERA); + static final int YEAR_MASK = (1 << YEAR); + static final int MONTH_MASK = (1 << MONTH); + static final int WEEK_OF_YEAR_MASK = (1 << WEEK_OF_YEAR); + static final int WEEK_OF_MONTH_MASK = (1 << WEEK_OF_MONTH); + static final int DAY_OF_MONTH_MASK = (1 << DAY_OF_MONTH); + static final int DATE_MASK = DAY_OF_MONTH_MASK; + static final int DAY_OF_YEAR_MASK = (1 << DAY_OF_YEAR); + static final int DAY_OF_WEEK_MASK = (1 << DAY_OF_WEEK); + static final int DAY_OF_WEEK_IN_MONTH_MASK = (1 << DAY_OF_WEEK_IN_MONTH); + static final int AM_PM_MASK = (1 << AM_PM); + static final int HOUR_MASK = (1 << HOUR); + static final int HOUR_OF_DAY_MASK = (1 << HOUR_OF_DAY); + static final int MINUTE_MASK = (1 << MINUTE); + static final int SECOND_MASK = (1 << SECOND); + static final int MILLISECOND_MASK = (1 << MILLISECOND); + static final int ZONE_OFFSET_MASK = (1 << ZONE_OFFSET); + static final int DST_OFFSET_MASK = (1 << DST_OFFSET); /** * {@code Calendar.Builder} is used for creating a {@code Calendar} from @@ -2795,7 +2795,7 @@ * @see #roll(int,int) * @see #set(int,int) */ - abstract public void add(int field, int amount); + public abstract void add(int field, int amount); /** * Adds or subtracts (up/down) a single unit of time on the given time @@ -2817,7 +2817,7 @@ * @see Calendar#add(int,int) * @see Calendar#set(int,int) */ - abstract public void roll(int field, boolean up); + public abstract void roll(int field, boolean up); /** * Adds the specified (signed) amount to the specified calendar field @@ -3104,7 +3104,7 @@ * @see #getActualMinimum(int) * @see #getActualMaximum(int) */ - abstract public int getMinimum(int field); + public abstract int getMinimum(int field); /** * Returns the maximum value for the given calendar field of this @@ -3121,7 +3121,7 @@ * @see #getActualMinimum(int) * @see #getActualMaximum(int) */ - abstract public int getMaximum(int field); + public abstract int getMaximum(int field); /** * Returns the highest minimum value for the given calendar field @@ -3139,7 +3139,7 @@ * @see #getActualMinimum(int) * @see #getActualMaximum(int) */ - abstract public int getGreatestMinimum(int field); + public abstract int getGreatestMinimum(int field); /** * Returns the lowest maximum value for the given calendar field @@ -3161,7 +3161,7 @@ * @see #getActualMinimum(int) * @see #getActualMaximum(int) */ - abstract public int getLeastMaximum(int field); + public abstract int getLeastMaximum(int field); /** * Returns the minimum value that the specified calendar field diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Comparators.java --- a/src/java.base/share/classes/java/util/Comparators.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Comparators.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,7 +61,7 @@ /** * Null-friendly comparators */ - final static class NullComparator implements Comparator, Serializable { + static final class NullComparator implements Comparator, Serializable { private static final long serialVersionUID = -7569533591570686392L; private final boolean nullFirst; // if null, non-null Ts are considered equal diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Currency.java --- a/src/java.base/share/classes/java/util/Currency.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Currency.java Fri Sep 18 09:18:17 2015 -0700 @@ -110,13 +110,13 @@ * Default fraction digits for this currency. * Set from currency data tables. */ - transient private final int defaultFractionDigits; + private final transient int defaultFractionDigits; /** * ISO 4217 numeric code for this currency. * Set from currency data tables. */ - transient private final int numericCode; + private final transient int numericCode; // class data: instance map diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Date.java --- a/src/java.base/share/classes/java/util/Date.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Date.java Fri Sep 18 09:18:17 2015 -0700 @@ -613,7 +613,7 @@ // syntax error throw new IllegalArgumentException(); } - private final static String wtb[] = { + private static final String wtb[] = { "am", "pm", "monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday", @@ -622,7 +622,7 @@ "gmt", "ut", "utc", "est", "edt", "cst", "cdt", "mst", "mdt", "pst", "pdt" }; - private final static int ttb[] = { + private static final int ttb[] = { 14, 1, 0, 0, 0, 0, 0, 0, 0, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 10000 + 0, 10000 + 0, 10000 + 0, // GMT/UT/UTC @@ -1300,7 +1300,7 @@ return gcal; } - synchronized private static final BaseCalendar getJulianCalendar() { + private static final synchronized BaseCalendar getJulianCalendar() { if (jcal == null) { jcal = (BaseCalendar) CalendarSystem.forName("julian"); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Dictionary.java --- a/src/java.base/share/classes/java/util/Dictionary.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Dictionary.java Fri Sep 18 09:18:17 2015 -0700 @@ -60,7 +60,7 @@ * * @return the number of keys in this dictionary. */ - abstract public int size(); + public abstract int size(); /** * Tests if this dictionary maps no keys to value. The general contract @@ -70,7 +70,7 @@ * @return {@code true} if this dictionary maps no keys to values; * {@code false} otherwise. */ - abstract public boolean isEmpty(); + public abstract boolean isEmpty(); /** * Returns an enumeration of the keys in this dictionary. The general @@ -82,7 +82,7 @@ * @see java.util.Dictionary#elements() * @see java.util.Enumeration */ - abstract public Enumeration keys(); + public abstract Enumeration keys(); /** * Returns an enumeration of the values in this dictionary. The general @@ -94,7 +94,7 @@ * @see java.util.Dictionary#keys() * @see java.util.Enumeration */ - abstract public Enumeration elements(); + public abstract Enumeration elements(); /** * Returns the value to which the key is mapped in this dictionary. @@ -109,7 +109,7 @@ * @exception NullPointerException if the {@code key} is {@code null}. * @see java.util.Dictionary#put(java.lang.Object, java.lang.Object) */ - abstract public V get(Object key); + public abstract V get(Object key); /** * Maps the specified {@code key} to the specified @@ -138,7 +138,7 @@ * @see java.lang.Object#equals(java.lang.Object) * @see java.util.Dictionary#get(java.lang.Object) */ - abstract public V put(K key, V value); + public abstract V put(K key, V value); /** * Removes the {@code key} (and its corresponding @@ -151,5 +151,5 @@ * mapping. * @exception NullPointerException if {@code key} is {@code null}. */ - abstract public V remove(Object key); + public abstract V remove(Object key); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/GregorianCalendar.java --- a/src/java.base/share/classes/java/util/GregorianCalendar.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/GregorianCalendar.java Fri Sep 18 09:18:17 2015 -0700 @@ -2282,7 +2282,7 @@ * Long.MIN_VALUE, the fixed date value is unknown. Currently, * Julian calendar dates are not cached. */ - transient private long cachedFixedDate = Long.MIN_VALUE; + private transient long cachedFixedDate = Long.MIN_VALUE; /** * Converts the time value (millisecond offset from the
Object array representing a * key-value pair. */ - abstract protected Object[][] getContents(); + protected abstract Object[][] getContents(); // ==================privates==================== diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Locale.java --- a/src/java.base/share/classes/java/util/Locale.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Locale.java Fri Sep 18 09:18:17 2015 -0700 @@ -483,91 +483,91 @@ */ public final class Locale implements Cloneable, Serializable { - static private final Cache LOCALECACHE = new Cache(); + private static final Cache LOCALECACHE = new Cache(); /** Useful constant for language. */ - static public final Locale ENGLISH = createConstant("en", ""); + public static final Locale ENGLISH = createConstant("en", ""); /** Useful constant for language. */ - static public final Locale FRENCH = createConstant("fr", ""); + public static final Locale FRENCH = createConstant("fr", ""); /** Useful constant for language. */ - static public final Locale GERMAN = createConstant("de", ""); + public static final Locale GERMAN = createConstant("de", ""); /** Useful constant for language. */ - static public final Locale ITALIAN = createConstant("it", ""); + public static final Locale ITALIAN = createConstant("it", ""); /** Useful constant for language. */ - static public final Locale JAPANESE = createConstant("ja", ""); + public static final Locale JAPANESE = createConstant("ja", ""); /** Useful constant for language. */ - static public final Locale KOREAN = createConstant("ko", ""); + public static final Locale KOREAN = createConstant("ko", ""); /** Useful constant for language. */ - static public final Locale CHINESE = createConstant("zh", ""); + public static final Locale CHINESE = createConstant("zh", ""); /** Useful constant for language. */ - static public final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN"); + public static final Locale SIMPLIFIED_CHINESE = createConstant("zh", "CN"); /** Useful constant for language. */ - static public final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW"); + public static final Locale TRADITIONAL_CHINESE = createConstant("zh", "TW"); /** Useful constant for country. */ - static public final Locale FRANCE = createConstant("fr", "FR"); + public static final Locale FRANCE = createConstant("fr", "FR"); /** Useful constant for country. */ - static public final Locale GERMANY = createConstant("de", "DE"); + public static final Locale GERMANY = createConstant("de", "DE"); /** Useful constant for country. */ - static public final Locale ITALY = createConstant("it", "IT"); + public static final Locale ITALY = createConstant("it", "IT"); /** Useful constant for country. */ - static public final Locale JAPAN = createConstant("ja", "JP"); + public static final Locale JAPAN = createConstant("ja", "JP"); /** Useful constant for country. */ - static public final Locale KOREA = createConstant("ko", "KR"); + public static final Locale KOREA = createConstant("ko", "KR"); /** Useful constant for country. */ - static public final Locale CHINA = SIMPLIFIED_CHINESE; + public static final Locale CHINA = SIMPLIFIED_CHINESE; /** Useful constant for country. */ - static public final Locale PRC = SIMPLIFIED_CHINESE; + public static final Locale PRC = SIMPLIFIED_CHINESE; /** Useful constant for country. */ - static public final Locale TAIWAN = TRADITIONAL_CHINESE; + public static final Locale TAIWAN = TRADITIONAL_CHINESE; /** Useful constant for country. */ - static public final Locale UK = createConstant("en", "GB"); + public static final Locale UK = createConstant("en", "GB"); /** Useful constant for country. */ - static public final Locale US = createConstant("en", "US"); + public static final Locale US = createConstant("en", "US"); /** Useful constant for country. */ - static public final Locale CANADA = createConstant("en", "CA"); + public static final Locale CANADA = createConstant("en", "CA"); /** Useful constant for country. */ - static public final Locale CANADA_FRENCH = createConstant("fr", "CA"); + public static final Locale CANADA_FRENCH = createConstant("fr", "CA"); /** * Useful constant for the root locale. The root locale is the locale whose @@ -577,7 +577,7 @@ * * @since 1.6 */ - static public final Locale ROOT = createConstant("", ""); + public static final Locale ROOT = createConstant("", ""); /** * The key for the private use extension ('x'). @@ -586,7 +586,7 @@ * @see Builder#setExtension(char, String) * @since 1.7 */ - static public final char PRIVATE_USE_EXTENSION = 'x'; + public static final char PRIVATE_USE_EXTENSION = 'x'; /** * The key for Unicode locale extension ('u'). @@ -595,7 +595,7 @@ * @see Builder#setExtension(char, String) * @since 1.7 */ - static public final char UNICODE_LOCALE_EXTENSION = 'u'; + public static final char UNICODE_LOCALE_EXTENSION = 'u'; /** serialization ID */ @@ -2018,9 +2018,9 @@ */ private transient volatile int hashCodeValue = 0; - private volatile static Locale defaultLocale = initDefault(); - private volatile static Locale defaultDisplayLocale = null; - private volatile static Locale defaultFormatLocale = null; + private static volatile Locale defaultLocale = initDefault(); + private static volatile Locale defaultDisplayLocale = null; + private static volatile Locale defaultFormatLocale = null; private transient volatile String languageTag; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/PropertyPermission.java --- a/src/java.base/share/classes/java/util/PropertyPermission.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/PropertyPermission.java Fri Sep 18 09:18:17 2015 -0700 @@ -90,20 +90,20 @@ /** * Read action. */ - private final static int READ = 0x1; + private static final int READ = 0x1; /** * Write action. */ - private final static int WRITE = 0x2; + private static final int WRITE = 0x2; /** * All actions (read,write); */ - private final static int ALL = READ|WRITE; + private static final int ALL = READ|WRITE; /** * No actions. */ - private final static int NONE = 0x0; + private static final int NONE = 0x0; /** * The actions mask. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Random.java --- a/src/java.base/share/classes/java/util/Random.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Random.java Fri Sep 18 09:18:17 2015 -0700 @@ -165,7 +165,7 @@ * * @param seed the initial seed */ - synchronized public void setSeed(long seed) { + public synchronized void setSeed(long seed) { this.seed.set(initialScramble(seed)); haveNextNextGaussian = false; } @@ -580,7 +580,7 @@ * standard deviation {@code 1.0} from this random number * generator's sequence */ - synchronized public double nextGaussian() { + public synchronized double nextGaussian() { // See Knuth, ACP, Section 3.4.1 Algorithm C. if (haveNextNextGaussian) { haveNextNextGaussian = false; @@ -1197,7 +1197,7 @@ /** * Save the {@code Random} instance to a stream. */ - synchronized private void writeObject(ObjectOutputStream s) + private synchronized void writeObject(ObjectOutputStream s) throws IOException { // set the values of the Serializable fields diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Scanner.java --- a/src/java.base/share/classes/java/util/Scanner.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Scanner.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, 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 @@ -25,16 +25,18 @@ package java.util; -import java.nio.file.Path; -import java.nio.file.Files; -import java.util.regex.*; import java.io.*; import java.math.*; import java.nio.*; import java.nio.channels.*; import java.nio.charset.*; +import java.nio.file.Path; +import java.nio.file.Files; import java.text.*; -import java.util.Locale; +import java.util.function.Consumer; +import java.util.regex.*; +import java.util.stream.Stream; +import java.util.stream.StreamSupport; import sun.misc.LRUCache; @@ -96,22 +98,25 @@ * }
* *

The default whitespace delimiter used - * by a scanner is as recognized by {@link java.lang.Character}.{@link - * java.lang.Character#isWhitespace(char) isWhitespace}. The {@link #reset} + * by a scanner is as recognized by {@link Character#isWhitespace(char) + * Character.isWhitespace()}. The {@link #reset reset()} * method will reset the value of the scanner's delimiter to the default * whitespace delimiter regardless of whether it was previously changed. * *

A scanning operation may block waiting for input. * *

The {@link #next} and {@link #hasNext} methods and their - * primitive-type companion methods (such as {@link #nextInt} and + * companion methods (such as {@link #nextInt} and * {@link #hasNextInt}) first skip any input that matches the delimiter - * pattern, and then attempt to return the next token. Both {@code hasNext} - * and {@code next} methods may block waiting for further input. Whether a - * {@code hasNext} method blocks has no connection to whether or not its - * associated {@code next} method will block. + * pattern, and then attempt to return the next token. Both {@code hasNext()} + * and {@code next()} methods may block waiting for further input. Whether a + * {@code hasNext()} method blocks has no connection to whether or not its + * associated {@code next()} method will block. The {@link #tokens} method + * may also block waiting for input. * - *

The {@link #findInLine}, {@link #findWithinHorizon}, and {@link #skip} + *

The {@link #findInLine findInLine()}, + * {@link #findWithinHorizon findWithinHorizon()}, + * {@link #skip skip()}, and {@link #findAll findAll()} * methods operate independently of the delimiter pattern. These methods will * attempt to match the specified pattern with no regard to delimiters in the * input and thus can be used in special circumstances where delimiters are @@ -129,7 +134,7 @@ * *

A scanner can read text from any object which implements the {@link * java.lang.Readable} interface. If an invocation of the underlying - * readable's {@link java.lang.Readable#read} method throws an {@link + * readable's {@link java.lang.Readable#read read()} method throws an {@link * java.io.IOException} then the scanner assumes that the end of the input * has been reached. The most recent {@code IOException} thrown by the * underlying readable can be retrieved via the {@link #ioException} method. @@ -156,7 +161,7 @@ * initial locale is the value returned by the {@link * java.util.Locale#getDefault(Locale.Category) * Locale.getDefault(Locale.Category.FORMAT)} method; it may be changed via the {@link - * #useLocale} method. The {@link #reset} method will reset the value of the + * #useLocale useLocale()} method. The {@link #reset} method will reset the value of the * scanner's locale to the initial locale regardless of whether it was * previously changed. * @@ -374,6 +379,11 @@ // A holder of the last IOException encountered private IOException lastException; + // Number of times this scanner's state has been modified. + // Generally incremented on most public APIs and checked + // within spliterator implementations. + int modCount; + // A pattern for java whitespace private static Pattern WHITESPACE_PATTERN = Pattern.compile( "\\p{javaWhitespace}+"); @@ -995,8 +1005,9 @@ } // Finds the specified pattern in the buffer up to horizon. - // Returns a match for the specified input pattern. - private String findPatternInBuffer(Pattern pattern, int horizon) { + // Returns true if the specified input pattern was matched, + // and leaves the matcher field with the current match state. + private boolean findPatternInBuffer(Pattern pattern, int horizon) { matchValid = false; matcher.usePattern(pattern); int bufferLimit = buf.limit(); @@ -1014,7 +1025,7 @@ if (searchLimit != horizonLimit) { // Hit an artificial end; try to extend the match needInput = true; - return null; + return false; } // The match could go away depending on what is next if ((searchLimit == horizonLimit) && matcher.requireEnd()) { @@ -1022,27 +1033,28 @@ // that it is at the horizon and the end of input is // required for the match. needInput = true; - return null; + return false; } } // Did not hit end, or hit real end, or hit horizon position = matcher.end(); - return matcher.group(); + return true; } if (sourceClosed) - return null; + return false; // If there is no specified horizon, or if we have not searched // to the specified horizon yet, get more input if ((horizon == 0) || (searchLimit != horizonLimit)) needInput = true; - return null; + return false; } - // Returns a match for the specified input pattern anchored at - // the current position - private String matchPatternInBuffer(Pattern pattern) { + // Attempts to match a pattern anchored at the current position. + // Returns true if the specified input pattern was matched, + // and leaves the matcher field with the current match state. + private boolean matchPatternInBuffer(Pattern pattern) { matchValid = false; matcher.usePattern(pattern); matcher.region(position, buf.limit()); @@ -1050,18 +1062,18 @@ if (matcher.hitEnd() && (!sourceClosed)) { // Get more input and try again needInput = true; - return null; + return false; } position = matcher.end(); - return matcher.group(); + return true; } if (sourceClosed) - return null; + return false; // Read more to find pattern needInput = true; - return null; + return false; } // Throws if the scanner is closed @@ -1128,6 +1140,7 @@ * @return this scanner */ public Scanner useDelimiter(Pattern pattern) { + modCount++; delimPattern = pattern; return this; } @@ -1147,6 +1160,7 @@ * @return this scanner */ public Scanner useDelimiter(String pattern) { + modCount++; delimPattern = patternCache.forName(pattern); return this; } @@ -1181,6 +1195,7 @@ if (locale.equals(this.locale)) return this; + modCount++; this.locale = locale; DecimalFormat df = (DecimalFormat)NumberFormat.getNumberInstance(locale); @@ -1236,8 +1251,8 @@ * number matching regular expressions; see * localized numbers above. * - *

If the radix is less than {@code Character.MIN_RADIX} - * or greater than {@code Character.MAX_RADIX}, then an + *

If the radix is less than {@link Character#MIN_RADIX Character.MIN_RADIX} + * or greater than {@link Character#MAX_RADIX Character.MAX_RADIX}, then an * {@code IllegalArgumentException} is thrown. * *

Invoking the {@link #reset} method will set the scanner's radix to @@ -1253,6 +1268,7 @@ if (this.defaultRadix == radix) return this; + modCount++; this.defaultRadix = radix; // Force rebuilding and recompilation of radix dependent patterns integerPattern = null; @@ -1275,15 +1291,15 @@ * if no match has been performed, or if the last match was * not successful. * - *

The various {@code next}methods of {@code Scanner} + *

The various {@code next} methods of {@code Scanner} * make a match result available if they complete without throwing an * exception. For instance, after an invocation of the {@link #nextInt} * method that returned an int, this method returns a * {@code MatchResult} for the search of the * Integer regular expression - * defined above. Similarly the {@link #findInLine}, - * {@link #findWithinHorizon}, and {@link #skip} methods will make a - * match available if they succeed. + * defined above. Similarly the {@link #findInLine findInLine()}, + * {@link #findWithinHorizon findWithinHorizon()}, and {@link #skip skip()} + * methods will make a match available if they succeed. * * @return a match result for the last match operation * @throws IllegalStateException If no match result is available @@ -1333,6 +1349,7 @@ public boolean hasNext() { ensureOpen(); saveState(); + modCount++; while (!sourceClosed) { if (hasTokenInBuffer()) return revertState(true); @@ -1357,6 +1374,7 @@ public String next() { ensureOpen(); clearCaches(); + modCount++; while (true) { String token = getCompleteTokenInBuffer(null); @@ -1435,6 +1453,7 @@ throw new NullPointerException(); hasNextPattern = null; saveState(); + modCount++; while (true) { if (getCompleteTokenInBuffer(pattern) != null) { @@ -1466,6 +1485,7 @@ if (pattern == null) throw new NullPointerException(); + modCount++; // Did we already find this pattern? if (hasNextPattern == pattern) return getCachedResult(); @@ -1497,6 +1517,7 @@ public boolean hasNextLine() { saveState(); + modCount++; String result = findWithinHorizon(linePattern(), 0); if (result != null) { MatchResult mr = this.match(); @@ -1531,6 +1552,7 @@ * @throws IllegalStateException if this scanner is closed */ public String nextLine() { + modCount++; if (hasNextPattern == linePattern()) return getCachedResult(); clearCaches(); @@ -1589,12 +1611,12 @@ if (pattern == null) throw new NullPointerException(); clearCaches(); + modCount++; // Expand buffer to include the next newline or end of input int endPosition = 0; saveState(); while (true) { - String token = findPatternInBuffer(separatorPattern(), 0); - if (token != null) { + if (findPatternInBuffer(separatorPattern(), 0)) { endPosition = matcher.start(); break; // up to next newline } @@ -1623,7 +1645,7 @@ *

An invocation of this method of the form * {@code findWithinHorizon(pattern)} behaves in exactly the same way as * the invocation - * {@code findWithinHorizon(Pattern.compile(pattern, horizon))}. + * {@code findWithinHorizon(Pattern.compile(pattern), horizon)}. * * @param pattern a string specifying the pattern to search for * @param horizon the search horizon @@ -1673,13 +1695,13 @@ if (horizon < 0) throw new IllegalArgumentException("horizon < 0"); clearCaches(); + modCount++; // Search for the pattern while (true) { - String token = findPatternInBuffer(pattern, horizon); - if (token != null) { + if (findPatternInBuffer(pattern, horizon)) { matchValid = true; - return token; + return matcher.group(); } if (needInput) readInput(); @@ -1717,11 +1739,11 @@ if (pattern == null) throw new NullPointerException(); clearCaches(); + modCount++; // Search for the pattern while (true) { - String token = matchPatternInBuffer(pattern); - if (token != null) { + if (matchPatternInBuffer(pattern)) { matchValid = true; position = matcher.end(); return this; @@ -1932,7 +1954,7 @@ * *

An invocation of this method of the form * {@code nextShort()} behaves in exactly the same way as the - * invocation {@code nextShort(radix)}, where {@code radix} + * invocation {@link #nextShort(int) nextShort(radix)}, where {@code radix} * is the default radix of this scanner. * * @return the {@code short} scanned from the input @@ -2590,8 +2612,10 @@ * Resets this scanner. * *

Resetting a scanner discards all of its explicit state - * information which may have been changed by invocations of {@link - * #useDelimiter}, {@link #useLocale}, or {@link #useRadix}. + * information which may have been changed by invocations of + * {@link #useDelimiter useDelimiter()}, + * {@link #useLocale useLocale()}, or + * {@link #useRadix useRadix()}. * *

An invocation of this method of the form * {@code scanner.reset()} behaves in exactly the same way as the @@ -2612,6 +2636,206 @@ useLocale(Locale.getDefault(Locale.Category.FORMAT)); useRadix(10); clearCaches(); + modCount++; return this; } + + /** + * Returns a stream of delimiter-separated tokens from this scanner. The + * stream contains the same tokens that would be returned, starting from + * this scanner's current state, by calling the {@link #next} method + * repeatedly until the {@link #hasNext} method returns false. + * + *

The resulting stream is sequential and ordered. All stream elements are + * non-null. + * + *

Scanning starts upon initiation of the terminal stream operation, using the + * current state of this scanner. Subsequent calls to any methods on this scanner + * other than {@link #close} and {@link #ioException} may return undefined results + * or may cause undefined effects on the returned stream. The returned stream's source + * {@code Spliterator} is fail-fast and will, on a best-effort basis, throw a + * {@link java.util.ConcurrentModificationException} if any such calls are detected + * during stream pipeline execution. + * + *

After stream pipeline execution completes, this scanner is left in an indeterminate + * state and cannot be reused. + * + *

If this scanner contains a resource that must be released, this scanner + * should be closed, either by calling its {@link #close} method, or by + * closing the returned stream. Closing the stream will close the underlying scanner. + * {@code IllegalStateException} is thrown if the scanner has been closed when this + * method is called, or if this scanner is closed during stream pipeline execution. + * + *

This method might block waiting for more input. + * + * @apiNote + * For example, the following code will create a list of + * comma-delimited tokens from a string: + * + *

{@code
+     * List result = new Scanner("abc,def,,ghi")
+     *     .useDelimiter(",")
+     *     .tokens()
+     *     .collect(Collectors.toList());
+     * }
+ * + *

The resulting list would contain {@code "abc"}, {@code "def"}, + * the empty string, and {@code "ghi"}. + * + * @return a sequential stream of token strings + * @throws IllegalStateException if this scanner is closed + * @since 1.9 + */ + public Stream tokens() { + ensureOpen(); + Stream stream = StreamSupport.stream(new TokenSpliterator(), false); + return stream.onClose(this::close); + } + + class TokenSpliterator extends Spliterators.AbstractSpliterator { + int expectedCount = -1; + + TokenSpliterator() { + super(Long.MAX_VALUE, + Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED); + } + + @Override + public boolean tryAdvance(Consumer cons) { + if (expectedCount >= 0 && expectedCount != modCount) { + throw new ConcurrentModificationException(); + } + + if (hasNext()) { + String token = next(); + expectedCount = modCount; + cons.accept(token); + if (expectedCount != modCount) { + throw new ConcurrentModificationException(); + } + return true; + } else { + expectedCount = modCount; + return false; + } + } + } + + /** + * Returns a stream of match results from this scanner. The stream + * contains the same results in the same order that would be returned by + * calling {@code findWithinHorizon(pattern, 0)} and then {@link #match} + * successively as long as {@link #findWithinHorizon findWithinHorizon()} + * finds matches. + * + *

The resulting stream is sequential and ordered. All stream elements are + * non-null. + * + *

Scanning starts upon initiation of the terminal stream operation, using the + * current state of this scanner. Subsequent calls to any methods on this scanner + * other than {@link #close} and {@link #ioException} may return undefined results + * or may cause undefined effects on the returned stream. The returned stream's source + * {@code Spliterator} is fail-fast and will, on a best-effort basis, throw a + * {@link java.util.ConcurrentModificationException} if any such calls are detected + * during stream pipeline execution. + * + *

After stream pipeline execution completes, this scanner is left in an indeterminate + * state and cannot be reused. + * + *

If this scanner contains a resource that must be released, this scanner + * should be closed, either by calling its {@link #close} method, or by + * closing the returned stream. Closing the stream will close the underlying scanner. + * {@code IllegalStateException} is thrown if the scanner has been closed when this + * method is called, or if this scanner is closed during stream pipeline execution. + * + *

As with the {@link #findWithinHorizon findWithinHorizon()} methods, this method + * might block waiting for additional input, and it might buffer an unbounded amount of + * input searching for a match. + * + * @apiNote + * For example, the following code will read a file and return a list + * of all sequences of characters consisting of seven or more Latin capital + * letters: + * + *

{@code
+     * try (Scanner sc = new Scanner(Paths.get("input.txt"))) {
+     *     Pattern pat = Pattern.compile("[A-Z]{7,}");
+     *     List capWords = sc.findAll(pat)
+     *                               .map(MatchResult::group)
+     *                               .collect(Collectors.toList());
+     * }
+     * }
+ * + * @param pattern the pattern to be matched + * @return a sequential stream of match results + * @throws NullPointerException if pattern is null + * @throws IllegalStateException if this scanner is closed + * @since 1.9 + */ + public Stream findAll(Pattern pattern) { + Objects.requireNonNull(pattern); + ensureOpen(); + Stream stream = StreamSupport.stream(new FindSpliterator(pattern), false); + return stream.onClose(this::close); + } + + /** + * Returns a stream of match results that match the provided pattern string. + * The effect is equivalent to the following code: + * + *
{@code
+     *     scanner.findAll(Pattern.compile(patString))
+     * }
+ * + * @param patString the pattern string + * @return a sequential stream of match results + * @throws NullPointerException if patString is null + * @throws IllegalStateException if this scanner is closed + * @throws PatternSyntaxException if the regular expression's syntax is invalid + * @since 1.9 + * @see java.util.regex.Pattern + */ + public Stream findAll(String patString) { + Objects.requireNonNull(patString); + ensureOpen(); + return findAll(patternCache.forName(patString)); + } + + class FindSpliterator extends Spliterators.AbstractSpliterator { + final Pattern pattern; + int expectedCount = -1; + + FindSpliterator(Pattern pattern) { + super(Long.MAX_VALUE, + Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED); + this.pattern = pattern; + } + + @Override + public boolean tryAdvance(Consumer cons) { + ensureOpen(); + if (expectedCount >= 0) { + if (expectedCount != modCount) { + throw new ConcurrentModificationException(); + } + } else { + expectedCount = modCount; + } + + while (true) { + // assert expectedCount == modCount + if (findPatternInBuffer(pattern, 0)) { // doesn't increment modCount + cons.accept(matcher.toMatchResult()); + if (expectedCount != modCount) { + throw new ConcurrentModificationException(); + } + return true; + } + if (needInput) + readInput(); // doesn't increment modCount + else + return false; // reached end of input + } + } + } } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/SimpleTimeZone.java --- a/src/java.base/share/classes/java/util/SimpleTimeZone.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/SimpleTimeZone.java Fri Sep 18 09:18:17 2015 -0700 @@ -1125,8 +1125,8 @@ * be streamed out for compatibility with JDK 1.1. */ private final byte monthLength[] = staticMonthLength; - private final static byte staticMonthLength[] = {31,28,31,30,31,30,31,31,30,31,30,31}; - private final static byte staticLeapMonthLength[] = {31,29,31,30,31,30,31,31,30,31,30,31}; + private static final byte staticMonthLength[] = {31,28,31,30,31,30,31,31,30,31,30,31}; + private static final byte staticLeapMonthLength[] = {31,29,31,30,31,30,31,31,30,31,30,31}; /** * Variables specifying the mode of the start rule. Takes the following @@ -1278,7 +1278,7 @@ */ private int serialVersionOnStream = currentSerialVersion; - synchronized private void invalidateCache() { + private synchronized void invalidateCache() { cacheYear = startYear - 1; cacheStart = cacheEnd = 0; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Spliterators.java --- a/src/java.base/share/classes/java/util/Spliterators.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Spliterators.java Fri Sep 18 09:18:17 2015 -0700 @@ -833,7 +833,7 @@ // Implementations - private static abstract class EmptySpliterator, C> { + private abstract static class EmptySpliterator, C> { EmptySpliterator() { } @@ -1253,7 +1253,7 @@ * @see #spliterator(Iterator, long, int) * @since 1.8 */ - public static abstract class AbstractSpliterator implements Spliterator { + public abstract static class AbstractSpliterator implements Spliterator { static final int BATCH_UNIT = 1 << 10; // batch array size increment static final int MAX_BATCH = 1 << 25; // max batch array size; private final int characteristics; @@ -1376,7 +1376,7 @@ * @see #spliterator(java.util.PrimitiveIterator.OfInt, long, int) * @since 1.8 */ - public static abstract class AbstractIntSpliterator implements Spliterator.OfInt { + public abstract static class AbstractIntSpliterator implements Spliterator.OfInt { static final int MAX_BATCH = AbstractSpliterator.MAX_BATCH; static final int BATCH_UNIT = AbstractSpliterator.BATCH_UNIT; private final int characteristics; @@ -1486,7 +1486,7 @@ * @see #spliterator(java.util.PrimitiveIterator.OfLong, long, int) * @since 1.8 */ - public static abstract class AbstractLongSpliterator implements Spliterator.OfLong { + public abstract static class AbstractLongSpliterator implements Spliterator.OfLong { static final int MAX_BATCH = AbstractSpliterator.MAX_BATCH; static final int BATCH_UNIT = AbstractSpliterator.BATCH_UNIT; private final int characteristics; @@ -1596,7 +1596,7 @@ * @see #spliterator(java.util.PrimitiveIterator.OfDouble, long, int) * @since 1.8 */ - public static abstract class AbstractDoubleSpliterator implements Spliterator.OfDouble { + public abstract static class AbstractDoubleSpliterator implements Spliterator.OfDouble { static final int MAX_BATCH = AbstractSpliterator.MAX_BATCH; static final int BATCH_UNIT = AbstractSpliterator.BATCH_UNIT; private final int characteristics; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/TimeZone.java --- a/src/java.base/share/classes/java/util/TimeZone.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/TimeZone.java Fri Sep 18 09:18:17 2015 -0700 @@ -130,7 +130,7 @@ * @author Mark Davis, David Goldsmith, Chen-Lieh Huang, Alan Liu * @since 1.1 */ -abstract public class TimeZone implements Serializable, Cloneable { +public abstract class TimeZone implements Serializable, Cloneable { /** * Sole constructor. (For invocation by subclass constructors, typically * implicit.) @@ -253,7 +253,7 @@ * * @param offsetMillis the given base time zone offset to GMT. */ - abstract public void setRawOffset(int offsetMillis); + public abstract void setRawOffset(int offsetMillis); /** * Returns the amount of time in milliseconds to add to UTC to get @@ -500,7 +500,7 @@ * @return {@code true} if the given date is in Daylight Saving Time, * {@code false}, otherwise. */ - abstract public boolean inDaylightTime(Date date); + public abstract boolean inDaylightTime(Date date); /** * Gets the TimeZone for the given ID. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/Timer.java --- a/src/java.base/share/classes/java/util/Timer.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/Timer.java Fri Sep 18 09:18:17 2015 -0700 @@ -119,7 +119,7 @@ /** * This ID is used to generate thread names. */ - private final static AtomicInteger nextSerialNumber = new AtomicInteger(0); + private static final AtomicInteger nextSerialNumber = new AtomicInteger(0); private static int serialNumber() { return nextSerialNumber.getAndIncrement(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/jar/Pack200.java --- a/src/java.base/share/classes/java/util/jar/Pack200.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/jar/Pack200.java Fri Sep 18 09:18:17 2015 -0700 @@ -127,7 +127,7 @@ * * @return A newly allocated Packer engine. */ - public synchronized static Packer newPacker() { + public static synchronized Packer newPacker() { return (Packer) newInstance(PACK_PROVIDER); } @@ -688,7 +688,7 @@ private static Class packerImpl; private static Class unpackerImpl; - private synchronized static Object newInstance(String prop) { + private static synchronized Object newInstance(String prop) { String implName = "(unknown)"; try { Class impl = (PACK_PROVIDER.equals(prop))? packerImpl: unpackerImpl; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/regex/Pattern.java --- a/src/java.base/share/classes/java/util/regex/Pattern.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/regex/Pattern.java Fri Sep 18 09:18:17 2015 -0700 @@ -3787,7 +3787,7 @@ * Abstract node class to match one character satisfying some * boolean property. */ - private static abstract class CharProperty extends Node { + private abstract static class CharProperty extends Node { abstract boolean isSatisfiedBy(int ch); CharProperty complement() { return new CharProperty() { @@ -3815,7 +3815,7 @@ * Optimized version of CharProperty that works only for * properties never satisfied by Supplementary characters. */ - private static abstract class BmpCharProperty extends CharProperty { + private abstract static class BmpCharProperty extends CharProperty { boolean match(Matcher matcher, int i, CharSequence seq) { if (i < matcher.to) { return isSatisfiedBy(seq.charAt(i)) @@ -5578,7 +5578,7 @@ return m == null ? null : m.make(); } - private static abstract class CharPropertyFactory { + private abstract static class CharPropertyFactory { abstract CharProperty make(); } @@ -5600,7 +5600,7 @@ CharProperty make() { return new Ctype(ctype);}}); } - private static abstract class CloneableProperty + private abstract static class CloneableProperty extends CharProperty implements Cloneable { public CloneableProperty clone() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/regex/UnicodeProp.java --- a/src/java.base/share/classes/java/util/regex/UnicodeProp.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/regex/UnicodeProp.java Fri Sep 18 09:18:17 2015 -0700 @@ -202,8 +202,8 @@ } }; - private final static HashMap posix = new HashMap<>(); - private final static HashMap aliases = new HashMap<>(); + private static final HashMap posix = new HashMap<>(); + private static final HashMap aliases = new HashMap<>(); static { posix.put("ALPHA", "ALPHABETIC"); posix.put("LOWER", "LOWERCASE"); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/FindOps.java --- a/src/java.base/share/classes/java/util/stream/FindOps.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/FindOps.java Fri Sep 18 09:18:17 2015 -0700 @@ -167,7 +167,7 @@ * @param The type of input element * @param The result type, typically an optional type */ - private static abstract class FindSink implements TerminalSink { + private abstract static class FindSink implements TerminalSink { boolean hasValue; T value; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/ForEachOps.java --- a/src/java.base/share/classes/java/util/stream/ForEachOps.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/ForEachOps.java Fri Sep 18 09:18:17 2015 -0700 @@ -130,7 +130,7 @@ * * @param the output type of the stream pipeline */ - static abstract class ForEachOp + abstract static class ForEachOp implements TerminalOp, TerminalSink { private final boolean ordered; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/MatchOps.java --- a/src/java.base/share/classes/java/util/stream/MatchOps.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/MatchOps.java Fri Sep 18 09:18:17 2015 -0700 @@ -249,7 +249,7 @@ * * @param The output type of the stream pipeline */ - private static abstract class BooleanTerminalSink implements Sink { + private abstract static class BooleanTerminalSink implements Sink { boolean stop; boolean value; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/Nodes.java --- a/src/java.base/share/classes/java/util/stream/Nodes.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/Nodes.java Fri Sep 18 09:18:17 2015 -0700 @@ -562,7 +562,7 @@ // Implementations - private static abstract class EmptyNode implements Node { + private abstract static class EmptyNode implements Node { EmptyNode() { } @Override @@ -750,7 +750,7 @@ /** * Node class for an internal node with two or more children */ - private static abstract class AbstractConcNode> implements Node { + private abstract static class AbstractConcNode> implements Node { protected final T_NODE left; protected final T_NODE right; private final long size; @@ -932,7 +932,7 @@ } /** Abstract class for spliterator for all internal node classes */ - private static abstract class InternalNodeSpliterator, N extends Node> implements Spliterator { @@ -1114,7 +1114,7 @@ } } - private static abstract class OfPrimitive, N extends Node.OfPrimitive> extends InternalNodeSpliterator @@ -1827,7 +1827,7 @@ * This and subclasses are not intended to be serializable */ @SuppressWarnings("serial") - private static abstract class SizedCollectorTask, + private abstract static class SizedCollectorTask, K extends SizedCollectorTask> extends CountedCompleter implements Sink { @@ -2030,7 +2030,7 @@ } @SuppressWarnings("serial") - private static abstract class ToArrayTask, + private abstract static class ToArrayTask, K extends ToArrayTask> extends CountedCompleter { protected final T_NODE node; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/ReduceOps.java --- a/src/java.base/share/classes/java/util/stream/ReduceOps.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/ReduceOps.java Fri Sep 18 09:18:17 2015 -0700 @@ -797,7 +797,7 @@ /** * A sink that counts elements */ - static abstract class CountingSink + abstract static class CountingSink extends Box implements AccumulatingSink> { long count; @@ -866,7 +866,7 @@ * * @param The type of the state element */ - private static abstract class Box { + private abstract static class Box { U state; Box() {} // Avoid creation of special accessor @@ -886,7 +886,7 @@ * @param the result type of the reducing operation * @param the type of the {@code AccumulatingSink} */ - private static abstract class ReduceOp> + private abstract static class ReduceOp> implements TerminalOp { private final StreamShape inputShape; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/Sink.java --- a/src/java.base/share/classes/java/util/stream/Sink.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/Sink.java Fri Sep 18 09:18:17 2015 -0700 @@ -241,7 +241,7 @@ * implementation of the {@code accept()} method must call the correct * {@code accept()} method on the downstream {@code Sink}. */ - static abstract class ChainedReference implements Sink { + abstract static class ChainedReference implements Sink { protected final Sink downstream; public ChainedReference(Sink downstream) { @@ -273,7 +273,7 @@ * The implementation of the {@code accept()} method must call the correct * {@code accept()} method on the downstream {@code Sink}. */ - static abstract class ChainedInt implements Sink.OfInt { + abstract static class ChainedInt implements Sink.OfInt { protected final Sink downstream; public ChainedInt(Sink downstream) { @@ -305,7 +305,7 @@ * The implementation of the {@code accept()} method must call the correct * {@code accept()} method on the downstream {@code Sink}. */ - static abstract class ChainedLong implements Sink.OfLong { + abstract static class ChainedLong implements Sink.OfLong { protected final Sink downstream; public ChainedLong(Sink downstream) { @@ -337,7 +337,7 @@ * The implementation of the {@code accept()} method must call the correct * {@code accept()} method on the downstream {@code Sink}. */ - static abstract class ChainedDouble implements Sink.OfDouble { + abstract static class ChainedDouble implements Sink.OfDouble { protected final Sink downstream; public ChainedDouble(Sink downstream) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/SortedOps.java --- a/src/java.base/share/classes/java/util/stream/SortedOps.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/SortedOps.java Fri Sep 18 09:18:17 2015 -0700 @@ -301,7 +301,7 @@ * occur, in general (not restricted to just sorting), for short-circuiting * parallel pipelines. */ - private static abstract class AbstractRefSortingSink extends Sink.ChainedReference { + private abstract static class AbstractRefSortingSink extends Sink.ChainedReference { protected final Comparator comparator; // @@@ could be a lazy final value, if/when support is added protected boolean cancellationWasRequested; @@ -408,7 +408,7 @@ /** * Abstract {@link Sink} for implementing sort on int streams. */ - private static abstract class AbstractIntSortingSink extends Sink.ChainedInt { + private abstract static class AbstractIntSortingSink extends Sink.ChainedInt { protected boolean cancellationWasRequested; AbstractIntSortingSink(Sink downstream) { @@ -506,7 +506,7 @@ /** * Abstract {@link Sink} for implementing sort on long streams. */ - private static abstract class AbstractLongSortingSink extends Sink.ChainedLong { + private abstract static class AbstractLongSortingSink extends Sink.ChainedLong { protected boolean cancellationWasRequested; AbstractLongSortingSink(Sink downstream) { @@ -604,7 +604,7 @@ /** * Abstract {@link Sink} for implementing sort on long streams. */ - private static abstract class AbstractDoubleSortingSink extends Sink.ChainedDouble { + private abstract static class AbstractDoubleSortingSink extends Sink.ChainedDouble { protected boolean cancellationWasRequested; AbstractDoubleSortingSink(Sink downstream) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/StreamSpliterators.java --- a/src/java.base/share/classes/java/util/stream/StreamSpliterators.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/StreamSpliterators.java Fri Sep 18 09:18:17 2015 -0700 @@ -57,7 +57,7 @@ *

A wrapping spliterator produced from a sequential stream * cannot be split if there are stateful operations present. */ - private static abstract class AbstractWrappingSpliterator implements Spliterator { @@ -607,7 +607,7 @@ * {@code SUBSIZED}. * */ - static abstract class SliceSpliterator> { + abstract static class SliceSpliterator> { // The start index of the slice final long sliceOrigin; // One past the last index of the slice @@ -753,7 +753,7 @@ } } - static abstract class OfPrimitive, T_CONS> extends SliceSpliterator @@ -899,7 +899,7 @@ * collected to a {@code Node}. It is the order of the pipeline stage * that governs whether the this slice spliterator is to be used or not. */ - static abstract class UnorderedSliceSpliterator> { + abstract static class UnorderedSliceSpliterator> { static final int CHUNK_SIZE = 1 << 7; // The spliterator to slice @@ -1060,7 +1060,7 @@ * @param the type of the spined buffer. Must also be a type of * {@code T_CONS}. */ - static abstract class OfPrimitive< + abstract static class OfPrimitive< T, T_CONS, T_BUFF extends ArrayBuffer.OfPrimitive, @@ -1324,7 +1324,7 @@ * The {@code tryAdvance} method always returns true. * */ - static abstract class InfiniteSupplyingSpliterator implements Spliterator { + abstract static class InfiniteSupplyingSpliterator implements Spliterator { long estimate; protected InfiniteSupplyingSpliterator(long estimate) { @@ -1442,7 +1442,7 @@ } // @@@ Consolidate with Node.Builder - static abstract class ArrayBuffer { + abstract static class ArrayBuffer { int index; void reset() { @@ -1470,7 +1470,7 @@ } } - static abstract class OfPrimitive extends ArrayBuffer { + abstract static class OfPrimitive extends ArrayBuffer { int index; @Override diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/Streams.java --- a/src/java.base/share/classes/java/util/stream/Streams.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/Streams.java Fri Sep 18 09:18:17 2015 -0700 @@ -298,7 +298,7 @@ } } - private static abstract class AbstractStreamBuilderImpl> implements Spliterator { + private abstract static class AbstractStreamBuilderImpl> implements Spliterator { // >= 0 when building, < 0 when built // -1 == no elements // -2 == one element, held by first @@ -782,7 +782,7 @@ } } - private static abstract class OfPrimitive> + private abstract static class OfPrimitive> extends ConcatSpliterator implements Spliterator.OfPrimitive { private OfPrimitive(T_SPLITR aSpliterator, T_SPLITR bSpliterator) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/stream/WhileOps.java --- a/src/java.base/share/classes/java/util/stream/WhileOps.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/stream/WhileOps.java Fri Sep 18 09:18:17 2015 -0700 @@ -649,7 +649,7 @@ * @param the type of elements returned by this spliterator * @param the type of the spliterator */ - static abstract class UnorderedWhileSpliterator> implements Spliterator { + abstract static class UnorderedWhileSpliterator> implements Spliterator { // Power of two constant minus one used for modulus of count static final int CANCEL_CHECK_COUNT = (1 << 6) - 1; @@ -715,7 +715,7 @@ abstract T_SPLITR makeSpliterator(T_SPLITR s); - static abstract class OfRef extends UnorderedWhileSpliterator> implements Consumer { + abstract static class OfRef extends UnorderedWhileSpliterator> implements Consumer { final Predicate p; T t; @@ -820,7 +820,7 @@ } } - static abstract class OfInt extends UnorderedWhileSpliterator implements IntConsumer, Spliterator.OfInt { + abstract static class OfInt extends UnorderedWhileSpliterator implements IntConsumer, Spliterator.OfInt { final IntPredicate p; int t; @@ -925,7 +925,7 @@ } } - static abstract class OfLong extends UnorderedWhileSpliterator implements LongConsumer, Spliterator.OfLong { + abstract static class OfLong extends UnorderedWhileSpliterator implements LongConsumer, Spliterator.OfLong { final LongPredicate p; long t; @@ -1030,7 +1030,7 @@ } } - static abstract class OfDouble extends UnorderedWhileSpliterator implements DoubleConsumer, Spliterator.OfDouble { + abstract static class OfDouble extends UnorderedWhileSpliterator implements DoubleConsumer, Spliterator.OfDouble { final DoublePredicate p; double t; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/zip/Adler32.java --- a/src/java.base/share/classes/java/util/zip/Adler32.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/zip/Adler32.java Fri Sep 18 09:18:17 2015 -0700 @@ -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 @@ -28,6 +28,8 @@ import java.nio.ByteBuffer; import sun.nio.ch.DirectBuffer; +import jdk.internal.HotSpotIntrinsicCandidate; + /** * A class that can be used to compute the Adler-32 checksum of a data * stream. An Adler-32 checksum is almost as reliable as a CRC-32 but @@ -125,9 +127,12 @@ return (long)adler & 0xffffffffL; } - private native static int update(int adler, int b); - private native static int updateBytes(int adler, byte[] b, int off, + private static native int update(int adler, int b); + + @HotSpotIntrinsicCandidate + private static native int updateBytes(int adler, byte[] b, int off, int len); - private native static int updateByteBuffer(int adler, long addr, + @HotSpotIntrinsicCandidate + private static native int updateByteBuffer(int adler, long addr, int off, int len); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/zip/CRC32.java --- a/src/java.base/share/classes/java/util/zip/CRC32.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/zip/CRC32.java Fri Sep 18 09:18:17 2015 -0700 @@ -127,7 +127,7 @@ } @HotSpotIntrinsicCandidate - private native static int update(int crc, int b); + private static native int update(int crc, int b); private static int updateBytes(int crc, byte[] b, int off, int len) { updateBytesCheck(b, off, len); @@ -135,7 +135,7 @@ } @HotSpotIntrinsicCandidate - private native static int updateBytes0(int crc, byte[] b, int off, int len); + private static native int updateBytes0(int crc, byte[] b, int off, int len); private static void updateBytesCheck(byte[] b, int off, int len) { if (len <= 0) { @@ -161,7 +161,7 @@ } @HotSpotIntrinsicCandidate - private native static int updateByteBuffer0(int alder, long addr, + private static native int updateByteBuffer0(int alder, long addr, int off, int len); private static void updateByteBufferCheck(long addr) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/zip/Deflater.java --- a/src/java.base/share/classes/java/util/zip/Deflater.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/zip/Deflater.java Fri Sep 18 09:18:17 2015 -0700 @@ -558,11 +558,11 @@ } private static native void initIDs(); - private native static long init(int level, int strategy, boolean nowrap); - private native static void setDictionary(long addr, byte[] b, int off, int len); + private static native long init(int level, int strategy, boolean nowrap); + private static native void setDictionary(long addr, byte[] b, int off, int len); private native int deflateBytes(long addr, byte[] b, int off, int len, int flush); - private native static int getAdler(long addr); - private native static void reset(long addr); - private native static void end(long addr); + private static native int getAdler(long addr); + private static native void reset(long addr); + private static native void end(long addr); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/zip/GZIPInputStream.java --- a/src/java.base/share/classes/java/util/zip/GZIPInputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/zip/GZIPInputStream.java Fri Sep 18 09:18:17 2015 -0700 @@ -142,16 +142,16 @@ /** * GZIP header magic number. */ - public final static int GZIP_MAGIC = 0x8b1f; + public static final int GZIP_MAGIC = 0x8b1f; /* * File header flags. */ - private final static int FTEXT = 1; // Extra text - private final static int FHCRC = 2; // Header CRC - private final static int FEXTRA = 4; // Extra field - private final static int FNAME = 8; // File name - private final static int FCOMMENT = 16; // File comment + private static final int FTEXT = 1; // Extra text + private static final int FHCRC = 2; // Header CRC + private static final int FEXTRA = 4; // Extra field + private static final int FNAME = 8; // File name + private static final int FCOMMENT = 16; // File comment /* * Reads GZIP member header and returns the total byte number diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/zip/GZIPOutputStream.java --- a/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java Fri Sep 18 09:18:17 2015 -0700 @@ -44,13 +44,13 @@ /* * GZIP header magic number. */ - private final static int GZIP_MAGIC = 0x8b1f; + private static final int GZIP_MAGIC = 0x8b1f; /* * Trailer size in bytes. * */ - private final static int TRAILER_SIZE = 8; + private static final int TRAILER_SIZE = 8; /** * Creates a new output stream with the specified buffer size. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/java/util/zip/Inflater.java --- a/src/java.base/share/classes/java/util/zip/Inflater.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/java/util/zip/Inflater.java Fri Sep 18 09:18:17 2015 -0700 @@ -395,13 +395,13 @@ } } - private native static void initIDs(); - private native static long init(boolean nowrap); - private native static void setDictionary(long addr, byte[] b, int off, + private static native void initIDs(); + private static native long init(boolean nowrap); + private static native void setDictionary(long addr, byte[] b, int off, int len); private native int inflateBytes(long addr, byte[] b, int off, int len) throws DataFormatException; - private native static int getAdler(long addr); - private native static void reset(long addr); - private native static void end(long addr); + private static native int getAdler(long addr); + private static native void reset(long addr); + private static native void end(long addr); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/crypto/Cipher.java --- a/src/java.base/share/classes/javax/crypto/Cipher.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/crypto/Cipher.java Fri Sep 18 09:18:17 2015 -0700 @@ -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 @@ -336,15 +336,15 @@ } // Provider attribute name for supported chaining mode - private final static String ATTR_MODE = "SupportedModes"; + private static final String ATTR_MODE = "SupportedModes"; // Provider attribute name for supported padding names - private final static String ATTR_PAD = "SupportedPaddings"; + private static final String ATTR_PAD = "SupportedPaddings"; // constants indicating whether the provider supports // a given mode or padding - private final static int S_NO = 0; // does not support - private final static int S_MAYBE = 1; // unable to determine - private final static int S_YES = 2; // does support + private static final int S_NO = 0; // does not support + private static final int S_MAYBE = 1; // unable to determine + private static final int S_YES = 2; // does support /** * Nested class to deal with modes and paddings. @@ -410,7 +410,7 @@ } // ConcurrentMap for previously compiled patterns - private final static ConcurrentMap patternCache = + private static final ConcurrentMap patternCache = new ConcurrentHashMap(); private static boolean matches(String regexp, String str) { @@ -787,10 +787,10 @@ } } - private final static int I_KEY = 1; - private final static int I_PARAMSPEC = 2; - private final static int I_PARAMS = 3; - private final static int I_CERT = 4; + private static final int I_KEY = 1; + private static final int I_PARAMSPEC = 2; + private static final int I_PARAMS = 3; + private static final int I_CERT = 4; private void implInit(CipherSpi thisSpi, int type, int opmode, Key key, AlgorithmParameterSpec paramSpec, AlgorithmParameters params, diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/crypto/JceSecurity.java --- a/src/java.base/share/classes/javax/crypto/JceSecurity.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/crypto/JceSecurity.java Fri Sep 18 09:18:17 2015 -0700 @@ -57,11 +57,11 @@ // Map of the providers we already have verified // value == PROVIDER_VERIFIED is successfully verified // value is failure cause Exception in error case - private final static Map verificationResults = + private static final Map verificationResults = new IdentityHashMap<>(); // Map of the providers currently being verified - private final static Map verifyingProviders = + private static final Map verifyingProviders = new IdentityHashMap<>(); // Set the default value. May be changed in the static initializer. @@ -162,7 +162,7 @@ pv.verify(); } - private final static Object PROVIDER_VERIFIED = Boolean.TRUE; + private static final Object PROVIDER_VERIFIED = Boolean.TRUE; /* * Verify that the provider JAR files are signed properly, which diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/crypto/KeyAgreement.java --- a/src/java.base/share/classes/javax/crypto/KeyAgreement.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/crypto/KeyAgreement.java Fri Sep 18 09:18:17 2015 -0700 @@ -336,8 +336,8 @@ } } - private final static int I_NO_PARAMS = 1; - private final static int I_PARAMS = 2; + private static final int I_NO_PARAMS = 1; + private static final int I_PARAMS = 2; private void implInit(KeyAgreementSpi spi, int type, Key key, AlgorithmParameterSpec params, SecureRandom random) diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/crypto/KeyGenerator.java --- a/src/java.base/share/classes/javax/crypto/KeyGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/crypto/KeyGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -116,10 +116,10 @@ // see java.security.KeyPairGenerator for failover notes - private final static int I_NONE = 1; - private final static int I_RANDOM = 2; - private final static int I_PARAMS = 3; - private final static int I_SIZE = 4; + private static final int I_NONE = 1; + private static final int I_RANDOM = 2; + private static final int I_PARAMS = 3; + private static final int I_SIZE = 4; // The provider private Provider provider; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java --- a/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java Fri Sep 18 09:18:17 2015 -0700 @@ -52,7 +52,7 @@ * * @since 1.4 */ -abstract public +public abstract class HttpsURLConnection extends HttpURLConnection { /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java --- a/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,7 +61,7 @@ * {@code ssl.KeyManagerFactory.algorithm} security property, or an * implementation-specific default if no such property exists. */ - public final static String getDefaultAlgorithm() { + public static final String getDefaultAlgorithm() { String type; type = AccessController.doPrivileged(new PrivilegedAction<>() { @Override diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/net/ssl/SNIHostName.java --- a/src/java.base/share/classes/javax/net/ssl/SNIHostName.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/net/ssl/SNIHostName.java Fri Sep 18 09:18:17 2015 -0700 @@ -321,7 +321,7 @@ } } - private final static class SNIHostNameMatcher extends SNIMatcher { + private static final class SNIHostNameMatcher extends SNIMatcher { // the compiled representation of a regular expression. private final Pattern pattern; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/net/ssl/SSLContext.java --- a/src/java.base/share/classes/javax/net/ssl/SSLContext.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/net/ssl/SSLContext.java Fri Sep 18 09:18:17 2015 -0700 @@ -37,11 +37,13 @@ * secure random bytes. * *

Every implementation of the Java platform is required to support the - * following standard {@code SSLContext} protocol: + * following standard {@code SSLContext} protocols: *

    *
  • {@code TLSv1}
  • + *
  • {@code TLSv1.1}
  • + *
  • {@code TLSv1.2}
  • *
- * This protocol is described in the * SSLContext section of the * Java Cryptography Architecture Standard Algorithm Name Documentation. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java --- a/src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java Fri Sep 18 09:18:17 2015 -0700 @@ -243,7 +243,7 @@ * * @return the return value */ - final public Status getStatus() { + public final Status getStatus() { return status; } @@ -253,7 +253,7 @@ * * @return the handshake status */ - final public HandshakeStatus getHandshakeStatus() { + public final HandshakeStatus getHandshakeStatus() { return handshakeStatus; } @@ -262,7 +262,7 @@ * * @return the number of bytes consumed. */ - final public int bytesConsumed() { + public final int bytesConsumed() { return bytesConsumed; } @@ -271,7 +271,7 @@ * * @return the number of bytes produced */ - final public int bytesProduced() { + public final int bytesProduced() { return bytesProduced; } @@ -306,7 +306,7 @@ * * @since 9 */ - final public long sequenceNumber() { + public final long sequenceNumber() { return sequenceNumber; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java --- a/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2012, 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 @@ -34,7 +34,19 @@ * This class acts as a factory for trust managers based on a * source of trust material. Each trust manager manages a specific * type of trust material for use by secure sockets. The trust - * material is based on a KeyStore and/or provider specific sources. + * material is based on a KeyStore and/or provider-specific sources. + * + *

Every implementation of the Java platform is required to support the + * following standard {@code TrustManagerFactory} algorithm: + *

    + *
  • PKIX
  • + *
+ * This algorithm is described in the + * TrustManagerFactory section of the + * Java Cryptography Architecture Standard Algorithm Name Documentation. + * Consult the release documentation for your implementation to see if any + * other algorithms are supported. * * @since 1.4 * @see TrustManager @@ -61,7 +73,7 @@ * {@code ssl.TrustManagerFactory.algorithm} security property, or an * implementation-specific default if no such property exists. */ - public final static String getDefaultAlgorithm() { + public static final String getDefaultAlgorithm() { String type; type = AccessController.doPrivileged(new PrivilegedAction<>() { @Override diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/javax/security/auth/Policy.java --- a/src/java.base/share/classes/javax/security/auth/Policy.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/javax/security/auth/Policy.java Fri Sep 18 09:18:17 2015 -0700 @@ -159,7 +159,7 @@ public abstract class Policy { private static Policy policy; - private final static String AUTH_POLICY = + private static final String AUTH_POLICY = "sun.security.provider.AuthPolicyFile"; private final java.security.AccessControlContext acc = diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java --- a/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/jimage/BasicImageReader.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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 @@ -34,7 +34,7 @@ import java.util.Comparator; import java.util.stream.IntStream; -public class BasicImageReader { +public class BasicImageReader implements AutoCloseable { private final String imagePath; private final ImageSubstrate substrate; private final ByteOrder byteOrder; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java --- a/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java Fri Sep 18 09:18:17 2015 -0700 @@ -35,7 +35,7 @@ public static final String BOOT_NAME = "bootmodules"; public static final String BOOT_IMAGE_NAME = BOOT_NAME + IMAGE_EXT; - private final static int RETRY_LIMIT = 1000; + private static final int RETRY_LIMIT = 1000; private ByteOrder byteOrder; private ImageStringsWriter strings; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/jimage/ImageLocationBase.java --- a/src/java.base/share/classes/jdk/internal/jimage/ImageLocationBase.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/jimage/ImageLocationBase.java Fri Sep 18 09:18:17 2015 -0700 @@ -26,15 +26,15 @@ package jdk.internal.jimage; public class ImageLocationBase { - final static int ATTRIBUTE_END = 0; - final static int ATTRIBUTE_MODULE = 1; - final static int ATTRIBUTE_PARENT = 2; - final static int ATTRIBUTE_BASE = 3; - final static int ATTRIBUTE_EXTENSION = 4; - final static int ATTRIBUTE_OFFSET = 5; - final static int ATTRIBUTE_COMPRESSED = 6; - final static int ATTRIBUTE_UNCOMPRESSED = 7; - final static int ATTRIBUTE_COUNT = 8; + static final int ATTRIBUTE_END = 0; + static final int ATTRIBUTE_MODULE = 1; + static final int ATTRIBUTE_PARENT = 2; + static final int ATTRIBUTE_BASE = 3; + static final int ATTRIBUTE_EXTENSION = 4; + static final int ATTRIBUTE_OFFSET = 5; + static final int ATTRIBUTE_COMPRESSED = 6; + static final int ATTRIBUTE_UNCOMPRESSED = 7; + static final int ATTRIBUTE_COUNT = 8; protected final long[] attributes; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/jimage/ImageModuleData.java --- a/src/java.base/share/classes/jdk/internal/jimage/ImageModuleData.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/jimage/ImageModuleData.java Fri Sep 18 09:18:17 2015 -0700 @@ -63,19 +63,19 @@ * Offset to package name in string table */ -final public class ImageModuleData { - public final static String META_DATA_EXTENSION = ".jdata"; - public final static String SEPARATOR = "\t"; - public final static int NOT_FOUND = -1; - private final static int ptmCountOffset = 0; - private final static int mtpCountOffset = 1; - private final static int ptmRedirectOffset = 2; - private final static int dataNameOffset = 0; - private final static int ptmDataWidth = 2; - private final static int ptmDataModuleOffset = 1; - private final static int mtpDataWidth = 3; - private final static int mtpDataCountOffset = 1; - private final static int mtpDataOffsetOffset = 2; +public final class ImageModuleData { + public static final String META_DATA_EXTENSION = ".jdata"; + public static final String SEPARATOR = "\t"; + public static final int NOT_FOUND = -1; + private static final int ptmCountOffset = 0; + private static final int mtpCountOffset = 1; + private static final int ptmRedirectOffset = 2; + private static final int dataNameOffset = 0; + private static final int ptmDataWidth = 2; + private static final int ptmDataModuleOffset = 1; + private static final int mtpDataWidth = 3; + private static final int mtpDataCountOffset = 1; + private static final int mtpDataOffsetOffset = 2; private final BasicImageReader reader; private final IntBuffer intBuffer; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/jimage/ImageNativeSubstrate.java --- a/src/java.base/share/classes/jdk/internal/jimage/ImageNativeSubstrate.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/jimage/ImageNativeSubstrate.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2014, 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,7 +30,18 @@ import sun.misc.JavaNioAccess; import sun.misc.SharedSecrets; -final class ImageNativeSubstrate implements ImageSubstrate { +public final class ImageNativeSubstrate implements ImageSubstrate { + static { + java.security.AccessController.doPrivileged( + new java.security.PrivilegedAction() { + @Override + public Void run() { + System.loadLibrary("jimage"); + return null; + } + }); + } + private static final JavaNioAccess NIOACCESS = SharedSecrets.getJavaNioAccess(); @@ -38,19 +49,33 @@ private final long indexAddress; private final long dataAddress; - native static long openImage(String imagePath, boolean bigEndian); - native static void closeImage(long id); - native static long getIndexAddress(long id); - native static long getDataAddress(long id); - native static boolean readCompressed(long id, long offset, + static native long openImage(String imagePath, boolean bigEndian); + static native void closeImage(long id); + static native long getIndexAddress(long id); + static native long getDataAddress(long id); + static native boolean readCompressed(long id, long offset, ByteBuffer compressedBuffer, long compressedSize, ByteBuffer uncompressedBuffer, long uncompressedSize); - native static boolean read(long id, long offset, + static native boolean read(long id, long offset, ByteBuffer uncompressedBuffer, long uncompressedSize); - native static byte[] getStringBytes(long id, int offset); - native static long[] getAttributes(long id, int offset); - native static long[] findAttributes(long id, byte[] path); - native static int[] attributeOffsets(long id); + static native byte[] getStringBytes(long id, int offset); + static native long[] getAttributes(long id, int offset); + static native long[] findAttributes(long id, byte[] path); + static native int[] attributeOffsets(long id); + + public static native long JIMAGE_Open(String path) throws IOException; + public static native void JIMAGE_Close(long jimageHandle); + public static native long JIMAGE_FindResource(long jimageHandle, + String moduleName, String Version, String path, + long[] size); + public static native long JIMAGE_GetResource(long jimageHandle, + long locationHandle, byte[] buffer, long size); + // Get an array of names that match; return the count found upto array size + public static native int JIMAGE_Resources(long jimageHandle, + String[] outputNames); + // Return the module name for the package + public static native String JIMAGE_PackageToModule(long imageHandle, + String packageName); static ByteBuffer newDirectByteBuffer(long address, long capacity) { assert capacity < Integer.MAX_VALUE; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/jimage/ImageReader.java --- a/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java Fri Sep 18 09:18:17 2015 -0700 @@ -129,7 +129,7 @@ // jimage file does not store directory structure. We build nodes // using the "path" strings found in the jimage file. // Node can be a directory or a resource - public static abstract class Node { + public abstract static class Node { private static final int ROOT_DIR = 0b0000_0000_0000_0001; private static final int PACKAGES_DIR = 0b0000_0000_0000_0010; private static final int MODULES_DIR = 0b0000_0000_0000_0100; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/jimage/PerfectHashBuilder.java --- a/src/java.base/share/classes/jdk/internal/jimage/PerfectHashBuilder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/jimage/PerfectHashBuilder.java Fri Sep 18 09:18:17 2015 -0700 @@ -33,7 +33,7 @@ import java.util.Map; public class PerfectHashBuilder { - private final static int RETRY_LIMIT = 1000; + private static final int RETRY_LIMIT = 1000; private Class entryComponent; private Class bucketComponent; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypePath.java --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypePath.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypePath.java Fri Sep 18 09:18:17 2015 -0700 @@ -71,25 +71,25 @@ * A type path step that steps into the element type of an array type. See * {@link #getStep getStep}. */ - public final static int ARRAY_ELEMENT = 0; + public static final int ARRAY_ELEMENT = 0; /** * A type path step that steps into the nested type of a class type. See * {@link #getStep getStep}. */ - public final static int INNER_TYPE = 1; + public static final int INNER_TYPE = 1; /** * A type path step that steps into the bound of a wildcard type. See * {@link #getStep getStep}. */ - public final static int WILDCARD_BOUND = 2; + public static final int WILDCARD_BOUND = 2; /** * A type path step that steps into a type argument of a generic type. See * {@link #getStep getStep}. */ - public final static int TYPE_ARGUMENT = 3; + public static final int TYPE_ARGUMENT = 3; /** * The byte array where the path is stored, in Java class file format. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypeReference.java --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypeReference.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypeReference.java Fri Sep 18 09:18:17 2015 -0700 @@ -74,133 +74,133 @@ * The sort of type references that target a type parameter of a generic * class. See {@link #getSort getSort}. */ - public final static int CLASS_TYPE_PARAMETER = 0x00; + public static final int CLASS_TYPE_PARAMETER = 0x00; /** * The sort of type references that target a type parameter of a generic * method. See {@link #getSort getSort}. */ - public final static int METHOD_TYPE_PARAMETER = 0x01; + public static final int METHOD_TYPE_PARAMETER = 0x01; /** * The sort of type references that target the super class of a class or one * of the interfaces it implements. See {@link #getSort getSort}. */ - public final static int CLASS_EXTENDS = 0x10; + public static final int CLASS_EXTENDS = 0x10; /** * The sort of type references that target a bound of a type parameter of a * generic class. See {@link #getSort getSort}. */ - public final static int CLASS_TYPE_PARAMETER_BOUND = 0x11; + public static final int CLASS_TYPE_PARAMETER_BOUND = 0x11; /** * The sort of type references that target a bound of a type parameter of a * generic method. See {@link #getSort getSort}. */ - public final static int METHOD_TYPE_PARAMETER_BOUND = 0x12; + public static final int METHOD_TYPE_PARAMETER_BOUND = 0x12; /** * The sort of type references that target the type of a field. See * {@link #getSort getSort}. */ - public final static int FIELD = 0x13; + public static final int FIELD = 0x13; /** * The sort of type references that target the return type of a method. See * {@link #getSort getSort}. */ - public final static int METHOD_RETURN = 0x14; + public static final int METHOD_RETURN = 0x14; /** * The sort of type references that target the receiver type of a method. * See {@link #getSort getSort}. */ - public final static int METHOD_RECEIVER = 0x15; + public static final int METHOD_RECEIVER = 0x15; /** * The sort of type references that target the type of a formal parameter of * a method. See {@link #getSort getSort}. */ - public final static int METHOD_FORMAL_PARAMETER = 0x16; + public static final int METHOD_FORMAL_PARAMETER = 0x16; /** * The sort of type references that target the type of an exception declared * in the throws clause of a method. See {@link #getSort getSort}. */ - public final static int THROWS = 0x17; + public static final int THROWS = 0x17; /** * The sort of type references that target the type of a local variable in a * method. See {@link #getSort getSort}. */ - public final static int LOCAL_VARIABLE = 0x40; + public static final int LOCAL_VARIABLE = 0x40; /** * The sort of type references that target the type of a resource variable * in a method. See {@link #getSort getSort}. */ - public final static int RESOURCE_VARIABLE = 0x41; + public static final int RESOURCE_VARIABLE = 0x41; /** * The sort of type references that target the type of the exception of a * 'catch' clause in a method. See {@link #getSort getSort}. */ - public final static int EXCEPTION_PARAMETER = 0x42; + public static final int EXCEPTION_PARAMETER = 0x42; /** * The sort of type references that target the type declared in an * 'instanceof' instruction. See {@link #getSort getSort}. */ - public final static int INSTANCEOF = 0x43; + public static final int INSTANCEOF = 0x43; /** * The sort of type references that target the type of the object created by * a 'new' instruction. See {@link #getSort getSort}. */ - public final static int NEW = 0x44; + public static final int NEW = 0x44; /** * The sort of type references that target the receiver type of a * constructor reference. See {@link #getSort getSort}. */ - public final static int CONSTRUCTOR_REFERENCE = 0x45; + public static final int CONSTRUCTOR_REFERENCE = 0x45; /** * The sort of type references that target the receiver type of a method * reference. See {@link #getSort getSort}. */ - public final static int METHOD_REFERENCE = 0x46; + public static final int METHOD_REFERENCE = 0x46; /** * The sort of type references that target the type declared in an explicit * or implicit cast instruction. See {@link #getSort getSort}. */ - public final static int CAST = 0x47; + public static final int CAST = 0x47; /** * The sort of type references that target a type parameter of a generic * constructor in a constructor call. See {@link #getSort getSort}. */ - public final static int CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 0x48; + public static final int CONSTRUCTOR_INVOCATION_TYPE_ARGUMENT = 0x48; /** * The sort of type references that target a type parameter of a generic * method in a method call. See {@link #getSort getSort}. */ - public final static int METHOD_INVOCATION_TYPE_ARGUMENT = 0x49; + public static final int METHOD_INVOCATION_TYPE_ARGUMENT = 0x49; /** * The sort of type references that target a type parameter of a generic * constructor in a constructor reference. See {@link #getSort getSort}. */ - public final static int CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 0x4A; + public static final int CONSTRUCTOR_REFERENCE_TYPE_ARGUMENT = 0x4A; /** * The sort of type references that target a type parameter of a generic * method in a method reference. See {@link #getSort getSort}. */ - public final static int METHOD_REFERENCE_TYPE_ARGUMENT = 0x4B; + public static final int METHOD_REFERENCE_TYPE_ARGUMENT = 0x4B; /** * The type reference value in Java class file format. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java Fri Sep 18 09:18:17 2015 -0700 @@ -73,7 +73,7 @@ */ public class InstructionAdapter extends MethodVisitor { - public final static Type OBJECT_TYPE = Type.getType("Ljava/lang/Object;"); + public static final Type OBJECT_TYPE = Type.getType("Ljava/lang/Object;"); /** * Creates a new {@link InstructionAdapter}. Subclasses must not use this diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/org/objectweb/asm/signature/SignatureVisitor.java --- a/src/java.base/share/classes/jdk/internal/org/objectweb/asm/signature/SignatureVisitor.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/org/objectweb/asm/signature/SignatureVisitor.java Fri Sep 18 09:18:17 2015 -0700 @@ -88,17 +88,17 @@ /** * Wildcard for an "extends" type argument. */ - public final static char EXTENDS = '+'; + public static final char EXTENDS = '+'; /** * Wildcard for a "super" type argument. */ - public final static char SUPER = '-'; + public static final char SUPER = '-'; /** * Wildcard for a normal type argument. */ - public final static char INSTANCEOF = '='; + public static final char INSTANCEOF = '='; /** * The ASM API version implemented by this visitor. The value of this field diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java --- a/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java Fri Sep 18 09:18:17 2015 -0700 @@ -135,8 +135,8 @@ //////////////////////////////////////////////////////////////////// // Validate while parsing //////////////////////////////////////////////////////////////////// - final static String ALLOWED_ELEMENTS = "properties, comment, entry"; - final static String ALLOWED_COMMENT = "comment"; + static final String ALLOWED_ELEMENTS = "properties, comment, entry"; + static final String ALLOWED_COMMENT = "comment"; //////////////////////////////////////////////////////////////////// // Handler methods //////////////////////////////////////////////////////////////////// diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/util/xml/XMLStreamWriter.java --- a/src/java.base/share/classes/jdk/internal/util/xml/XMLStreamWriter.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/util/xml/XMLStreamWriter.java Fri Sep 18 09:18:17 2015 -0700 @@ -36,8 +36,8 @@ public interface XMLStreamWriter { //Defaults the XML version to 1.0, and the encoding to utf-8 - public final static String DEFAULT_XML_VERSION = "1.0"; - public final static String DEFAULT_ENCODING = "UTF-8"; + public static final String DEFAULT_XML_VERSION = "1.0"; + public static final String DEFAULT_ENCODING = "UTF-8"; /** * Writes a start tag to the output. All writeStartElement methods diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java --- a/src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java Fri Sep 18 09:18:17 2015 -0700 @@ -40,13 +40,13 @@ */ public abstract class Parser { - public final static String FAULT = ""; - protected final static int BUFFSIZE_READER = 512; - protected final static int BUFFSIZE_PARSER = 128; + public static final String FAULT = ""; + protected static final int BUFFSIZE_READER = 512; + protected static final int BUFFSIZE_PARSER = 128; /** * The end of stream character. */ - public final static char EOS = 0xffff; + public static final char EOS = 0xffff; private Pair mNoNS; // there is no namespace private Pair mXml; // the xml namespace private Map mEnt; // the entities look up table @@ -55,26 +55,26 @@ protected boolean mIsSAloneSet; // standalone is explicitely set protected boolean mIsNSAware; // if true - namespace aware mode protected int mPh; // current phase of document processing - protected final static int PH_BEFORE_DOC = -1; // before parsing - protected final static int PH_DOC_START = 0; // document start - protected final static int PH_MISC_DTD = 1; // misc before DTD - protected final static int PH_DTD = 2; // DTD - protected final static int PH_DTD_MISC = 3; // misc after DTD - protected final static int PH_DOCELM = 4; // document's element - protected final static int PH_DOCELM_MISC = 5; // misc after element - protected final static int PH_AFTER_DOC = 6; // after parsing + protected static final int PH_BEFORE_DOC = -1; // before parsing + protected static final int PH_DOC_START = 0; // document start + protected static final int PH_MISC_DTD = 1; // misc before DTD + protected static final int PH_DTD = 2; // DTD + protected static final int PH_DTD_MISC = 3; // misc after DTD + protected static final int PH_DOCELM = 4; // document's element + protected static final int PH_DOCELM_MISC = 5; // misc after element + protected static final int PH_AFTER_DOC = 6; // after parsing protected int mEvt; // current event type - protected final static int EV_NULL = 0; // unknown - protected final static int EV_ELM = 1; // empty element - protected final static int EV_ELMS = 2; // start element - protected final static int EV_ELME = 3; // end element - protected final static int EV_TEXT = 4; // textual content - protected final static int EV_WSPC = 5; // white space content - protected final static int EV_PI = 6; // processing instruction - protected final static int EV_CDAT = 7; // character data - protected final static int EV_COMM = 8; // comment - protected final static int EV_DTD = 9; // document type definition - protected final static int EV_ENT = 10; // skipped entity + protected static final int EV_NULL = 0; // unknown + protected static final int EV_ELM = 1; // empty element + protected static final int EV_ELMS = 2; // start element + protected static final int EV_ELME = 3; // end element + protected static final int EV_TEXT = 4; // textual content + protected static final int EV_WSPC = 5; // white space content + protected static final int EV_PI = 6; // processing instruction + protected static final int EV_CDAT = 7; // character data + protected static final int EV_COMM = 8; // comment + protected static final int EV_DTD = 9; // document type definition + protected static final int EV_ENT = 10; // skipped entity private char mESt; // built-in entity recognizer state // mESt values: // 0x100 : the initial state @@ -120,9 +120,9 @@ /** * Default prefixes */ - private final static char NONS[]; - private final static char XML[]; - private final static char XMLNS[]; + private static final char NONS[]; + private static final char XML[]; + private static final char XMLNS[]; static { NONS = new char[1]; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java --- a/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java Fri Sep 18 09:18:17 2015 -0700 @@ -56,9 +56,9 @@ final class ParserSAX extends Parser implements XMLReader, Locator { - public final static String FEATURE_NS = + public static final String FEATURE_NS = "http://xml.org/sax/features/namespaces"; - public final static String FEATURE_PREF = + public static final String FEATURE_PREF = "http://xml.org/sax/features/namespace-prefixes"; // SAX feature flags private boolean mFNamespaces; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/jdk/net/Sockets.java --- a/src/java.base/share/classes/jdk/net/Sockets.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/jdk/net/Sockets.java Fri Sep 18 09:18:17 2015 -0700 @@ -58,7 +58,7 @@ @jdk.Exported public class Sockets { - private final static HashMap,Set>> + private static final HashMap,Set>> options = new HashMap<>(); static { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java --- a/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java Fri Sep 18 09:18:17 2015 -0700 @@ -192,7 +192,7 @@ private static sun.misc.Unsafe unsafe = sun.misc.Unsafe.getUnsafe(); // preceding line requires that this class be on the boot class path - static private final Method defineAnonymousClass; + private static final Method defineAnonymousClass; static { Method dac = null; Class unsafeClass = unsafe.getClass(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java --- a/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java Fri Sep 18 09:18:17 2015 -0700 @@ -411,7 +411,7 @@ patchArray[index] = addSemis(className, memberName, signature); } - static private final int CONSTANT_MemberRef_MASK = + private static final int CONSTANT_MemberRef_MASK = CONSTANT_Fieldref | CONSTANT_Methodref | CONSTANT_InterfaceMethodref; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java --- a/src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java Fri Sep 18 09:18:17 2015 -0700 @@ -67,11 +67,11 @@ return ptypes; } - static private void parseError(String str, String msg) { + private static void parseError(String str, String msg) { throw new IllegalArgumentException("bad signature: "+str+": "+msg); } - static private Class parseSig(String str, int[] i, int end, ClassLoader loader) { + private static Class parseSig(String str, int[] i, int end, ClassLoader loader) { if (i[0] == end) return null; char c = str.charAt(i[0]++); if (c == 'L') { @@ -122,7 +122,7 @@ return sb.toString(); } - static private void unparseSig(Class t, StringBuilder sb) { + private static void unparseSig(Class t, StringBuilder sb) { char c = Wrapper.forBasicType(t).basicTypeChar(); if (c != 'L') { sb.append(c); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/invoke/util/ValueConversions.java --- a/src/java.base/share/classes/sun/invoke/util/ValueConversions.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/invoke/util/ValueConversions.java Fri Sep 18 09:18:17 2015 -0700 @@ -215,7 +215,7 @@ return unbox(type, 3); } - static private final Integer ZERO_INT = 0, ONE_INT = 1; + private static final Integer ZERO_INT = 0, ONE_INT = 1; /// Primitive conversions /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/invoke/util/Wrapper.java --- a/src/java.base/share/classes/sun/invoke/util/Wrapper.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/invoke/util/Wrapper.java Fri Sep 18 09:18:17 2015 -0700 @@ -69,7 +69,7 @@ "0x"+Integer.toHexString(format)); } - private static abstract class Format { + private abstract static class Format { static final int SLOT_SHIFT = 0, SIZE_SHIFT = 2, KIND_SHIFT = 12; static final int SIGNED = (-1) << KIND_SHIFT, diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/launcher/LauncherHelper.java --- a/src/java.base/share/classes/sun/launcher/LauncherHelper.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/launcher/LauncherHelper.java Fri Sep 18 09:18:17 2015 -0700 @@ -88,7 +88,7 @@ // sync with java.c and sun.misc.VM private static final String diagprop = "sun.java.launcher.diag"; - final static boolean trace = sun.misc.VM.getSavedProperty(diagprop) != null; + static final boolean trace = sun.misc.VM.getSavedProperty(diagprop) != null; private static final String defaultBundleName = "sun.launcher.resources.launcher"; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/BASE64Decoder.java --- a/src/java.base/share/classes/sun/misc/BASE64Decoder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/BASE64Decoder.java Fri Sep 18 09:18:17 2015 -0700 @@ -74,7 +74,7 @@ * This character array provides the character to value map * based on RFC1521. */ - private final static char pem_array[] = { + private static final char pem_array[] = { // 0 1 2 3 4 5 6 7 'A','B','C','D','E','F','G','H', // 0 'I','J','K','L','M','N','O','P', // 1 @@ -86,7 +86,7 @@ '4','5','6','7','8','9','+','/' // 7 }; - private final static byte pem_convert_array[] = new byte[256]; + private static final byte pem_convert_array[] = new byte[256]; static { for (int i = 0; i < 255; i++) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/BASE64Encoder.java --- a/src/java.base/share/classes/sun/misc/BASE64Encoder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/BASE64Encoder.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,7 +61,7 @@ } /** This array maps the characters to their 6 bit values */ - private final static char pem_array[] = { + private static final char pem_array[] = { // 0 1 2 3 4 5 6 7 'A','B','C','D','E','F','G','H', // 0 'I','J','K','L','M','N','O','P', // 1 diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/CharacterDecoder.java --- a/src/java.base/share/classes/sun/misc/CharacterDecoder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/CharacterDecoder.java Fri Sep 18 09:18:17 2015 -0700 @@ -88,10 +88,10 @@ public abstract class CharacterDecoder { /** Return the number of bytes per atom of decoding */ - abstract protected int bytesPerAtom(); + protected abstract int bytesPerAtom(); /** Return the maximum number of bytes that can be encoded per line */ - abstract protected int bytesPerLine(); + protected abstract int bytesPerLine(); /** decode the beginning of the buffer, by default this is a NOP. */ protected void decodeBufferPrefix(PushbackInputStream aStream, OutputStream bStream) throws IOException { } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/CharacterEncoder.java --- a/src/java.base/share/classes/sun/misc/CharacterEncoder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/CharacterEncoder.java Fri Sep 18 09:18:17 2015 -0700 @@ -79,10 +79,10 @@ protected PrintStream pStream; /** Return the number of bytes per atom of encoding */ - abstract protected int bytesPerAtom(); + protected abstract int bytesPerAtom(); /** Return the number of bytes that can be encoded per line */ - abstract protected int bytesPerLine(); + protected abstract int bytesPerLine(); /** * Encode the prefix for the entire buffer. By default is simply @@ -114,7 +114,7 @@ } /** Encode one "atom" of information into characters. */ - abstract protected void encodeAtom(OutputStream aStream, byte someBytes[], + protected abstract void encodeAtom(OutputStream aStream, byte someBytes[], int anOffset, int aLength) throws IOException; /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/Cleaner.java --- a/src/java.base/share/classes/sun/misc/Cleaner.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/Cleaner.java Fri Sep 18 09:18:17 2015 -0700 @@ -69,7 +69,7 @@ // Doubly-linked list of live cleaners, which prevents the cleaners // themselves from being GC'd before their referents // - static private Cleaner first = null; + private static Cleaner first = null; private Cleaner next = null, diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/FDBigInteger.java --- a/src/java.base/share/classes/sun/misc/FDBigInteger.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/FDBigInteger.java Fri Sep 18 09:18:17 2015 -0700 @@ -144,7 +144,7 @@ } // Constant for casting an int to a long via bitwise AND. - private final static long LONG_MASK = 0xffffffffL; + private static final long LONG_MASK = 0xffffffffL; //@ spec_public non_null; private int data[]; // value: data[0] is least significant diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/FloatingDecimal.java --- a/src/java.base/share/classes/sun/misc/FloatingDecimal.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/FloatingDecimal.java Fri Sep 18 09:18:17 2015 -0700 @@ -187,7 +187,7 @@ * and infinite values. */ private static class ExceptionalBinaryToASCIIBuffer implements BinaryToASCIIConverter { - final private String image; + private final String image; private boolean isNegative; public ExceptionalBinaryToASCIIBuffer(String image, boolean isNegative) { @@ -1003,8 +1003,8 @@ * A ASCIIToBinaryConverter container for a double. */ static class PreparedASCIIToBinaryBuffer implements ASCIIToBinaryConverter { - final private double doubleVal; - final private float floatVal; + private final double doubleVal; + private final float floatVal; public PreparedASCIIToBinaryBuffer(double doubleVal, float floatVal) { this.doubleVal = doubleVal; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/LRUCache.java --- a/src/java.base/share/classes/sun/misc/LRUCache.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/LRUCache.java Fri Sep 18 09:18:17 2015 -0700 @@ -39,9 +39,9 @@ this.size = size; } - abstract protected V create(N name); + protected abstract V create(N name); - abstract protected boolean hasName(V ob, N name); + protected abstract boolean hasName(V ob, N name); public static void moveToFront(Object[] oa, int i) { Object ob = oa[i]; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/PerfCounter.java --- a/src/java.base/share/classes/sun/misc/PerfCounter.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/PerfCounter.java Fri Sep 18 09:18:17 2015 -0700 @@ -52,10 +52,10 @@ AccessController.doPrivileged(new Perf.GetPerfAction()); // Must match values defined in hotspot/src/share/vm/runtime/perfdata.hpp - private final static int V_Constant = 1; - private final static int V_Monotonic = 2; - private final static int V_Variable = 3; - private final static int U_None = 1; + private static final int V_Constant = 1; + private static final int V_Monotonic = 2; + private static final int V_Variable = 3; + private static final int U_None = 1; private final String name; private final LongBuffer lb; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/ProxyGenerator.java --- a/src/java.base/share/classes/sun/misc/ProxyGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/ProxyGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -305,13 +305,13 @@ // end of constants copied from sun.tools.java.RuntimeConstants /** name of the superclass of proxy classes */ - private final static String superclassName = "java/lang/reflect/Proxy"; + private static final String superclassName = "java/lang/reflect/Proxy"; /** name of field for storing a proxy instance's invocation handler */ - private final static String handlerFieldName = "h"; + private static final String handlerFieldName = "h"; /** debugging flag for saving generated class files */ - private final static boolean saveGeneratedFiles = + private static final boolean saveGeneratedFiles = java.security.AccessController.doPrivileged( new GetBooleanAction( "sun.misc.ProxyGenerator.saveGeneratedFiles")).booleanValue(); @@ -1913,7 +1913,7 @@ * that can be stored in the "pool" list; its purpose is to define a * common method for writing constant pool entries to a class file. */ - private static abstract class Entry { + private abstract static class Entry { public abstract void write(DataOutputStream out) throws IOException; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/Request.java --- a/src/java.base/share/classes/sun/misc/Request.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/Request.java Fri Sep 18 09:18:17 2015 -0700 @@ -32,10 +32,10 @@ * @author Steven B. Byrne */ -abstract public class Request { +public abstract class Request { /** * The main task of the Request object is to be exectuted from a request * queue. */ - abstract public void execute(); + public abstract void execute(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/SoftCache.java --- a/src/java.base/share/classes/sun/misc/SoftCache.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/SoftCache.java Fri Sep 18 09:18:17 2015 -0700 @@ -117,9 +117,9 @@ */ - static private class ValueCell extends SoftReference { - static private Object INVALID_KEY = new Object(); - static private int dropped = 0; + private static class ValueCell extends SoftReference { + private static Object INVALID_KEY = new Object(); + private static int dropped = 0; private Object key; private ValueCell(Object key, Object value, ReferenceQueue queue) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/UCDecoder.java --- a/src/java.base/share/classes/sun/misc/UCDecoder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/UCDecoder.java Fri Sep 18 09:18:17 2015 -0700 @@ -95,7 +95,7 @@ } /* this is the UCE mapping of 0-63 to characters .. */ - private final static byte map_array[] = { + private static final byte map_array[] = { // 0 1 2 3 4 5 6 7 (byte)'0',(byte)'1',(byte)'2',(byte)'3',(byte)'4',(byte)'5',(byte)'6',(byte)'7', // 0 (byte)'8',(byte)'9',(byte)'A',(byte)'B',(byte)'C',(byte)'D',(byte)'E',(byte)'F', // 1 diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/UCEncoder.java --- a/src/java.base/share/classes/sun/misc/UCEncoder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/UCEncoder.java Fri Sep 18 09:18:17 2015 -0700 @@ -86,7 +86,7 @@ } /* this is the UCE mapping of 0-63 to characters .. */ - private final static byte map_array[] = { + private static final byte map_array[] = { // 0 1 2 3 4 5 6 7 (byte)'0',(byte)'1',(byte)'2',(byte)'3',(byte)'4',(byte)'5',(byte)'6',(byte)'7', // 0 (byte)'8',(byte)'9',(byte)'A',(byte)'B',(byte)'C',(byte)'D',(byte)'E',(byte)'F', // 1 diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/misc/VM.java --- a/src/java.base/share/classes/sun/misc/VM.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/misc/VM.java Fri Sep 18 09:18:17 2015 -0700 @@ -354,12 +354,12 @@ * in the hotspot implementation. Its value is set according to * the JVM TI specification GetThreadState function. */ - private final static int JVMTI_THREAD_STATE_ALIVE = 0x0001; - private final static int JVMTI_THREAD_STATE_TERMINATED = 0x0002; - private final static int JVMTI_THREAD_STATE_RUNNABLE = 0x0004; - private final static int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400; - private final static int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010; - private final static int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020; + private static final int JVMTI_THREAD_STATE_ALIVE = 0x0001; + private static final int JVMTI_THREAD_STATE_TERMINATED = 0x0002; + private static final int JVMTI_THREAD_STATE_RUNNABLE = 0x0004; + private static final int JVMTI_THREAD_STATE_BLOCKED_ON_MONITOR_ENTER = 0x0400; + private static final int JVMTI_THREAD_STATE_WAITING_INDEFINITELY = 0x0010; + private static final int JVMTI_THREAD_STATE_WAITING_WITH_TIMEOUT = 0x0020; /* * Returns the first non-null class loader up the execution stack, @@ -435,5 +435,5 @@ static { initialize(); } - private native static void initialize(); + private static native void initialize(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/NetProperties.java --- a/src/java.base/share/classes/sun/net/NetProperties.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/NetProperties.java Fri Sep 18 09:18:17 2015 -0700 @@ -39,7 +39,7 @@ */ public class NetProperties { - static private Properties props = new Properties(); + private static Properties props = new Properties(); static { AccessController.doPrivileged( new PrivilegedAction() { @@ -56,7 +56,7 @@ * Loads the default networking system properties * the file is in jre/lib/net.properties */ - static private void loadDefaultProperties() { + private static void loadDefaultProperties() { String fname = System.getProperty("java.home"); if (fname == null) { throw new Error("Can't find java.home ??"); @@ -86,7 +86,7 @@ * @return the String value for the property, * or null */ - static public String get(String key) { + public static String get(String key) { String def = props.getProperty(key); try { return System.getProperty(key, def); @@ -108,7 +108,7 @@ * @return the Integer value for the property, * or null */ - static public Integer getInteger(String key, int defval) { + public static Integer getInteger(String key, int defval) { String val = null; try { @@ -137,7 +137,7 @@ * @return the Boolean value for the property, * or null */ - static public Boolean getBoolean(String key) { + public static Boolean getBoolean(String key) { String val = null; try { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/NetworkServer.java --- a/src/java.base/share/classes/sun/net/NetworkServer.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/NetworkServer.java Fri Sep 18 09:18:17 2015 -0700 @@ -62,7 +62,7 @@ return clientSocket != null; } - final public void run() { + public final void run() { if (serverSocket != null) { Thread.currentThread().setPriority(Thread.MAX_PRIORITY); // System.out.print("Server starts " + serverSocket + "\n"); @@ -106,7 +106,7 @@ /** Start a server on port port. It will call serviceRequest() for each new connection. */ - final public void startServer(int port) throws IOException { + public final void startServer(int port) throws IOException { serverSocket = new ServerSocket(port, 50); serverInstance = new ManagedLocalsThread(this); serverInstance.start(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/dns/ResolverConfiguration.java --- a/src/java.base/share/classes/sun/net/dns/ResolverConfiguration.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/dns/ResolverConfiguration.java Fri Sep 18 09:18:17 2015 -0700 @@ -84,7 +84,7 @@ * Options representing certain resolver variables of * a {@link ResolverConfiguration}. */ - public static abstract class Options { + public abstract static class Options { /** * Returns the maximum number of attempts the resolver diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java --- a/src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java Fri Sep 18 09:18:17 2015 -0700 @@ -72,7 +72,7 @@ * * Note that the socksProxy should *always* be the last on the list */ - final static String[][] props = { + static final String[][] props = { /* * protocol, Property prefix 1, Property prefix 2, ... */ @@ -353,7 +353,7 @@ } } - private native static boolean init(); + private static native boolean init(); private synchronized native Proxy getSystemProxy(String protocol, String host); /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/util/IPAddressUtil.java --- a/src/java.base/share/classes/sun/net/util/IPAddressUtil.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/util/IPAddressUtil.java Fri Sep 18 09:18:17 2015 -0700 @@ -26,9 +26,9 @@ package sun.net.util; public class IPAddressUtil { - private final static int INADDR4SZ = 4; - private final static int INADDR16SZ = 16; - private final static int INT16SZ = 2; + private static final int INADDR4SZ = 4; + private static final int INADDR16SZ = 16; + private static final int INT16SZ = 2; /* * Converts IPv4 address in its textual presentation form diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/ParseUtil.java --- a/src/java.base/share/classes/sun/net/www/ParseUtil.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/ParseUtil.java Fri Sep 18 09:18:17 2015 -0700 @@ -504,7 +504,7 @@ } } - private final static char[] hexDigits = { + private static final char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/URLConnection.java --- a/src/java.base/share/classes/sun/net/www/URLConnection.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/URLConnection.java Fri Sep 18 09:18:17 2015 -0700 @@ -34,7 +34,7 @@ * @author James Gosling */ -abstract public class URLConnection extends java.net.URLConnection { +public abstract class URLConnection extends java.net.URLConnection { /** The URL that it is connected to */ @@ -236,11 +236,11 @@ private static HashMap proxiedHosts = new HashMap<>(); - public synchronized static void setProxiedHost(String host) { + public static synchronized void setProxiedHost(String host) { proxiedHosts.put(host.toLowerCase(), null); } - public synchronized static boolean isProxiedHost(String host) { + public static synchronized boolean isProxiedHost(String host) { return proxiedHosts.containsKey(host.toLowerCase()); } } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java --- a/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java Fri Sep 18 09:18:17 2015 -0700 @@ -128,7 +128,7 @@ /* * Maximum chunk header size of 2KB + 2 bytes for CRLF */ - private final static int MAX_CHUNK_HEADER_SIZE = 2050; + private static final int MAX_CHUNK_HEADER_SIZE = 2050; /** * State to indicate that next field should be :- diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/http/HttpClient.java --- a/src/java.base/share/classes/sun/net/www/http/HttpClient.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/http/HttpClient.java Fri Sep 18 09:18:17 2015 -0700 @@ -70,7 +70,7 @@ /** return default port number (subclasses may override) */ protected int getDefaultPort () { return httpPortNumber; } - static private int getDefaultPort(String proto) { + private static int getDefaultPort(String proto) { if ("http".equalsIgnoreCase(proto)) return 80; if ("https".equalsIgnoreCase(proto)) @@ -211,7 +211,7 @@ openServer(); } - static protected Proxy newHttpProxy(String proxyHost, int proxyPort, + protected static Proxy newHttpProxy(String proxyHost, int proxyPort, String proto) { if (proxyHost == null || proto == null) return Proxy.NO_PROXY; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/protocol/http/AuthCacheValue.java --- a/src/java.base/share/classes/sun/net/www/protocol/http/AuthCacheValue.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/protocol/http/AuthCacheValue.java Fri Sep 18 09:18:17 2015 -0700 @@ -47,7 +47,7 @@ /** * Caches authentication info entered by user. See cacheKey() */ - static protected AuthCache cache = new AuthCacheImpl(); + protected static AuthCache cache = new AuthCacheImpl(); public static void setAuthCache (AuthCache map) { cache = map; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java --- a/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Fri Sep 18 09:18:17 2015 -0700 @@ -74,7 +74,7 @@ /* AuthCacheValue: */ - transient protected PasswordAuthentication pw; + protected transient PasswordAuthentication pw; public PasswordAuthentication credentials() { return pw; @@ -113,13 +113,13 @@ * at the same time, then all but the first will block until * the first completes its authentication. */ - static private HashMap requests = new HashMap<>(); + private static HashMap requests = new HashMap<>(); /* check if a request for this destination is in progress * return false immediately if not. Otherwise block until * request is finished and return true */ - static private boolean requestIsInProgress (String key) { + private static boolean requestIsInProgress (String key) { if (!serializeAuth) { /* behavior is disabled. Revert to concurrent requests */ return false; @@ -147,7 +147,7 @@ /* signal completion of an authentication (whether it succeeded or not) * so that other threads can continue. */ - static private void requestCompleted (String key) { + private static void requestCompleted (String key) { synchronized (requests) { Thread thread = requests.get(key); if (thread != null && thread == Thread.currentThread()) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java --- a/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Fri Sep 18 09:18:17 2015 -0700 @@ -54,7 +54,7 @@ private String authMethod; - private final static String compatPropName = "http.auth.digest." + + private static final String compatPropName = "http.auth.digest." + "quoteParameters"; // true if http.auth.digest.quoteParameters Net property is true @@ -507,12 +507,12 @@ return finalHash; } - private final static char charArray[] = { + private static final char charArray[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f' }; - private final static String zeroPad[] = { + private static final String zeroPad[] = { // 0 1 2 3 4 5 6 7 "00000000", "0000000", "000000", "00000", "0000", "000", "00", "0" }; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/protocol/http/HttpCallerInfo.java --- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpCallerInfo.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpCallerInfo.java Fri Sep 18 09:18:17 2015 -0700 @@ -42,13 +42,13 @@ * * 2. Schemed: With the scheme field filled, can be used in JGSS-API calls. */ -final public class HttpCallerInfo { +public final class HttpCallerInfo { // All info that an Authenticator needs. - final public URL url; - final public String host, protocol, prompt, scheme; - final public int port; - final public InetAddress addr; - final public RequestorType authType; + public final URL url; + public final String host, protocol, prompt, scheme; + public final int port; + public final InetAddress addr; + public final RequestorType authType; /** * Create a schemed object based on an un-schemed one. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java --- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Fri Sep 18 09:18:17 2015 -0700 @@ -106,11 +106,11 @@ static final boolean validateServer; private StreamingOutputStream strOutputStream; - private final static String RETRY_MSG1 = + private static final String RETRY_MSG1 = "cannot retry due to proxy authentication, in streaming mode"; - private final static String RETRY_MSG2 = + private static final String RETRY_MSG2 = "cannot retry due to server authentication, in streaming mode"; - private final static String RETRY_MSG3 = + private static final String RETRY_MSG3 = "cannot retry due to redirection, in streaming mode"; /* @@ -2857,8 +2857,8 @@ } // constant strings represent set-cookie header names - private final static String SET_COOKIE = "set-cookie"; - private final static String SET_COOKIE2 = "set-cookie2"; + private static final String SET_COOKIE = "set-cookie"; + private static final String SET_COOKIE2 = "set-cookie2"; /** * Returns a filtered version of the given headers value. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java --- a/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java Fri Sep 18 09:18:17 2015 -0700 @@ -47,7 +47,7 @@ private static final long serialVersionUID = 100L; private static final PlatformLogger logger = HttpURLConnection.getHttpLogger(); - final private HttpCallerInfo hci; + private final HttpCallerInfo hci; // These maps are used to manage the GSS availability for diffrent // hosts. The key for both maps is the host name. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/net/www/protocol/https/DefaultHostnameVerifier.java --- a/src/java.base/share/classes/sun/net/www/protocol/https/DefaultHostnameVerifier.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/net/www/protocol/https/DefaultHostnameVerifier.java Fri Sep 18 09:18:17 2015 -0700 @@ -38,7 +38,7 @@ * * @author Xuelei Fan */ -final public class DefaultHostnameVerifier implements HostnameVerifier { +public final class DefaultHostnameVerifier implements HostnameVerifier { public boolean verify(String hostname, SSLSession session) { return false; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/nio/ch/Net.java --- a/src/java.base/share/classes/sun/nio/ch/Net.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/nio/ch/Net.java Fri Sep 18 09:18:17 2015 -0700 @@ -460,9 +460,9 @@ throws IOException; - public final static int SHUT_RD = 0; - public final static int SHUT_WR = 1; - public final static int SHUT_RDWR = 2; + public static final int SHUT_RD = 0; + public static final int SHUT_WR = 1; + public static final int SHUT_RDWR = 2; static native void shutdown(FileDescriptor fd, int how) throws IOException; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/nio/ch/SelectorImpl.java --- a/src/java.base/share/classes/sun/nio/ch/SelectorImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/nio/ch/SelectorImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -159,6 +159,6 @@ protected abstract void implDereg(SelectionKeyImpl ski) throws IOException; - abstract public Selector wakeup(); + public abstract Selector wakeup(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/nio/ch/ThreadPool.java --- a/src/java.base/share/classes/sun/nio/ch/ThreadPool.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/nio/ch/ThreadPool.java Fri Sep 18 09:18:17 2015 -0700 @@ -91,7 +91,7 @@ } private static class DefaultThreadPoolHolder { - final static ThreadPool defaultThreadPool = createDefault(); + static final ThreadPool defaultThreadPool = createDefault(); } // return the default (system-wide) thread pool diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/nio/cs/CharsetMapping.java --- a/src/java.base/share/classes/sun/nio/cs/CharsetMapping.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/nio/cs/CharsetMapping.java Fri Sep 18 09:18:17 2015 -0700 @@ -36,8 +36,8 @@ import java.security.*; public class CharsetMapping { - public final static char UNMAPPABLE_DECODING = '\uFFFD'; - public final static int UNMAPPABLE_ENCODING = 0xFFFD; + public static final char UNMAPPABLE_DECODING = '\uFFFD'; + public static final int UNMAPPABLE_ENCODING = 0xFFFD; char[] b2cSB; //singlebyte b->c char[] b2cDB1; //dobulebyte b->c /db1 @@ -195,13 +195,13 @@ /*****************************************************************************/ // tags of different charset mapping tables - private final static int MAP_SINGLEBYTE = 0x1; // 0..256 : c - private final static int MAP_DOUBLEBYTE1 = 0x2; // min..max: c - private final static int MAP_DOUBLEBYTE2 = 0x3; // min..max: c [DB2] - private final static int MAP_SUPPLEMENT = 0x5; // db,c - private final static int MAP_SUPPLEMENT_C2B = 0x6; // c,db - private final static int MAP_COMPOSITE = 0x7; // db,base,cc - private final static int MAP_INDEXC2B = 0x8; // index table of c->bb + private static final int MAP_SINGLEBYTE = 0x1; // 0..256 : c + private static final int MAP_DOUBLEBYTE1 = 0x2; // min..max: c + private static final int MAP_DOUBLEBYTE2 = 0x3; // min..max: c [DB2] + private static final int MAP_SUPPLEMENT = 0x5; // db,c + private static final int MAP_SUPPLEMENT_C2B = 0x6; // c,db + private static final int MAP_COMPOSITE = 0x7; // db,base,cc + private static final int MAP_INDEXC2B = 0x8; // index table of c->bb private static final boolean readNBytes(InputStream in, byte[] bb, int N) throws IOException diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/nio/cs/DoubleByte.java --- a/src/java.base/share/classes/sun/nio/cs/DoubleByte.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/nio/cs/DoubleByte.java Fri Sep 18 09:18:17 2015 -0700 @@ -102,7 +102,7 @@ public class DoubleByte { - public final static char[] B2C_UNMAPPABLE; + public static final char[] B2C_UNMAPPABLE; static { B2C_UNMAPPABLE = new char[0x100]; Arrays.fill(B2C_UNMAPPABLE, UNMAPPABLE_DECODING); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/nio/cs/SingleByte.java --- a/src/java.base/share/classes/sun/nio/cs/SingleByte.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/nio/cs/SingleByte.java Fri Sep 18 09:18:17 2015 -0700 @@ -46,7 +46,7 @@ return cr; } - final public static class Decoder extends CharsetDecoder + public static final class Decoder extends CharsetDecoder implements ArrayDecoder { private final char[] b2c; @@ -131,7 +131,7 @@ } } - final public static class Encoder extends CharsetEncoder + public static final class Encoder extends CharsetEncoder implements ArrayEncoder { private Surrogate.Parser sgp; private final char[] c2b; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/nio/cs/ThreadLocalCoders.java --- a/src/java.base/share/classes/sun/nio/cs/ThreadLocalCoders.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/nio/cs/ThreadLocalCoders.java Fri Sep 18 09:18:17 2015 -0700 @@ -37,7 +37,7 @@ private static final int CACHE_SIZE = 3; - private static abstract class Cache { + private abstract static class Cache { // Thread-local reference to array of cached objects, in LRU order private ThreadLocal cache = new ThreadLocal<>(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java --- a/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -31,7 +31,7 @@ import sun.misc.Unsafe; /** Base class for sun.misc.Unsafe-based FieldAccessors for final or - volatile static fields. */ + static volatile fields. */ abstract class UnsafeQualifiedStaticFieldAccessorImpl extends UnsafeStaticFieldAccessorImpl diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java --- a/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java Fri Sep 18 09:18:17 2015 -0700 @@ -50,14 +50,14 @@ * implementations) used to send the active negotiated version. The * system property below allows to toggle the behavior. */ - private final static String PROP_NAME = + private static final String PROP_NAME = "com.sun.net.ssl.rsaPreMasterSecretFix"; /* * Default is "false" (old behavior) for compatibility reasons in * SSLv3/TLSv1. Later protocols (TLSv1.1+) do not use this property. */ - private final static boolean rsaPreMasterSecretFix = + private static final boolean rsaPreMasterSecretFix = AccessController.doPrivileged(new PrivilegedAction() { public Boolean run() { String value = System.getProperty(PROP_NAME); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/jca/JCAUtil.java --- a/src/java.base/share/classes/sun/security/jca/JCAUtil.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/jca/JCAUtil.java Fri Sep 18 09:18:17 2015 -0700 @@ -49,7 +49,7 @@ // size of the temporary arrays we use. Should fit into the CPU's 1st // level cache and could be adjusted based on the platform - private final static int ARRAY_SIZE = 4096; + private static final int ARRAY_SIZE = 4096; /** * Get the size of a temporary buffer array to use in order to be diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/jca/ProviderConfig.java --- a/src/java.base/share/classes/sun/security/jca/ProviderConfig.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/jca/ProviderConfig.java Fri Sep 18 09:18:17 2015 -0700 @@ -43,7 +43,7 @@ */ final class ProviderConfig { - private final static sun.security.util.Debug debug = + private static final sun.security.util.Debug debug = sun.security.util.Debug.getInstance("jca", "ProviderConfig"); // suffix for identifying the SunPKCS11-Solaris provider @@ -54,7 +54,7 @@ "${java.home}/conf/security/sunpkcs11-solaris.cfg"; // maximum number of times to try loading a provider before giving up - private final static int MAX_LOAD_TRIES = 30; + private static final int MAX_LOAD_TRIES = 30; // could be provider name (module) or provider class name (legacy) private final String provName; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/jca/ProviderList.java --- a/src/java.base/share/classes/sun/security/jca/ProviderList.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/jca/ProviderList.java Fri Sep 18 09:18:17 2015 -0700 @@ -55,12 +55,12 @@ */ public final class ProviderList { - final static sun.security.util.Debug debug = + static final sun.security.util.Debug debug = sun.security.util.Debug.getInstance("jca", "ProviderList"); - private final static ProviderConfig[] PC0 = new ProviderConfig[0]; + private static final ProviderConfig[] PC0 = new ProviderConfig[0]; - private final static Provider[] P0 = new Provider[0]; + private static final Provider[] P0 = new Provider[0]; // constant for an ProviderList with no elements static final ProviderList EMPTY = new ProviderList(PC0, true); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java --- a/src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java Fri Sep 18 09:18:17 2015 -0700 @@ -186,7 +186,7 @@ */ static final ObjectIdentifier[] PKCS9_OIDS = new ObjectIdentifier[18]; - private final static Class BYTE_ARRAY_CLASS; + private static final Class BYTE_ARRAY_CLASS; static { // static initializer for PKCS9_OIDS for (int i = 1; i < PKCS9_OIDS.length - 2; i++) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java --- a/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Fri Sep 18 09:18:17 2015 -0700 @@ -51,6 +51,8 @@ import java.util.*; import java.security.AlgorithmParameters; +import java.security.InvalidAlgorithmParameterException; +import java.security.InvalidKeyException; import javax.crypto.spec.PBEParameterSpec; import javax.crypto.spec.PBEKeySpec; import javax.crypto.spec.SecretKeySpec; @@ -2060,7 +2062,7 @@ } if (!MessageDigest.isEqual(macData.getDigest(), macResult)) { - throw new SecurityException("Failed PKCS12" + + throw new UnrecoverableKeyException("Failed PKCS12" + " integrity checking"); } } catch (Exception e) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java --- a/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java Fri Sep 18 09:18:17 2015 -0700 @@ -71,7 +71,7 @@ // implemented using a software trap and therefore very slow) private static final boolean bigEndian; - private final static int byteArrayOfs = unsafe.arrayBaseOffset(byte[].class); + private static final int byteArrayOfs = unsafe.arrayBaseOffset(byte[].class); static { boolean scaleOK = ((unsafe.arrayIndexScale(byte[].class) == 1) diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/ConfigFile.java --- a/src/java.base/share/classes/sun/security/provider/ConfigFile.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/ConfigFile.java Fri Sep 18 09:18:17 2015 -0700 @@ -112,7 +112,7 @@ spi.engineRefresh(); } - public final static class Spi extends ConfigurationSpi { + public static final class Spi extends ConfigurationSpi { private URL url; private boolean expandProp = true; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/MD2.java --- a/src/java.base/share/classes/sun/security/provider/MD2.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/MD2.java Fri Sep 18 09:18:17 2015 -0700 @@ -109,7 +109,7 @@ } // substitution table derived from Pi. Copied from the RFC. - private final static int[] S = new int[] { + private static final int[] S = new int[] { 41, 46, 67, 201, 162, 216, 124, 1, 61, 54, 84, 161, 236, 240, 6, 19, 98, 167, 5, 243, 192, 199, 115, 140, 152, 147, 43, 217, 188, 76, 130, 202, 30, 155, 87, 60, 253, 212, 224, 22, 103, 66, 111, 24, @@ -133,7 +133,7 @@ // digest padding. 17 element array. // padding[0] is null // padding[i] is an array of i time the byte value i (i = 1..16) - private final static byte[][] PADDING; + private static final byte[][] PADDING; static { PADDING = new byte[17][]; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/MD4.java --- a/src/java.base/share/classes/sun/security/provider/MD4.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/MD4.java Fri Sep 18 09:18:17 2015 -0700 @@ -62,7 +62,7 @@ private static final int S33 = 11; private static final int S34 = 15; - private final static Provider md4Provider; + private static final Provider md4Provider; static { md4Provider = new Provider("MD4Provider", 1.9d, "MD4 MessageDigest") { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/ParameterCache.java --- a/src/java.base/share/classes/sun/security/provider/ParameterCache.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/ParameterCache.java Fri Sep 18 09:18:17 2015 -0700 @@ -50,10 +50,10 @@ } // cache of DSA parameters - private final static Map dsaCache; + private static final Map dsaCache; // cache of DH parameters - private final static Map dhCache; + private static final Map dhCache; /** * Return cached DSA parameters for the given length combination of diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/SHA.java --- a/src/java.base/share/classes/sun/security/provider/SHA.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/SHA.java Fri Sep 18 09:18:17 2015 -0700 @@ -104,10 +104,10 @@ } // Constants for each round - private final static int round1_kt = 0x5a827999; - private final static int round2_kt = 0x6ed9eba1; - private final static int round3_kt = 0x8f1bbcdc; - private final static int round4_kt = 0xca62c1d6; + private static final int round1_kt = 0x5a827999; + private static final int round2_kt = 0x6ed9eba1; + private static final int round3_kt = 0x8f1bbcdc; + private static final int round4_kt = 0xca62c1d6; /** * Compute a the hash for the current block. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/SecureRandom.java --- a/src/java.base/share/classes/sun/security/provider/SecureRandom.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/SecureRandom.java Fri Sep 18 09:18:17 2015 -0700 @@ -148,7 +148,7 @@ * @param seed the seed. */ @Override - synchronized public void engineSetSeed(byte[] seed) { + public synchronized void engineSetSeed(byte[] seed) { if (state != null) { digest.update(state); for (int i = 0; i < state.length; i++) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/SeedGenerator.java --- a/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Fri Sep 18 09:18:17 2015 -0700 @@ -141,7 +141,7 @@ /** * Fill result with bytes from the queue. Wait for it if it isn't ready. */ - static public void generateSeed(byte[] result) { + public static void generateSeed(byte[] result) { instance.getSeedBytes(result); } @@ -322,7 +322,7 @@ * pushes them into the queue. */ @Override - final public void run() { + public final void run() { try { while (true) { // Queue full? Wait till there's room. @@ -466,7 +466,7 @@ */ private static class BogusThread implements Runnable { @Override - final public void run() { + public final void run() { try { for (int i = 0; i < 5; i++) { Thread.sleep(50); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/SunEntries.java --- a/src/java.base/share/classes/sun/security/provider/SunEntries.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/SunEntries.java Fri Sep 18 09:18:17 2015 -0700 @@ -310,12 +310,12 @@ } // name of the *System* property, takes precedence over PROP_RNDSOURCE - private final static String PROP_EGD = "java.security.egd"; + private static final String PROP_EGD = "java.security.egd"; // name of the *Security* property - private final static String PROP_RNDSOURCE = "securerandom.source"; + private static final String PROP_RNDSOURCE = "securerandom.source"; - final static String URL_DEV_RANDOM = "file:/dev/random"; - final static String URL_DEV_URANDOM = "file:/dev/urandom"; + static final String URL_DEV_RANDOM = "file:/dev/random"; + static final String URL_DEV_URANDOM = "file:/dev/urandom"; private static final String seedSource; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java --- a/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java Fri Sep 18 09:18:17 2015 -0700 @@ -68,16 +68,16 @@ * @see PKIXCertPathChecker * @see PKIXParameters */ -final public class AlgorithmChecker extends PKIXCertPathChecker { +public final class AlgorithmChecker extends PKIXCertPathChecker { private final AlgorithmConstraints constraints; private final PublicKey trustedPubKey; private PublicKey prevPubKey; - private final static Set SIGNATURE_PRIMITIVE_SET = + private static final Set SIGNATURE_PRIMITIVE_SET = Collections.unmodifiableSet(EnumSet.of(CryptoPrimitive.SIGNATURE)); - private final static DisabledAlgorithmConstraints + private static final DisabledAlgorithmConstraints certPathDefaultConstraints = new DisabledAlgorithmConstraints( DisabledAlgorithmConstraints.PROPERTY_CERTPATH_DISABLED_ALGS); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/certpath/Builder.java --- a/src/java.base/share/classes/sun/security/provider/certpath/Builder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/certpath/Builder.java Fri Sep 18 09:18:17 2015 -0700 @@ -63,7 +63,7 @@ * Authority Information Access extension shall be enabled. Currently * disabled by default for compatibility reasons. */ - final static boolean USE_AIA = AccessController.doPrivileged + static final boolean USE_AIA = AccessController.doPrivileged (new GetBooleanAction("com.sun.security.enableAIAcaIssuers")); /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/certpath/ForwardBuilder.java --- a/src/java.base/share/classes/sun/security/provider/certpath/ForwardBuilder.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/certpath/ForwardBuilder.java Fri Sep 18 09:18:17 2015 -0700 @@ -433,7 +433,7 @@ */ static class PKIXCertComparator implements Comparator { - final static String METHOD_NME = "PKIXCertComparator.compare()"; + static final String METHOD_NME = "PKIXCertComparator.compare()"; private final Set trustedSubjectDNs; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java --- a/src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java Fri Sep 18 09:18:17 2015 -0700 @@ -760,7 +760,7 @@ /* * A class representing a single OCSP response. */ - public final static class SingleResponse implements OCSP.RevocationStatus { + public static final class SingleResponse implements OCSP.RevocationStatus { private final CertId certId; private final CertStatus certStatus; private final Date thisUpdate; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java --- a/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java Fri Sep 18 09:18:17 2015 -0700 @@ -91,10 +91,10 @@ // interval between checks for update of cached Certificates/CRLs // (30 seconds) - private final static int CHECK_INTERVAL = 30 * 1000; + private static final int CHECK_INTERVAL = 30 * 1000; // size of the cache (see Cache class for sizing recommendations) - private final static int CACHE_SIZE = 185; + private static final int CACHE_SIZE = 185; // X.509 certificate factory instance private final CertificateFactory factory; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/certpath/UntrustedChecker.java --- a/src/java.base/share/classes/sun/security/provider/certpath/UntrustedChecker.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/certpath/UntrustedChecker.java Fri Sep 18 09:18:17 2015 -0700 @@ -41,7 +41,7 @@ * @see PKIXCertPathChecker * @see PKIXParameters */ -final public class UntrustedChecker extends PKIXCertPathChecker { +public final class UntrustedChecker extends PKIXCertPathChecker { private static final Debug debug = Debug.getInstance("certpath"); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java --- a/src/java.base/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,9 +61,9 @@ public final class SSLServerCertStore extends CertStoreSpi { private final URI uri; - private final static GetChainTrustManager trustManager; - private final static SSLSocketFactory socketFactory; - private final static HostnameVerifier hostnameVerifier; + private static final GetChainTrustManager trustManager; + private static final SSLSocketFactory socketFactory; + private static final HostnameVerifier hostnameVerifier; static { trustManager = new GetChainTrustManager(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/rsa/RSACore.java --- a/src/java.base/share/classes/sun/security/rsa/RSACore.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/rsa/RSACore.java Fri Sep 18 09:18:17 2015 -0700 @@ -51,12 +51,12 @@ public final class RSACore { // globally enable/disable use of blinding - private final static boolean ENABLE_BLINDING = true; + private static final boolean ENABLE_BLINDING = true; // cache for blinding parameters. Map // use a weak hashmap so that cached values are automatically cleared // when the modulus is GC'ed - private final static Map + private static final Map blindingCache = new WeakHashMap<>(); private RSACore() { @@ -311,7 +311,7 @@ * * The total performance cost is small. */ - private final static class BlindingRandomPair { + private static final class BlindingRandomPair { final BigInteger u; final BigInteger v; @@ -332,8 +332,8 @@ * since sharing moduli is fundamentally broken and insecure, this * does not matter. */ - private final static class BlindingParameters { - private final static BigInteger BIG_TWO = BigInteger.valueOf(2L); + private static final class BlindingParameters { + private static final BigInteger BIG_TWO = BigInteger.valueOf(2L); // RSA public exponent private final BigInteger e; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java --- a/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java Fri Sep 18 09:18:17 2015 -0700 @@ -60,18 +60,18 @@ */ public final class RSAKeyFactory extends KeyFactorySpi { - private final static Class rsaPublicKeySpecClass = + private static final Class rsaPublicKeySpecClass = RSAPublicKeySpec.class; - private final static Class rsaPrivateKeySpecClass = + private static final Class rsaPrivateKeySpecClass = RSAPrivateKeySpec.class; - private final static Class rsaPrivateCrtKeySpecClass = + private static final Class rsaPrivateCrtKeySpecClass = RSAPrivateCrtKeySpec.class; - private final static Class x509KeySpecClass = X509EncodedKeySpec.class; - private final static Class pkcs8KeySpecClass = PKCS8EncodedKeySpec.class; + private static final Class x509KeySpecClass = X509EncodedKeySpec.class; + private static final Class pkcs8KeySpecClass = PKCS8EncodedKeySpec.class; - public final static int MIN_MODLEN = 512; - public final static int MAX_MODLEN = 16384; + public static final int MIN_MODLEN = 512; + public static final int MAX_MODLEN = 16384; /* * If the modulus length is above this value, restrict the size of @@ -80,8 +80,8 @@ * this approach allows flexibility in case impls would like to use * larger module and exponent values. */ - public final static int MAX_MODLEN_RESTRICT_EXP = 3072; - public final static int MAX_RESTRICTED_EXPLEN = 64; + public static final int MAX_MODLEN_RESTRICT_EXP = 3072; + public static final int MAX_RESTRICTED_EXPLEN = 64; private static final boolean restrictExpLen = "true".equalsIgnoreCase(AccessController.doPrivileged( @@ -89,7 +89,7 @@ "sun.security.rsa.restrictRSAExponent", "true"))); // instance used for static translateKey(); - private final static RSAKeyFactory INSTANCE = new RSAKeyFactory(); + private static final RSAKeyFactory INSTANCE = new RSAKeyFactory(); public RSAKeyFactory() { // empty diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/rsa/RSAPadding.java --- a/src/java.base/share/classes/sun/security/rsa/RSAPadding.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/rsa/RSAPadding.java Fri Sep 18 09:18:17 2015 -0700 @@ -85,13 +85,13 @@ // file. Do not change without coordinating the update // PKCS#1 v1.5 padding, blocktype 1 (signing) - public final static int PAD_BLOCKTYPE_1 = 1; + public static final int PAD_BLOCKTYPE_1 = 1; // PKCS#1 v1.5 padding, blocktype 2 (encryption) - public final static int PAD_BLOCKTYPE_2 = 2; + public static final int PAD_BLOCKTYPE_2 = 2; // nopadding. Does not do anything, but allows simpler RSACipher code - public final static int PAD_NONE = 3; + public static final int PAD_NONE = 3; // PKCS#1 v2.1 OAEP padding - public final static int PAD_OAEP_MGF1 = 4; + public static final int PAD_OAEP_MGF1 = 4; // type, one of PAD_* private final int type; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java --- a/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -63,7 +63,7 @@ private BigInteger coeff; // CRT coeffcient // algorithmId used to identify RSA keys - final static AlgorithmId rsaId = + static final AlgorithmId rsaId = new AlgorithmId(AlgorithmId.RSAEncryption_oid); /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/AppOutputStream.java --- a/src/java.base/share/classes/sun/security/ssl/AppOutputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/AppOutputStream.java Fri Sep 18 09:18:17 2015 -0700 @@ -49,7 +49,7 @@ * Write the data out, NOW. */ @Override - synchronized public void write(byte[] b, int off, int len) + public synchronized void write(byte[] b, int off, int len) throws IOException { if (b == null) { throw new NullPointerException(); @@ -76,7 +76,7 @@ * Write one byte now. */ @Override - synchronized public void write(int i) throws IOException { + public synchronized void write(int i) throws IOException { oneByte[0] = (byte)i; write(oneByte, 0, 1); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/Authenticator.java --- a/src/java.base/share/classes/sun/security/ssl/Authenticator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/Authenticator.java Fri Sep 18 09:18:17 2015 -0700 @@ -244,7 +244,7 @@ return copy; } - final static long toLong(byte[] recordEnS) { + static final long toLong(byte[] recordEnS) { if (recordEnS != null && recordEnS.length == 8) { return ((recordEnS[0] & 0xFFL) << 56) | ((recordEnS[1] & 0xFFL) << 48) | diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java --- a/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -55,8 +55,8 @@ * recurse infinitely ... e.g. close() calling itself, or doing * I/O in terms of our own streams. */ - final private Socket self; - final private InputStream consumedInput; + private final Socket self; + private final InputStream consumedInput; BaseSSLSocketImpl() { super(); @@ -88,10 +88,10 @@ * * The default is "false", i.e. tolerate the broken behavior. */ - private final static String PROP_NAME = + private static final String PROP_NAME = "com.sun.net.ssl.requireCloseNotify"; - final static boolean requireCloseNotify = + static final boolean requireCloseNotify = Debug.getBooleanProperty(PROP_NAME, false); // diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/CipherBox.java --- a/src/java.base/share/classes/sun/security/ssl/CipherBox.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/CipherBox.java Fri Sep 18 09:18:17 2015 -0700 @@ -93,7 +93,7 @@ final class CipherBox { // A CipherBox that implements the identity operation - final static CipherBox NULL = new CipherBox(); + static final CipherBox NULL = new CipherBox(); /* Class and subclass dynamic debugging support */ private static final Debug debug = Debug.getInstance("ssl"); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/CipherSuite.java --- a/src/java.base/share/classes/sun/security/ssl/CipherSuite.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/CipherSuite.java Fri Sep 18 09:18:17 2015 -0700 @@ -72,27 +72,27 @@ final class CipherSuite implements Comparable { // minimum priority for supported CipherSuites - final static int SUPPORTED_SUITES_PRIORITY = 1; + static final int SUPPORTED_SUITES_PRIORITY = 1; // minimum priority for default enabled CipherSuites - final static int DEFAULT_SUITES_PRIORITY = 300; + static final int DEFAULT_SUITES_PRIORITY = 300; // Flag indicating if CipherSuite availability can change dynamically. // This is the case when we rely on a JCE cipher implementation that // may not be available in the installed JCE providers. // It is true because we might not have an ECC implementation. - final static boolean DYNAMIC_AVAILABILITY = true; + static final boolean DYNAMIC_AVAILABILITY = true; - private final static boolean ALLOW_ECC = Debug.getBooleanProperty + private static final boolean ALLOW_ECC = Debug.getBooleanProperty ("com.sun.net.ssl.enableECC", true); // Map Integer(id) -> CipherSuite // contains all known CipherSuites - private final static Map idMap; + private static final Map idMap; // Map String(name) -> CipherSuite // contains only supported CipherSuites (i.e. allowed == true) - private final static Map nameMap; + private static final Map nameMap; // Protocol defined CipherSuite name, e.g. SSL_RSA_WITH_RC4_128_MD5 // we use TLS_* only for new CipherSuites, still SSL_* for old ones @@ -474,7 +474,7 @@ B_AES_256_GCM(CIPHER_AES_GCM, AEAD_CIPHER, 32, 12, 4, true); // Map BulkCipher -> Boolean(available) - private final static Map availableCache = + private static final Map availableCache = new HashMap<>(8); // descriptive name including key size, e.g. AES/128 @@ -518,7 +518,7 @@ final int tagSize = 16; // The secure random used to detect the cipher availability. - private final static SecureRandom secureRandom; + private static final SecureRandom secureRandom; static { try { @@ -1437,8 +1437,8 @@ } // ciphersuite SSL_NULL_WITH_NULL_NULL - final static CipherSuite C_NULL = CipherSuite.valueOf(0, 0); + static final CipherSuite C_NULL = CipherSuite.valueOf(0, 0); // ciphersuite TLS_EMPTY_RENEGOTIATION_INFO_SCSV - final static CipherSuite C_SCSV = CipherSuite.valueOf(0x00, 0xff); + static final CipherSuite C_SCSV = CipherSuite.valueOf(0x00, 0xff); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/Ciphertext.java --- a/src/java.base/share/classes/sun/security/ssl/Ciphertext.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/Ciphertext.java Fri Sep 18 09:18:17 2015 -0700 @@ -32,7 +32,7 @@ * enumeration of record type */ final class Ciphertext { - final static Ciphertext CIPHERTEXT_NULL = new Ciphertext(); + static final Ciphertext CIPHERTEXT_NULL = new Ciphertext(); RecordType recordType; long recordSN; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java --- a/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Fri Sep 18 09:18:17 2015 -0700 @@ -60,8 +60,8 @@ final class ClientHandshaker extends Handshaker { // constants for subject alt names of type DNS and IP - private final static int ALTNAME_DNS = 2; - private final static int ALTNAME_IP = 7; + private static final int ALTNAME_DNS = 2; + private static final int ALTNAME_IP = 7; // the server's public key from its certificate. private PublicKey serverKey; @@ -98,7 +98,7 @@ private ProtocolVersion maxProtocolVersion; // To switch off the SNI extension. - private final static boolean enableSNIExtension = + private static final boolean enableSNIExtension = Debug.getBooleanProperty("jsse.enableSNIExtension", true); /* @@ -144,11 +144,11 @@ * If the system property is set to "true" explicitly, the restriction on * server certificate change in renegotiation is disabled. */ - private final static boolean allowUnsafeServerCertChange = + private static final boolean allowUnsafeServerCertChange = Debug.getBooleanProperty("jdk.tls.allowUnsafeServerCertChange", false); // To switch off the max_fragment_length extension. - private final static boolean enableMFLExtension = + private static final boolean enableMFLExtension = Debug.getBooleanProperty("jsse.enableMFLExtension", false); private List requestedServerNames = diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/ClientKeyExchange.java --- a/src/java.base/share/classes/sun/security/ssl/ClientKeyExchange.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/ClientKeyExchange.java Fri Sep 18 09:18:17 2015 -0700 @@ -44,17 +44,17 @@ } @Override - abstract public int messageLength(); + public abstract int messageLength(); @Override - abstract public void send(HandshakeOutStream s) throws IOException; + public abstract void send(HandshakeOutStream s) throws IOException; @Override - abstract public void print(PrintStream s) throws IOException; + public abstract void print(PrintStream s) throws IOException; - abstract public SecretKey clientKeyExchange(); + public abstract SecretKey clientKeyExchange(); - abstract public Principal getPeerPrincipal(); + public abstract Principal getPeerPrincipal(); - abstract public Principal getLocalPrincipal(); + public abstract Principal getLocalPrincipal(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java --- a/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java Fri Sep 18 09:18:17 2015 -0700 @@ -77,7 +77,7 @@ } @Override - synchronized public void close() throws IOException { + public synchronized void close() throws IOException { if (!isClosed) { prevReadCipher.dispose(); super.close(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java --- a/src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java Fri Sep 18 09:18:17 2015 -0700 @@ -36,8 +36,8 @@ final class EphemeralKeyManager { // indices for the keys array below - private final static int INDEX_RSA512 = 0; - private final static int INDEX_RSA1024 = 1; + private static final int INDEX_RSA512 = 0; + private static final int INDEX_RSA1024 = 1; /* * Current cached RSA KeyPairs. Elements are never null. @@ -87,10 +87,10 @@ private static class EphemeralKeyPair { // maximum number of times a KeyPair is used - private final static int MAX_USE = 200; + private static final int MAX_USE = 200; // maximum time interval in which the keypair is used (1 hour in ms) - private final static long USE_INTERVAL = 3600*1000; + private static final long USE_INTERVAL = 3600*1000; private KeyPair keyPair; private int uses; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/ExtensionType.java --- a/src/java.base/share/classes/sun/security/ssl/ExtensionType.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/ExtensionType.java Fri Sep 18 09:18:17 2015 -0700 @@ -62,46 +62,46 @@ } // extensions defined in RFC 3546 - final static ExtensionType EXT_SERVER_NAME = + static final ExtensionType EXT_SERVER_NAME = e(0x0000, "server_name"); // IANA registry value: 0 - final static ExtensionType EXT_MAX_FRAGMENT_LENGTH = + static final ExtensionType EXT_MAX_FRAGMENT_LENGTH = e(0x0001, "max_fragment_length"); // IANA registry value: 1 - final static ExtensionType EXT_CLIENT_CERTIFICATE_URL = + static final ExtensionType EXT_CLIENT_CERTIFICATE_URL = e(0x0002, "client_certificate_url"); // IANA registry value: 2 - final static ExtensionType EXT_TRUSTED_CA_KEYS = + static final ExtensionType EXT_TRUSTED_CA_KEYS = e(0x0003, "trusted_ca_keys"); // IANA registry value: 3 - final static ExtensionType EXT_TRUNCATED_HMAC = + static final ExtensionType EXT_TRUNCATED_HMAC = e(0x0004, "truncated_hmac"); // IANA registry value: 4 - final static ExtensionType EXT_STATUS_REQUEST = + static final ExtensionType EXT_STATUS_REQUEST = e(0x0005, "status_request"); // IANA registry value: 5 // extensions defined in RFC 4681 - final static ExtensionType EXT_USER_MAPPING = + static final ExtensionType EXT_USER_MAPPING = e(0x0006, "user_mapping"); // IANA registry value: 6 // extensions defined in RFC 5081 - final static ExtensionType EXT_CERT_TYPE = + static final ExtensionType EXT_CERT_TYPE = e(0x0009, "cert_type"); // IANA registry value: 9 // extensions defined in RFC 4492 (ECC) - final static ExtensionType EXT_ELLIPTIC_CURVES = + static final ExtensionType EXT_ELLIPTIC_CURVES = e(0x000A, "elliptic_curves"); // IANA registry value: 10 - final static ExtensionType EXT_EC_POINT_FORMATS = + static final ExtensionType EXT_EC_POINT_FORMATS = e(0x000B, "ec_point_formats"); // IANA registry value: 11 // extensions defined in RFC 5054 - final static ExtensionType EXT_SRP = + static final ExtensionType EXT_SRP = e(0x000C, "srp"); // IANA registry value: 12 // extensions defined in RFC 5246 - final static ExtensionType EXT_SIGNATURE_ALGORITHMS = + static final ExtensionType EXT_SIGNATURE_ALGORITHMS = e(0x000D, "signature_algorithms"); // IANA registry value: 13 // extensions defined in RFC 6961 - final static ExtensionType EXT_STATUS_REQUEST_V2 = + static final ExtensionType EXT_STATUS_REQUEST_V2 = e(0x0011, "status_request_v2"); // IANA registry value: 17 // extensions defined in RFC 5746 - final static ExtensionType EXT_RENEGOTIATION_INFO = + static final ExtensionType EXT_RENEGOTIATION_INFO = e(0xff01, "renegotiation_info"); // IANA registry value: 65281 } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java --- a/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java Fri Sep 18 09:18:17 2015 -0700 @@ -297,7 +297,7 @@ HelloExtensions extensions = new HelloExtensions(); - private final static byte[] NULL_COMPRESSION = new byte[] {0}; + private static final byte[] NULL_COMPRESSION = new byte[] {0}; ClientHello(SecureRandom generator, ProtocolVersion protocolVersion, SessionId sessionId, CipherSuiteList cipherSuites, @@ -924,7 +924,7 @@ * exchange the premaster secret. That's how RSA_EXPORT often works, * as well as how the DHE_* flavors work. */ -static abstract class ServerKeyExchange extends HandshakeMessage +abstract static class ServerKeyExchange extends HandshakeMessage { @Override int messageType() { return ht_server_key_exchange; } @@ -1077,7 +1077,7 @@ class DH_ServerKeyExchange extends ServerKeyExchange { // Fix message encoding, see 4348279 - private final static boolean dhKeyExchangeFix = + private static final boolean dhKeyExchangeFix = Debug.getBooleanProperty("com.sun.net.ssl.dhKeyExchangeFix", true); private byte[] dh_p; // 1 to 2^16 - 1 bytes @@ -1362,9 +1362,9 @@ class ECDH_ServerKeyExchange extends ServerKeyExchange { // constants for ECCurveType - private final static int CURVE_EXPLICIT_PRIME = 1; - private final static int CURVE_EXPLICIT_CHAR2 = 2; - private final static int CURVE_NAMED_CURVE = 3; + private static final int CURVE_EXPLICIT_PRIME = 1; + private static final int CURVE_EXPLICIT_CHAR2 = 2; + private static final int CURVE_NAMED_CURVE = 3; // id of the curve we are using private int curveId; @@ -1660,8 +1660,8 @@ static final int cct_rsa_fixed_ecdh = 65; static final int cct_ecdsa_fixed_ecdh = 66; - private final static byte[] TYPES_NO_ECC = { cct_rsa_sign, cct_dss_sign }; - private final static byte[] TYPES_ECC = + private static final byte[] TYPES_NO_ECC = { cct_rsa_sign, cct_dss_sign }; + private static final byte[] TYPES_ECC = { cct_rsa_sign, cct_dss_sign, cct_ecdsa_sign }; byte[] types; // 1 to 255 types @@ -2119,8 +2119,8 @@ md.update(temp); } - private final static Class delegate; - private final static Field spiField; + private static final Class delegate; + private static final Field spiField; static { try { @@ -2143,12 +2143,12 @@ } // ConcurrentHashMap does not allow null values, use this marker object - private final static Object NULL_OBJECT = new Object(); + private static final Object NULL_OBJECT = new Object(); // cache Method objects per Spi class // Note that this will prevent the Spi classes from being GC'd. We assume // that is not a problem. - private final static Map,Object> methodCache = + private static final Map,Object> methodCache = new ConcurrentHashMap<>(); private static void digestKey(MessageDigest md, SecretKey key) { @@ -2241,10 +2241,10 @@ static final class Finished extends HandshakeMessage { // constant for a Finished message sent by the client - final static int CLIENT = 1; + static final int CLIENT = 1; // constant for a Finished message sent by the server - final static int SERVER = 2; + static final int SERVER = 2; // enum Sender: "CLNT" and "SRVR" private static final byte[] SSL_CLIENT = { 0x43, 0x4C, 0x4E, 0x54 }; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/HandshakeStateManager.java --- a/src/java.base/share/classes/sun/security/ssl/HandshakeStateManager.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/HandshakeStateManager.java Fri Sep 18 09:18:17 2015 -0700 @@ -218,9 +218,9 @@ private boolean isDTLS; - private final static boolean debugIsOn; + private static final boolean debugIsOn; - private final static HashMap handshakeTypes; + private static final HashMap handshakeTypes; static { debugIsOn = (Handshaker.debug != null) && diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/Handshaker.java --- a/src/java.base/share/classes/sun/security/ssl/Handshaker.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/Handshaker.java Fri Sep 18 09:18:17 2015 -0700 @@ -585,7 +585,7 @@ * * Does not check if the required server certificates are available. */ - final static boolean isNegotiable(CipherSuiteList proposed, CipherSuite s) { + static final boolean isNegotiable(CipherSuiteList proposed, CipherSuite s) { return proposed.contains(s) && s.isNegotiable(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/InputRecord.java --- a/src/java.base/share/classes/sun/security/ssl/InputRecord.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/InputRecord.java Fri Sep 18 09:18:17 2015 -0700 @@ -123,7 +123,7 @@ * and flag the record as holding no data. */ @Override - synchronized public void close() throws IOException { + public synchronized void close() throws IOException { if (!isClosed) { isClosed = true; readCipher.dispose(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/JsseJce.java --- a/src/java.base/share/classes/sun/security/ssl/JsseJce.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/JsseJce.java Fri Sep 18 09:18:17 2015 -0700 @@ -53,7 +53,7 @@ */ final class JsseJce { - private final static ProviderList fipsProviderList; + private static final ProviderList fipsProviderList; // Flag indicating whether EC crypto is available. // If null, then we have not checked yet. @@ -62,7 +62,7 @@ // Flag indicating whether Kerberos crypto is available. // If true, then all the Kerberos-based crypto we need is available. - private final static boolean kerberosAvailable; + private static final boolean kerberosAvailable; static { ClientKeyExchangeService p = ClientKeyExchangeService.find("KRB5"); @@ -119,68 +119,68 @@ * JCE transformation string for RSA with PKCS#1 v1.5 padding. * Can be used for encryption, decryption, signing, verifying. */ - final static String CIPHER_RSA_PKCS1 = "RSA/ECB/PKCS1Padding"; + static final String CIPHER_RSA_PKCS1 = "RSA/ECB/PKCS1Padding"; /** * JCE transformation string for the stream cipher RC4. */ - final static String CIPHER_RC4 = "RC4"; + static final String CIPHER_RC4 = "RC4"; /** * JCE transformation string for DES in CBC mode without padding. */ - final static String CIPHER_DES = "DES/CBC/NoPadding"; + static final String CIPHER_DES = "DES/CBC/NoPadding"; /** * JCE transformation string for (3-key) Triple DES in CBC mode * without padding. */ - final static String CIPHER_3DES = "DESede/CBC/NoPadding"; + static final String CIPHER_3DES = "DESede/CBC/NoPadding"; /** * JCE transformation string for AES in CBC mode * without padding. */ - final static String CIPHER_AES = "AES/CBC/NoPadding"; + static final String CIPHER_AES = "AES/CBC/NoPadding"; /** * JCE transformation string for AES in GCM mode * without padding. */ - final static String CIPHER_AES_GCM = "AES/GCM/NoPadding"; + static final String CIPHER_AES_GCM = "AES/GCM/NoPadding"; /** * JCA identifier string for DSA, i.e. a DSA with SHA-1. */ - final static String SIGNATURE_DSA = "DSA"; + static final String SIGNATURE_DSA = "DSA"; /** * JCA identifier string for ECDSA, i.e. a ECDSA with SHA-1. */ - final static String SIGNATURE_ECDSA = "SHA1withECDSA"; + static final String SIGNATURE_ECDSA = "SHA1withECDSA"; /** * JCA identifier string for Raw DSA, i.e. a DSA signature without * hashing where the application provides the SHA-1 hash of the data. * Note that the standard name is "NONEwithDSA" but we use "RawDSA" * for compatibility. */ - final static String SIGNATURE_RAWDSA = "RawDSA"; + static final String SIGNATURE_RAWDSA = "RawDSA"; /** * JCA identifier string for Raw ECDSA, i.e. a DSA signature without * hashing where the application provides the SHA-1 hash of the data. */ - final static String SIGNATURE_RAWECDSA = "NONEwithECDSA"; + static final String SIGNATURE_RAWECDSA = "NONEwithECDSA"; /** * JCA identifier string for Raw RSA, i.e. a RSA PKCS#1 v1.5 signature * without hashing where the application provides the hash of the data. * Used for RSA client authentication with a 36 byte hash. */ - final static String SIGNATURE_RAWRSA = "NONEwithRSA"; + static final String SIGNATURE_RAWRSA = "NONEwithRSA"; /** * JCA identifier string for the SSL/TLS style RSA Signature. I.e. * an signature using RSA with PKCS#1 v1.5 padding signing a * concatenation of an MD5 and SHA-1 digest. */ - final static String SIGNATURE_SSLRSA = "MD5andSHA1withRSA"; + static final String SIGNATURE_SSLRSA = "MD5andSHA1withRSA"; private JsseJce() { // no instantiation of this class } - synchronized static boolean isEcAvailable() { + static synchronized boolean isEcAvailable() { if (ecAvailable == null) { try { JsseJce.getSignature(SIGNATURE_ECDSA); @@ -196,7 +196,7 @@ return ecAvailable; } - synchronized static void clearEcAvailable() { + static synchronized void clearEcAvailable() { ecAvailable = null; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/MAC.java --- a/src/java.base/share/classes/sun/security/ssl/MAC.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/MAC.java Fri Sep 18 09:18:17 2015 -0700 @@ -49,7 +49,7 @@ */ final class MAC extends Authenticator { - final static MAC TLS_NULL = new MAC(false); + static final MAC TLS_NULL = new MAC(false); // Value of the null MAC is fixed private static final byte[] nullMAC = new byte[0]; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/OutputRecord.java --- a/src/java.base/share/classes/sun/security/ssl/OutputRecord.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/OutputRecord.java Fri Sep 18 09:18:17 2015 -0700 @@ -195,7 +195,7 @@ } @Override - synchronized public void close() throws IOException { + public synchronized void close() throws IOException { if (!isClosed) { isClosed = true; writeCipher.dispose(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/Plaintext.java --- a/src/java.base/share/classes/sun/security/ssl/Plaintext.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/Plaintext.java Fri Sep 18 09:18:17 2015 -0700 @@ -32,7 +32,7 @@ * Plaintext */ final class Plaintext { - final static Plaintext PLAINTEXT_NULL = new Plaintext(); + static final Plaintext PLAINTEXT_NULL = new Plaintext(); byte contentType; byte majorVersion; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java --- a/src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java Fri Sep 18 09:18:17 2015 -0700 @@ -54,33 +54,33 @@ public final class ProtocolVersion implements Comparable { // The limit of maximum protocol version - final static int LIMIT_MAX_VALUE = 0xFFFF; + static final int LIMIT_MAX_VALUE = 0xFFFF; // The limit of minimum protocol version - final static int LIMIT_MIN_VALUE = 0x0000; + static final int LIMIT_MIN_VALUE = 0x0000; // Dummy protocol version value for invalid SSLSession - final static ProtocolVersion NONE = new ProtocolVersion(-1, "NONE"); + static final ProtocolVersion NONE = new ProtocolVersion(-1, "NONE"); // If enabled, send/accept SSLv2 hello messages - final static ProtocolVersion SSL20Hello = + static final ProtocolVersion SSL20Hello = new ProtocolVersion(0x0002, "SSLv2Hello"); // SSL 3.0 - final static ProtocolVersion SSL30 = new ProtocolVersion(0x0300, "SSLv3"); + static final ProtocolVersion SSL30 = new ProtocolVersion(0x0300, "SSLv3"); // TLS 1.0 - final static ProtocolVersion TLS10 = new ProtocolVersion(0x0301, "TLSv1"); + static final ProtocolVersion TLS10 = new ProtocolVersion(0x0301, "TLSv1"); // TLS 1.1 - final static ProtocolVersion TLS11 = new ProtocolVersion(0x0302, "TLSv1.1"); + static final ProtocolVersion TLS11 = new ProtocolVersion(0x0302, "TLSv1.1"); // TLS 1.2 - final static ProtocolVersion TLS12 = new ProtocolVersion(0x0303, "TLSv1.2"); + static final ProtocolVersion TLS12 = new ProtocolVersion(0x0303, "TLSv1.2"); // DTLS 1.0 // {254, 255}, the version value of DTLS 1.0. - final static ProtocolVersion DTLS10 = + static final ProtocolVersion DTLS10 = new ProtocolVersion(0xFEFF, "DTLSv1.0"); // No DTLS 1.1, that version number was skipped in order to harmonize @@ -88,30 +88,30 @@ // DTLS 1.2 // {254, 253}, the version value of DTLS 1.2. - final static ProtocolVersion DTLS12 = + static final ProtocolVersion DTLS12 = new ProtocolVersion(0xFEFD, "DTLSv1.2"); private static final boolean FIPS = SunJSSE.isFIPS(); // minimum version we implement (SSL 3.0) - final static ProtocolVersion MIN = FIPS ? TLS10 : SSL30; + static final ProtocolVersion MIN = FIPS ? TLS10 : SSL30; // maximum version we implement (TLS 1.2) - final static ProtocolVersion MAX = TLS12; + static final ProtocolVersion MAX = TLS12; // SSL/TLS ProtocolVersion to use by default (TLS 1.2) - final static ProtocolVersion DEFAULT_TLS = TLS12; + static final ProtocolVersion DEFAULT_TLS = TLS12; // DTLS ProtocolVersion to use by default (TLS 1.2) - final static ProtocolVersion DEFAULT_DTLS = DTLS12; + static final ProtocolVersion DEFAULT_DTLS = DTLS12; // Default version for hello messages (SSLv2Hello) - final static ProtocolVersion DEFAULT_HELLO = FIPS ? TLS10 : SSL30; + static final ProtocolVersion DEFAULT_HELLO = FIPS ? TLS10 : SSL30; // Available protocols // // Including all supported protocols except the disabled ones. - final static Set availableProtocols; + static final Set availableProtocols; // version in 16 bit MSB format as it appears in records and // messages, i.e. 0x0301 for TLS 1.0 diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java --- a/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java Fri Sep 18 09:18:17 2015 -0700 @@ -47,11 +47,11 @@ */ final class SSLAlgorithmConstraints implements AlgorithmConstraints { - private final static AlgorithmConstraints tlsDisabledAlgConstraints = + private static final AlgorithmConstraints tlsDisabledAlgConstraints = new DisabledAlgorithmConstraints(PROPERTY_TLS_DISABLED_ALGS, new SSLAlgorithmDecomposer()); - private final static AlgorithmConstraints x509DisabledAlgConstraints = + private static final AlgorithmConstraints x509DisabledAlgConstraints = new DisabledAlgorithmConstraints(PROPERTY_CERTPATH_DISABLED_ALGS, new SSLAlgorithmDecomposer(true)); @@ -61,11 +61,11 @@ private boolean enabledX509DisabledAlgConstraints = true; // the default algorithm constraints - final static AlgorithmConstraints DEFAULT = + static final AlgorithmConstraints DEFAULT = new SSLAlgorithmConstraints(null); // the default SSL only algorithm constraints - final static AlgorithmConstraints DEFAULT_SSL_ONLY = + static final AlgorithmConstraints DEFAULT_SSL_ONLY = new SSLAlgorithmConstraints((SSLSocket)null, false); SSLAlgorithmConstraints(AlgorithmConstraints algorithmConstraints) { @@ -207,7 +207,7 @@ } - static private class SupportedSignatureAlgorithmConstraints + private static class SupportedSignatureAlgorithmConstraints implements AlgorithmConstraints { // supported signature algorithms private String[] supportedAlgorithms; @@ -255,12 +255,12 @@ } @Override - final public boolean permits(Set primitives, Key key) { + public final boolean permits(Set primitives, Key key) { return true; } @Override - final public boolean permits(Set primitives, + public final boolean permits(Set primitives, String algorithm, Key key, AlgorithmParameters parameters) { if (algorithm == null || algorithm.length() == 0) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -657,7 +657,7 @@ * @see SSLContext */ private static class CustomizedSSLProtocols { - private final static String PROPERTY_NAME = "jdk.tls.client.protocols"; + private static final String PROPERTY_NAME = "jdk.tls.client.protocols"; static IllegalArgumentException reservedException = null; static ArrayList customizedProtocols = new ArrayList<>(); @@ -1028,7 +1028,7 @@ * @see SSLContext */ public static final class DTLS10Context extends AbstractDTLSContext { - private final static SSLParameters defaultClientSSLParams; + private static final SSLParameters defaultClientSSLParams; static { // candidates for available protocols @@ -1053,7 +1053,7 @@ * @see SSLContext */ public static final class DTLS12Context extends AbstractDTLSContext { - private final static SSLParameters defaultClientSSLParams; + private static final SSLParameters defaultClientSSLParams; static { // candidates for available protocols @@ -1079,7 +1079,7 @@ * @see SSLContext */ private static class CustomizedDTLSContext extends AbstractDTLSContext { - private final static SSLParameters defaultClientSSLParams; + private static final SSLParameters defaultClientSSLParams; private static IllegalArgumentException reservedException = null; // Don't want a java.lang.LinkageError for illegal system property. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -56,7 +56,7 @@ * * @author Brad Wetmore */ -final public class SSLEngineImpl extends SSLEngine { +public final class SSLEngineImpl extends SSLEngine { // // Fields and global comments @@ -475,7 +475,7 @@ } } - synchronized private void checkTaskThrown() throws SSLException { + private synchronized void checkTaskThrown() throws SSLException { if (handshaker != null) { handshaker.checkThrown(); } @@ -489,11 +489,11 @@ * Provides "this" synchronization for connection state. * Otherwise, you can access it directly. */ - synchronized private int getConnectionState() { + private synchronized int getConnectionState() { return connectionState; } - synchronized private void setConnectionState(int state) { + private synchronized void setConnectionState(int state) { connectionState = state; } @@ -1513,7 +1513,7 @@ } @Override - synchronized public void closeOutbound() { + public synchronized void closeOutbound() { /* * Dump out a close_notify to the remote side */ @@ -1569,7 +1569,7 @@ * We do check for truncation attacks. */ @Override - synchronized public void closeInbound() throws SSLException { + public synchronized void closeInbound() throws SSLException { /* * Currently closes the outbound side as well. The IETF TLS * working group has expressed the opinion that 1/2 open @@ -1602,7 +1602,7 @@ * Returns the network inbound data closure state */ @Override - synchronized public boolean isInboundDone() { + public synchronized boolean isInboundDone() { return inboundDone; } @@ -1620,12 +1620,12 @@ * entire login session for some user. */ @Override - synchronized public SSLSession getSession() { + public synchronized SSLSession getSession() { return sess; } @Override - synchronized public SSLSession getHandshakeSession() { + public synchronized SSLSession getHandshakeSession() { return handshakeSession; } @@ -1642,7 +1642,7 @@ * this SSLEngine. */ @Override - synchronized public Runnable getDelegatedTask() { + public synchronized Runnable getDelegatedTask() { if (handshaker != null) { return handshaker.getTask(); } @@ -1882,7 +1882,7 @@ * we will need to wait for the next handshake. */ @Override - synchronized public void setEnableSessionCreation(boolean flag) { + public synchronized void setEnableSessionCreation(boolean flag) { enableSessionCreation = flag; if ((handshaker != null) && !handshaker.activated()) { @@ -1895,7 +1895,7 @@ * sessions. */ @Override - synchronized public boolean getEnableSessionCreation() { + public synchronized boolean getEnableSessionCreation() { return enableSessionCreation; } @@ -1909,7 +1909,7 @@ * we will need to wait for the next handshake. */ @Override - synchronized public void setNeedClientAuth(boolean flag) { + public synchronized void setNeedClientAuth(boolean flag) { doClientAuth = (flag ? ClientAuthType.CLIENT_AUTH_REQUIRED : ClientAuthType.CLIENT_AUTH_NONE); @@ -1922,7 +1922,7 @@ } @Override - synchronized public boolean getNeedClientAuth() { + public synchronized boolean getNeedClientAuth() { return (doClientAuth == ClientAuthType.CLIENT_AUTH_REQUIRED); } @@ -1935,7 +1935,7 @@ * we will need to wait for the next handshake. */ @Override - synchronized public void setWantClientAuth(boolean flag) { + public synchronized void setWantClientAuth(boolean flag) { doClientAuth = (flag ? ClientAuthType.CLIENT_AUTH_REQUESTED : ClientAuthType.CLIENT_AUTH_NONE); @@ -1948,7 +1948,7 @@ } @Override - synchronized public boolean getWantClientAuth() { + public synchronized boolean getWantClientAuth() { return (doClientAuth == ClientAuthType.CLIENT_AUTH_REQUESTED); } @@ -1960,7 +1960,7 @@ */ @Override @SuppressWarnings("fallthrough") - synchronized public void setUseClientMode(boolean flag) { + public synchronized void setUseClientMode(boolean flag) { switch (connectionState) { case cs_START: @@ -2040,7 +2040,7 @@ } @Override - synchronized public boolean getUseClientMode() { + public synchronized boolean getUseClientMode() { return !roleIsServer; } @@ -2070,7 +2070,7 @@ * @param suites Names of all the cipher suites to enable. */ @Override - synchronized public void setEnabledCipherSuites(String[] suites) { + public synchronized void setEnabledCipherSuites(String[] suites) { enabledCipherSuites = new CipherSuiteList(suites); if ((handshaker != null) && !handshaker.activated()) { handshaker.setEnabledCipherSuites(enabledCipherSuites); @@ -2088,7 +2088,7 @@ * @return an array of cipher suite names */ @Override - synchronized public String[] getEnabledCipherSuites() { + public synchronized String[] getEnabledCipherSuites() { return enabledCipherSuites.toStringArray(); } @@ -2113,7 +2113,7 @@ * named by the parameter is not supported. */ @Override - synchronized public void setEnabledProtocols(String[] protocols) { + public synchronized void setEnabledProtocols(String[] protocols) { enabledProtocols = new ProtocolList(protocols); if ((handshaker != null) && !handshaker.activated()) { handshaker.setEnabledProtocols(enabledProtocols); @@ -2121,7 +2121,7 @@ } @Override - synchronized public String[] getEnabledProtocols() { + public synchronized String[] getEnabledProtocols() { return enabledProtocols.toStringArray(); } @@ -2129,7 +2129,7 @@ * Returns the SSLParameters in effect for this SSLEngine. */ @Override - synchronized public SSLParameters getSSLParameters() { + public synchronized SSLParameters getSSLParameters() { SSLParameters params = super.getSSLParameters(); // the super implementation does not handle the following parameters @@ -2148,7 +2148,7 @@ * Applies SSLParameters to this engine. */ @Override - synchronized public void setSSLParameters(SSLParameters params) { + public synchronized void setSSLParameters(SSLParameters params) { super.setSSLParameters(params); // the super implementation does not handle the following parameters diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java --- a/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java Fri Sep 18 09:18:17 2015 -0700 @@ -54,7 +54,7 @@ } @Override - synchronized public void close() throws IOException { + public synchronized void close() throws IOException { if (!isClosed) { if (alertMemos != null && !alertMemos.isEmpty()) { isCloseWaiting = true; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SSLServerSocketImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLServerSocketImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SSLServerSocketImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -184,7 +184,7 @@ * that the system defaults are in effect. */ @Override - synchronized public String[] getEnabledCipherSuites() { + public synchronized String[] getEnabledCipherSuites() { return enabledCipherSuites.toStringArray(); } @@ -196,7 +196,7 @@ * means to accept system defaults. */ @Override - synchronized public void setEnabledCipherSuites(String[] suites) { + public synchronized void setEnabledCipherSuites(String[] suites) { enabledCipherSuites = new CipherSuiteList(suites); } @@ -215,12 +215,12 @@ * named by the parameter is not supported. */ @Override - synchronized public void setEnabledProtocols(String[] protocols) { + public synchronized void setEnabledProtocols(String[] protocols) { enabledProtocols = new ProtocolList(protocols); } @Override - synchronized public String[] getEnabledProtocols() { + public synchronized String[] getEnabledProtocols() { return enabledProtocols.toStringArray(); } @@ -303,7 +303,7 @@ * Returns the SSLParameters in effect for newly accepted connections. */ @Override - synchronized public SSLParameters getSSLParameters() { + public synchronized SSLParameters getSSLParameters() { SSLParameters params = super.getSSLParameters(); // the super implementation does not handle the following parameters @@ -320,7 +320,7 @@ * Applies SSLParameters to newly accepted connections. */ @Override - synchronized public void setSSLParameters(SSLParameters params) { + public synchronized void setSSLParameters(SSLParameters params) { super.setSSLParameters(params); // the super implementation does not handle the following parameters diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -677,7 +677,7 @@ * no connections will be able to rejoin this session. */ @Override - synchronized public void invalidate() { + public synchronized void invalidate() { // // Can't invalidate the NULL session -- this would be // attempted when we get a handshaking error on a brand diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -41,7 +41,7 @@ * * @author David Brownell */ -final public class SSLSocketFactoryImpl extends SSLSocketFactory { +public final class SSLSocketFactoryImpl extends SSLSocketFactory { private SSLContextImpl context; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java --- a/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -64,7 +64,7 @@ * * @author David Brownell */ -final public class SSLSocketImpl extends BaseSSLSocketImpl { +public final class SSLSocketImpl extends BaseSSLSocketImpl { /* * ERROR HANDLING GUIDELINES @@ -281,9 +281,9 @@ * This is necessary so that processing of close_notify alerts * from the peer are handled properly. */ - final private Object handshakeLock = new Object(); + private final Object handshakeLock = new Object(); final ReentrantLock writeLock = new ReentrantLock(); - final private Object readLock = new Object(); + private final Object readLock = new Object(); InputRecord inputRecord; OutputRecord outputRecord; @@ -673,11 +673,11 @@ initHandshaker(); } - synchronized private int getConnectionState() { + private synchronized int getConnectionState() { return connectionState; } - synchronized private void setConnectionState(int state) { + private synchronized void setConnectionState(int state) { connectionState = state; } @@ -1802,7 +1802,7 @@ * reserved for exceptions like timeout; otherwise, the socket * will be closed, no further communications could be done. */ - synchronized private void handleException(Exception e, boolean resumable) + private synchronized void handleException(Exception e, boolean resumable) throws IOException { if ((debug != null) && Debug.isOn("ssl")) { System.out.println(Thread.currentThread().getName() + @@ -2114,7 +2114,7 @@ // Please NOTE that this method MUST be called before calling to // SSLSocket.setSSLParameters(). Otherwise, the {@code host} parameter // may override SNIHostName in the customized server name indication. - synchronized public void setHost(String host) { + public synchronized void setHost(String host) { this.host = host; this.serverNames = Utilities.addToSNIServerNameList(this.serverNames, this.host); @@ -2126,7 +2126,7 @@ * transit, and will usually have been confidentiality protected. */ @Override - synchronized public InputStream getInputStream() throws IOException { + public synchronized InputStream getInputStream() throws IOException { if (isClosed()) { throw new SocketException("Socket is closed"); } @@ -2148,7 +2148,7 @@ * will usually be confidentiality protected. */ @Override - synchronized public OutputStream getOutputStream() throws IOException { + public synchronized OutputStream getOutputStream() throws IOException { if (isClosed()) { throw new SocketException("Socket is closed"); } @@ -2192,7 +2192,7 @@ } @Override - synchronized public SSLSession getHandshakeSession() { + public synchronized SSLSession getHandshakeSession() { return handshakeSession; } @@ -2213,7 +2213,7 @@ * we will need to wait for the next handshake. */ @Override - synchronized public void setEnableSessionCreation(boolean flag) { + public synchronized void setEnableSessionCreation(boolean flag) { enableSessionCreation = flag; if ((handshaker != null) && !handshaker.activated()) { @@ -2226,7 +2226,7 @@ * sessions. */ @Override - synchronized public boolean getEnableSessionCreation() { + public synchronized boolean getEnableSessionCreation() { return enableSessionCreation; } @@ -2240,7 +2240,7 @@ * we will need to wait for the next handshake. */ @Override - synchronized public void setNeedClientAuth(boolean flag) { + public synchronized void setNeedClientAuth(boolean flag) { doClientAuth = (flag ? ClientAuthType.CLIENT_AUTH_REQUIRED : ClientAuthType.CLIENT_AUTH_NONE); @@ -2252,7 +2252,7 @@ } @Override - synchronized public boolean getNeedClientAuth() { + public synchronized boolean getNeedClientAuth() { return (doClientAuth == ClientAuthType.CLIENT_AUTH_REQUIRED); } @@ -2265,7 +2265,7 @@ * we will need to wait for the next handshake. */ @Override - synchronized public void setWantClientAuth(boolean flag) { + public synchronized void setWantClientAuth(boolean flag) { doClientAuth = (flag ? ClientAuthType.CLIENT_AUTH_REQUESTED : ClientAuthType.CLIENT_AUTH_NONE); @@ -2277,7 +2277,7 @@ } @Override - synchronized public boolean getWantClientAuth() { + public synchronized boolean getWantClientAuth() { return (doClientAuth == ClientAuthType.CLIENT_AUTH_REQUESTED); } @@ -2289,7 +2289,7 @@ */ @Override @SuppressWarnings("fallthrough") - synchronized public void setUseClientMode(boolean flag) { + public synchronized void setUseClientMode(boolean flag) { switch (connectionState) { case cs_START: @@ -2363,7 +2363,7 @@ } @Override - synchronized public boolean getUseClientMode() { + public synchronized boolean getUseClientMode() { return !roleIsServer; } @@ -2393,7 +2393,7 @@ * @param suites Names of all the cipher suites to enable. */ @Override - synchronized public void setEnabledCipherSuites(String[] suites) { + public synchronized void setEnabledCipherSuites(String[] suites) { enabledCipherSuites = new CipherSuiteList(suites); if ((handshaker != null) && !handshaker.activated()) { handshaker.setEnabledCipherSuites(enabledCipherSuites); @@ -2411,7 +2411,7 @@ * @return an array of cipher suite names */ @Override - synchronized public String[] getEnabledCipherSuites() { + public synchronized String[] getEnabledCipherSuites() { return enabledCipherSuites.toStringArray(); } @@ -2436,7 +2436,7 @@ * named by the parameter is not supported. */ @Override - synchronized public void setEnabledProtocols(String[] protocols) { + public synchronized void setEnabledProtocols(String[] protocols) { enabledProtocols = new ProtocolList(protocols); if ((handshaker != null) && !handshaker.activated()) { handshaker.setEnabledProtocols(enabledProtocols); @@ -2444,7 +2444,7 @@ } @Override - synchronized public String[] getEnabledProtocols() { + public synchronized String[] getEnabledProtocols() { return enabledProtocols.toStringArray(); } @@ -2501,7 +2501,7 @@ * Returns the SSLParameters in effect for this SSLSocket. */ @Override - synchronized public SSLParameters getSSLParameters() { + public synchronized SSLParameters getSSLParameters() { SSLParameters params = super.getSSLParameters(); // the super implementation does not handle the following parameters @@ -2521,7 +2521,7 @@ * Applies SSLParameters to this socket. */ @Override - synchronized public void setSSLParameters(SSLParameters params) { + public synchronized void setSSLParameters(SSLParameters params) { super.setSSLParameters(params); // the super implementation does not handle the following parameters diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java --- a/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Fri Sep 18 09:18:17 2015 -0700 @@ -119,7 +119,7 @@ new SSLAlgorithmDecomposer()); // To switch off the status_request[_v2] extensions - private final static boolean enableStatusRequestExtension = + private static final boolean enableStatusRequestExtension = Debug.getBooleanProperty( "jdk.tls.server.enableStatusRequestExtension", false); private boolean staplingActive = false; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java --- a/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java Fri Sep 18 09:18:17 2015 -0700 @@ -68,7 +68,7 @@ // For backward compatibility, all future data structures associated with // new NameTypes MUST begin with a 16-bit length field. - final static int NAME_HEADER_LENGTH = 3; // NameType: 1 byte + static final int NAME_HEADER_LENGTH = 3; // NameType: 1 byte // Name length: 2 bytes private Map sniMap; private int listLength; // ServerNameList length diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java --- a/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java Fri Sep 18 09:18:17 2015 -0700 @@ -65,15 +65,15 @@ final class SignatureAndHashAlgorithm { // minimum priority for default enabled algorithms - final static int SUPPORTED_ALG_PRIORITY_MAX_NUM = 0x00F0; + static final int SUPPORTED_ALG_PRIORITY_MAX_NUM = 0x00F0; // performance optimization - private final static Set SIGNATURE_PRIMITIVE_SET = + private static final Set SIGNATURE_PRIMITIVE_SET = Collections.unmodifiableSet(EnumSet.of(CryptoPrimitive.SIGNATURE)); // supported pairs of signature and hash algorithm - private final static Map supportedMap; - private final static Map priorityMap; + private static final Map supportedMap; + private static final Map priorityMap; // the hash algorithm private HashAlgorithm hash; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/StatusRequestType.java --- a/src/java.base/share/classes/sun/security/ssl/StatusRequestType.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/StatusRequestType.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,6 +61,6 @@ } // Status request types defined in RFC 6066 and 6961 - final static StatusRequestType OCSP = e(0x01, "ocsp"); - final static StatusRequestType OCSP_MULTI = e(0x02, "ocsp_multi"); + static final StatusRequestType OCSP = e(0x01, "ocsp"); + static final StatusRequestType OCSP_MULTI = e(0x02, "ocsp_multi"); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java --- a/src/java.base/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java Fri Sep 18 09:18:17 2015 -0700 @@ -173,11 +173,11 @@ return null; } - private final static int ARBITRARY_PRIME = 0xff01; - private final static int ARBITRARY_CHAR2 = 0xff02; + private static final int ARBITRARY_PRIME = 0xff01; + private static final int ARBITRARY_CHAR2 = 0xff02; // See sun.security.util.NamedCurve for the OIDs - private final static String[] NAMED_CURVE_OID_TABLE = new String[] { + private static final String[] NAMED_CURVE_OID_TABLE = new String[] { null, // (0) unused "1.3.132.0.1", // (1) sect163k1, NIST K-163 "1.3.132.0.2", // (2) sect163r1 @@ -206,7 +206,7 @@ "1.3.132.0.35", // (25) secp521r1, NIST P-521 }; - private final static Map curveIndices; + private static final Map curveIndices; static { curveIndices = new HashMap(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/SupportedEllipticPointFormatsExtension.java --- a/src/java.base/share/classes/sun/security/ssl/SupportedEllipticPointFormatsExtension.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/SupportedEllipticPointFormatsExtension.java Fri Sep 18 09:18:17 2015 -0700 @@ -33,9 +33,9 @@ final class SupportedEllipticPointFormatsExtension extends HelloExtension { - final static int FMT_UNCOMPRESSED = 0; - final static int FMT_ANSIX962_COMPRESSED_PRIME = 1; - final static int FMT_ANSIX962_COMPRESSED_CHAR2 = 2; + static final int FMT_UNCOMPRESSED = 0; + static final int FMT_ANSIX962_COMPRESSED_PRIME = 1; + static final int FMT_ANSIX962_COMPRESSED_CHAR2 = 2; static final HelloExtension DEFAULT = new SupportedEllipticPointFormatsExtension( diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java --- a/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -62,7 +62,7 @@ private static final Debug debug = Debug.getInstance("ssl"); - private final static boolean useDebug = + private static final boolean useDebug = (debug != null) && Debug.isOn("keymanager"); // for unit testing only, set via privileged reflection diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/timestamp/TSResponse.java --- a/src/java.base/share/classes/sun/security/timestamp/TSResponse.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/timestamp/TSResponse.java Fri Sep 18 09:18:17 2015 -0700 @@ -374,7 +374,7 @@ } } - final static class TimestampException extends IOException { + static final class TimestampException extends IOException { private static final long serialVersionUID = -1631631794891940953L; TimestampException(String message) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/util/Cache.java --- a/src/java.base/share/classes/sun/security/util/Cache.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/util/Cache.java Fri Sep 18 09:18:17 2015 -0700 @@ -202,7 +202,7 @@ class NullCache extends Cache { - final static Cache INSTANCE = new NullCache<>(); + static final Cache INSTANCE = new NullCache<>(); private NullCache() { // empty @@ -244,10 +244,10 @@ class MemoryCache extends Cache { - private final static float LOAD_FACTOR = 0.75f; + private static final float LOAD_FACTOR = 0.75f; // XXXX - private final static boolean DEBUG = false; + private static final boolean DEBUG = false; private final Map> cacheMap; private int maxSize; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/util/CurveDB.java --- a/src/java.base/share/classes/sun/security/util/CurveDB.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/util/CurveDB.java Fri Sep 18 09:18:17 2015 -0700 @@ -40,10 +40,10 @@ * @author Andreas Sterbenz */ public class CurveDB { - private final static int P = 1; // prime curve - private final static int B = 2; // binary curve - private final static int PD = 5; // prime curve, mark as default - private final static int BD = 6; // binary curve, mark as default + private static final int P = 1; // prime curve + private static final int B = 2; // binary curve + private static final int PD = 5; // prime curve, mark as default + private static final int BD = 6; // binary curve, mark as default private static final Map oidMap = new LinkedHashMap(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/util/Debug.java --- a/src/java.base/share/classes/sun/security/util/Debug.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/util/Debug.java Fri Sep 18 09:18:17 2015 -0700 @@ -293,7 +293,7 @@ return null; } - private final static char[] hexDigits = "0123456789abcdef".toCharArray(); + private static final char[] hexDigits = "0123456789abcdef".toCharArray(); public static String toString(byte[] b) { if (b == null) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/util/DerValue.java --- a/src/java.base/share/classes/sun/security/util/DerValue.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/util/DerValue.java Fri Sep 18 09:18:17 2015 -0700 @@ -84,52 +84,52 @@ */ /** Tag value indicating an ASN.1 "BOOLEAN" value. */ - public final static byte tag_Boolean = 0x01; + public static final byte tag_Boolean = 0x01; /** Tag value indicating an ASN.1 "INTEGER" value. */ - public final static byte tag_Integer = 0x02; + public static final byte tag_Integer = 0x02; /** Tag value indicating an ASN.1 "BIT STRING" value. */ - public final static byte tag_BitString = 0x03; + public static final byte tag_BitString = 0x03; /** Tag value indicating an ASN.1 "OCTET STRING" value. */ - public final static byte tag_OctetString = 0x04; + public static final byte tag_OctetString = 0x04; /** Tag value indicating an ASN.1 "NULL" value. */ - public final static byte tag_Null = 0x05; + public static final byte tag_Null = 0x05; /** Tag value indicating an ASN.1 "OBJECT IDENTIFIER" value. */ - public final static byte tag_ObjectId = 0x06; + public static final byte tag_ObjectId = 0x06; /** Tag value including an ASN.1 "ENUMERATED" value */ - public final static byte tag_Enumerated = 0x0A; + public static final byte tag_Enumerated = 0x0A; /** Tag value indicating an ASN.1 "UTF8String" value. */ - public final static byte tag_UTF8String = 0x0C; + public static final byte tag_UTF8String = 0x0C; /** Tag value including a "printable" string */ - public final static byte tag_PrintableString = 0x13; + public static final byte tag_PrintableString = 0x13; /** Tag value including a "teletype" string */ - public final static byte tag_T61String = 0x14; + public static final byte tag_T61String = 0x14; /** Tag value including an ASCII string */ - public final static byte tag_IA5String = 0x16; + public static final byte tag_IA5String = 0x16; /** Tag value indicating an ASN.1 "UTCTime" value. */ - public final static byte tag_UtcTime = 0x17; + public static final byte tag_UtcTime = 0x17; /** Tag value indicating an ASN.1 "GeneralizedTime" value. */ - public final static byte tag_GeneralizedTime = 0x18; + public static final byte tag_GeneralizedTime = 0x18; /** Tag value indicating an ASN.1 "GenerallString" value. */ - public final static byte tag_GeneralString = 0x1B; + public static final byte tag_GeneralString = 0x1B; /** Tag value indicating an ASN.1 "UniversalString" value. */ - public final static byte tag_UniversalString = 0x1C; + public static final byte tag_UniversalString = 0x1C; /** Tag value indicating an ASN.1 "BMPString" value. */ - public final static byte tag_BMPString = 0x1E; + public static final byte tag_BMPString = 0x1E; // CONSTRUCTED seq/set @@ -137,25 +137,25 @@ * Tag value indicating an ASN.1 * "SEQUENCE" (zero to N elements, order is significant). */ - public final static byte tag_Sequence = 0x30; + public static final byte tag_Sequence = 0x30; /** * Tag value indicating an ASN.1 * "SEQUENCE OF" (one to N elements, order is significant). */ - public final static byte tag_SequenceOf = 0x30; + public static final byte tag_SequenceOf = 0x30; /** * Tag value indicating an ASN.1 * "SET" (zero to N members, order does not matter). */ - public final static byte tag_Set = 0x31; + public static final byte tag_Set = 0x31; /** * Tag value indicating an ASN.1 * "SET OF" (one to N members, order does not matter). */ - public final static byte tag_SetOf = 0x31; + public static final byte tag_SetOf = 0x31; /* * These values are the high order bits for the other kinds of tags. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java --- a/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java Fri Sep 18 09:18:17 2015 -0700 @@ -46,16 +46,16 @@ public class DisabledAlgorithmConstraints extends AbstractAlgorithmConstraints { // the known security property, jdk.certpath.disabledAlgorithms - public final static String PROPERTY_CERTPATH_DISABLED_ALGS = + public static final String PROPERTY_CERTPATH_DISABLED_ALGS = "jdk.certpath.disabledAlgorithms"; // the known security property, jdk.tls.disabledAlgorithms - public final static String PROPERTY_TLS_DISABLED_ALGS = + public static final String PROPERTY_TLS_DISABLED_ALGS = "jdk.tls.disabledAlgorithms"; - private final static Map disabledAlgorithmsMap = + private static final Map disabledAlgorithmsMap = new HashMap<>(); - private final static Map keySizeConstraintsMap = + private static final Map keySizeConstraintsMap = new HashMap<>(); private final String[] disabledAlgorithms; @@ -80,7 +80,7 @@ } @Override - final public boolean permits(Set primitives, + public final boolean permits(Set primitives, String algorithm, AlgorithmParameters parameters) { if (primitives == null || primitives.isEmpty()) { @@ -92,12 +92,12 @@ } @Override - final public boolean permits(Set primitives, Key key) { + public final boolean permits(Set primitives, Key key) { return checkConstraints(primitives, "", key, null); } @Override - final public boolean permits(Set primitives, + public final boolean permits(Set primitives, String algorithm, Key key, AlgorithmParameters parameters) { if (algorithm == null || algorithm.length() == 0) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/util/HostnameChecker.java --- a/src/java.base/share/classes/sun/security/util/HostnameChecker.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/util/HostnameChecker.java Fri Sep 18 09:18:17 2015 -0700 @@ -48,18 +48,18 @@ public class HostnameChecker { // Constant for a HostnameChecker for TLS - public final static byte TYPE_TLS = 1; - private final static HostnameChecker INSTANCE_TLS = + public static final byte TYPE_TLS = 1; + private static final HostnameChecker INSTANCE_TLS = new HostnameChecker(TYPE_TLS); // Constant for a HostnameChecker for LDAP - public final static byte TYPE_LDAP = 2; - private final static HostnameChecker INSTANCE_LDAP = + public static final byte TYPE_LDAP = 2; + private static final HostnameChecker INSTANCE_LDAP = new HostnameChecker(TYPE_LDAP); // constants for subject alt names of type DNS and IP - private final static int ALTNAME_DNS = 2; - private final static int ALTNAME_IP = 7; + private static final int ALTNAME_DNS = 2; + private static final int ALTNAME_IP = 7; // the algorithm to follow to perform the check. Currently unused. private final byte checkType; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java --- a/src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java Fri Sep 18 09:18:17 2015 -0700 @@ -39,10 +39,10 @@ public class LegacyAlgorithmConstraints extends AbstractAlgorithmConstraints { // the known security property, jdk.tls.legacyAlgorithms - public final static String PROPERTY_TLS_LEGACY_ALGS = + public static final String PROPERTY_TLS_LEGACY_ALGS = "jdk.tls.legacyAlgorithms"; - private final static Map legacyAlgorithmsMap = + private static final Map legacyAlgorithmsMap = new HashMap<>(); private final String[] legacyAlgorithms; @@ -54,18 +54,18 @@ } @Override - final public boolean permits(Set primitives, + public final boolean permits(Set primitives, String algorithm, AlgorithmParameters parameters) { return checkAlgorithm(legacyAlgorithms, algorithm, decomposer); } @Override - final public boolean permits(Set primitives, Key key) { + public final boolean permits(Set primitives, Key key) { return true; } @Override - final public boolean permits(Set primitives, + public final boolean permits(Set primitives, String algorithm, Key key, AlgorithmParameters parameters) { return checkAlgorithm(legacyAlgorithms, algorithm, decomposer); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/util/ObjectIdentifier.java --- a/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Fri Sep 18 09:18:17 2015 -0700 @@ -50,7 +50,7 @@ * @author Hemma Prafullchandra */ -final public +public final class ObjectIdentifier implements Serializable { /** @@ -104,7 +104,7 @@ private int componentLen = -1; // how much is used. // Is the components field calculated? - transient private boolean componentsCalculated = false; + private transient boolean componentsCalculated = false; private void readObject(ObjectInputStream is) throws IOException, ClassNotFoundException { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/validator/EndEntityChecker.java --- a/src/java.base/share/classes/sun/security/validator/EndEntityChecker.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/validator/EndEntityChecker.java Fri Sep 18 09:18:17 2015 -0700 @@ -68,53 +68,53 @@ // extended key usage OIDs for TLS server, TLS client, code signing // and any usage - private final static String OID_EXTENDED_KEY_USAGE = + private static final String OID_EXTENDED_KEY_USAGE = SimpleValidator.OID_EXTENDED_KEY_USAGE; - private final static String OID_EKU_TLS_SERVER = "1.3.6.1.5.5.7.3.1"; + private static final String OID_EKU_TLS_SERVER = "1.3.6.1.5.5.7.3.1"; - private final static String OID_EKU_TLS_CLIENT = "1.3.6.1.5.5.7.3.2"; + private static final String OID_EKU_TLS_CLIENT = "1.3.6.1.5.5.7.3.2"; - private final static String OID_EKU_CODE_SIGNING = "1.3.6.1.5.5.7.3.3"; + private static final String OID_EKU_CODE_SIGNING = "1.3.6.1.5.5.7.3.3"; - private final static String OID_EKU_TIME_STAMPING = "1.3.6.1.5.5.7.3.8"; + private static final String OID_EKU_TIME_STAMPING = "1.3.6.1.5.5.7.3.8"; - private final static String OID_EKU_ANY_USAGE = "2.5.29.37.0"; + private static final String OID_EKU_ANY_USAGE = "2.5.29.37.0"; // the Netscape Server-Gated-Cryptography EKU extension OID - private final static String OID_EKU_NS_SGC = "2.16.840.1.113730.4.1"; + private static final String OID_EKU_NS_SGC = "2.16.840.1.113730.4.1"; // the Microsoft Server-Gated-Cryptography EKU extension OID - private final static String OID_EKU_MS_SGC = "1.3.6.1.4.1.311.10.3.3"; + private static final String OID_EKU_MS_SGC = "1.3.6.1.4.1.311.10.3.3"; // the recognized extension OIDs - private final static String OID_SUBJECT_ALT_NAME = "2.5.29.17"; + private static final String OID_SUBJECT_ALT_NAME = "2.5.29.17"; - private final static String NSCT_SSL_CLIENT = + private static final String NSCT_SSL_CLIENT = NetscapeCertTypeExtension.SSL_CLIENT; - private final static String NSCT_SSL_SERVER = + private static final String NSCT_SSL_SERVER = NetscapeCertTypeExtension.SSL_SERVER; - private final static String NSCT_CODE_SIGNING = + private static final String NSCT_CODE_SIGNING = NetscapeCertTypeExtension.OBJECT_SIGNING; // bit numbers in the key usage extension - private final static int KU_SIGNATURE = 0; - private final static int KU_KEY_ENCIPHERMENT = 2; - private final static int KU_KEY_AGREEMENT = 4; + private static final int KU_SIGNATURE = 0; + private static final int KU_KEY_ENCIPHERMENT = 2; + private static final int KU_KEY_AGREEMENT = 4; // TLS key exchange algorithms requiring digitalSignature key usage - private final static Collection KU_SERVER_SIGNATURE = + private static final Collection KU_SERVER_SIGNATURE = Arrays.asList("DHE_DSS", "DHE_RSA", "ECDHE_ECDSA", "ECDHE_RSA", "RSA_EXPORT", "UNKNOWN"); // TLS key exchange algorithms requiring keyEncipherment key usage - private final static Collection KU_SERVER_ENCRYPTION = + private static final Collection KU_SERVER_ENCRYPTION = Arrays.asList("RSA"); // TLS key exchange algorithms requiring keyAgreement key usage - private final static Collection KU_SERVER_KEY_AGREEMENT = + private static final Collection KU_SERVER_KEY_AGREEMENT = Arrays.asList("DH_DSS", "DH_RSA", "ECDH_ECDSA", "ECDH_RSA"); // variant of this end entity cert checker diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/validator/KeyStores.java --- a/src/java.base/share/classes/sun/security/validator/KeyStores.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/validator/KeyStores.java Fri Sep 18 09:18:17 2015 -0700 @@ -48,10 +48,10 @@ // in the future, all accesses to the system cacerts keystore should // go through this class. but not right now. /* - private final static String javaHome = + private static final String javaHome = (String)AccessController.doPrivileged(new GetPropertyAction("java.home")); - private final static char SEP = File.separatorChar; + private static final char SEP = File.separatorChar; private static KeyStore caCerts; @@ -79,7 +79,7 @@ * The file is only opened once per JVM invocation and the contents * cached subsequently. * - public synchronized static KeyStore getCaCerts() throws IOException { + public static synchronized KeyStore getCaCerts() throws IOException { if (caCerts != null) { return caCerts; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/validator/PKIXValidator.java --- a/src/java.base/share/classes/sun/security/validator/PKIXValidator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/validator/PKIXValidator.java Fri Sep 18 09:18:17 2015 -0700 @@ -56,7 +56,7 @@ * manager. Typically, this will only work if the PKIX implementation * supports CRL distribution points as we do not manually setup CertStores. */ - private final static boolean checkTLSRevocation = + private static final boolean checkTLSRevocation = AccessController.doPrivileged (new GetBooleanAction("com.sun.net.ssl.checkRevocation")); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/validator/SimpleValidator.java --- a/src/java.base/share/classes/sun/security/validator/SimpleValidator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/validator/SimpleValidator.java Fri Sep 18 09:18:17 2015 -0700 @@ -59,23 +59,23 @@ // Constants for the OIDs we need - final static String OID_BASIC_CONSTRAINTS = "2.5.29.19"; + static final String OID_BASIC_CONSTRAINTS = "2.5.29.19"; - final static String OID_NETSCAPE_CERT_TYPE = "2.16.840.1.113730.1.1"; + static final String OID_NETSCAPE_CERT_TYPE = "2.16.840.1.113730.1.1"; - final static String OID_KEY_USAGE = "2.5.29.15"; + static final String OID_KEY_USAGE = "2.5.29.15"; - final static String OID_EXTENDED_KEY_USAGE = "2.5.29.37"; + static final String OID_EXTENDED_KEY_USAGE = "2.5.29.37"; - final static String OID_EKU_ANY_USAGE = "2.5.29.37.0"; + static final String OID_EKU_ANY_USAGE = "2.5.29.37.0"; - final static ObjectIdentifier OBJID_NETSCAPE_CERT_TYPE = + static final ObjectIdentifier OBJID_NETSCAPE_CERT_TYPE = NetscapeCertTypeExtension.NetscapeCertType_Id; - private final static String NSCT_SSL_CA = + private static final String NSCT_SSL_CA = NetscapeCertTypeExtension.SSL_CA; - private final static String NSCT_CODE_SIGNING_CA = + private static final String NSCT_CODE_SIGNING_CA = NetscapeCertTypeExtension.OBJECT_SIGNING_CA; /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/validator/Validator.java --- a/src/java.base/share/classes/sun/security/validator/Validator.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/validator/Validator.java Fri Sep 18 09:18:17 2015 -0700 @@ -86,62 +86,62 @@ */ public abstract class Validator { - final static X509Certificate[] CHAIN0 = {}; + static final X509Certificate[] CHAIN0 = {}; /** * Constant for a validator of type Simple. * @see #getInstance */ - public final static String TYPE_SIMPLE = "Simple"; + public static final String TYPE_SIMPLE = "Simple"; /** * Constant for a validator of type PKIX. * @see #getInstance */ - public final static String TYPE_PKIX = "PKIX"; + public static final String TYPE_PKIX = "PKIX"; /** * Constant for a Generic variant of a validator. * @see #getInstance */ - public final static String VAR_GENERIC = "generic"; + public static final String VAR_GENERIC = "generic"; /** * Constant for a Code Signing variant of a validator. * @see #getInstance */ - public final static String VAR_CODE_SIGNING = "code signing"; + public static final String VAR_CODE_SIGNING = "code signing"; /** * Constant for a JCE Code Signing variant of a validator. * @see #getInstance */ - public final static String VAR_JCE_SIGNING = "jce signing"; + public static final String VAR_JCE_SIGNING = "jce signing"; /** * Constant for a TLS Client variant of a validator. * @see #getInstance */ - public final static String VAR_TLS_CLIENT = "tls client"; + public static final String VAR_TLS_CLIENT = "tls client"; /** * Constant for a TLS Server variant of a validator. * @see #getInstance */ - public final static String VAR_TLS_SERVER = "tls server"; + public static final String VAR_TLS_SERVER = "tls server"; /** * Constant for a TSA Server variant of a validator. * @see #getInstance */ - public final static String VAR_TSA_SERVER = "tsa server"; + public static final String VAR_TSA_SERVER = "tsa server"; /** * Constant for a Code Signing variant of a validator for use by * the J2SE Plugin/WebStart code. * @see #getInstance */ - public final static String VAR_PLUGIN_CODE_SIGNING = "plugin code signing"; + public static final String VAR_PLUGIN_CODE_SIGNING = "plugin code signing"; private final String type; final EndEntityChecker endEntityChecker; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/validator/ValidatorException.java --- a/src/java.base/share/classes/sun/security/validator/ValidatorException.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/validator/ValidatorException.java Fri Sep 18 09:18:17 2015 -0700 @@ -37,28 +37,28 @@ private static final long serialVersionUID = -2836879718282292155L; - public final static Object T_NO_TRUST_ANCHOR = + public static final Object T_NO_TRUST_ANCHOR = "No trusted certificate found"; - public final static Object T_EE_EXTENSIONS = + public static final Object T_EE_EXTENSIONS = "End entity certificate extension check failed"; - public final static Object T_CA_EXTENSIONS = + public static final Object T_CA_EXTENSIONS = "CA certificate extension check failed"; - public final static Object T_CERT_EXPIRED = + public static final Object T_CERT_EXPIRED = "Certificate expired"; - public final static Object T_SIGNATURE_ERROR = + public static final Object T_SIGNATURE_ERROR = "Certificate signature validation failed"; - public final static Object T_NAME_CHAINING = + public static final Object T_NAME_CHAINING = "Certificate chaining error"; - public final static Object T_ALGORITHM_DISABLED = + public static final Object T_ALGORITHM_DISABLED = "Certificate signature algorithm disabled"; - public final static Object T_UNTRUSTED_CERT = + public static final Object T_UNTRUSTED_CERT = "Untrusted certificate"; private Object type; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/x509/AVA.java --- a/src/java.base/share/classes/sun/security/x509/AVA.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/x509/AVA.java Fri Sep 18 09:18:17 2015 -0700 @@ -72,15 +72,15 @@ * DEFAULT format allows both RFC1779 and RFC2253 syntax and * additional keywords. */ - final static int DEFAULT = 1; + static final int DEFAULT = 1; /** * RFC1779 specifies format according to RFC1779. */ - final static int RFC1779 = 2; + static final int RFC1779 = 2; /** * RFC2253 specifies format according to RFC2253. */ - final static int RFC2253 = 3; + static final int RFC2253 = 3; // currently not private, accessed directly from RDN final ObjectIdentifier oid; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/x509/DistributionPoint.java --- a/src/java.base/share/classes/sun/security/x509/DistributionPoint.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/x509/DistributionPoint.java Fri Sep 18 09:18:17 2015 -0700 @@ -97,14 +97,14 @@ // reason flag bits // NOTE that these are NOT quite the same as the CRL reason code extension - public final static int KEY_COMPROMISE = 1; - public final static int CA_COMPROMISE = 2; - public final static int AFFILIATION_CHANGED = 3; - public final static int SUPERSEDED = 4; - public final static int CESSATION_OF_OPERATION = 5; - public final static int CERTIFICATE_HOLD = 6; - public final static int PRIVILEGE_WITHDRAWN = 7; - public final static int AA_COMPROMISE = 8; + public static final int KEY_COMPROMISE = 1; + public static final int CA_COMPROMISE = 2; + public static final int AFFILIATION_CHANGED = 3; + public static final int SUPERSEDED = 4; + public static final int CESSATION_OF_OPERATION = 5; + public static final int CERTIFICATE_HOLD = 6; + public static final int PRIVILEGE_WITHDRAWN = 7; + public static final int AA_COMPROMISE = 8; private static final String[] REASON_STRINGS = { null, diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/x509/IPAddressName.java --- a/src/java.base/share/classes/sun/security/x509/IPAddressName.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/x509/IPAddressName.java Fri Sep 18 09:18:17 2015 -0700 @@ -183,7 +183,7 @@ * be 32 bytes long, otherwise 16. * @throws IOException on error */ - private final static int MASKSIZE = 16; + private static final int MASKSIZE = 16; private void parseIPv6(String name) throws IOException { int slashNdx = name.indexOf('/'); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/x509/OIDMap.java --- a/src/java.base/share/classes/sun/security/x509/OIDMap.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/x509/OIDMap.java Fri Sep 18 09:18:17 2015 -0700 @@ -106,10 +106,10 @@ { 2, 16, 840, 1, 113730, 1, 1 }; /** Map ObjectIdentifier(oid) -> OIDInfo(info) */ - private final static Map oidMap; + private static final Map oidMap; /** Map String(friendly name) -> OIDInfo(info) */ - private final static Map nameMap; + private static final Map nameMap; static { oidMap = new HashMap(); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/x509/ReasonFlags.java --- a/src/java.base/share/classes/sun/security/x509/ReasonFlags.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/x509/ReasonFlags.java Fri Sep 18 09:18:17 2015 -0700 @@ -69,7 +69,7 @@ public static final String PRIVILEGE_WITHDRAWN = "privilege_withdrawn"; public static final String AA_COMPROMISE = "aa_compromise"; - private final static String[] NAMES = { + private static final String[] NAMES = { UNUSED, KEY_COMPROMISE, CA_COMPROMISE, diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/x509/X509CRLEntryImpl.java --- a/src/java.base/share/classes/sun/security/x509/X509CRLEntryImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/x509/X509CRLEntryImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -76,7 +76,7 @@ private byte[] revokedCert = null; private X500Principal certIssuer; - private final static boolean isExplicit = false; + private static final boolean isExplicit = false; private static final long YR_2050 = 2524636800000L; /** diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/security/x509/X509CRLImpl.java --- a/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -107,7 +107,7 @@ private Map revokedMap = new TreeMap<>(); private List revokedList = new LinkedList<>(); private CRLExtensions extensions = null; - private final static boolean isExplicit = true; + private static final boolean isExplicit = true; private static final long YR_2050 = 2524636800000L; private boolean readOnly = false; @@ -1286,7 +1286,7 @@ /** * Immutable X.509 Certificate Issuer DN and serial number pair */ - private final static class X509IssuerSerial + private static final class X509IssuerSerial implements Comparable { final X500Principal issuer; final BigInteger serial; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/text/CompactByteArray.java --- a/src/java.base/share/classes/sun/text/CompactByteArray.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/text/CompactByteArray.java Fri Sep 18 09:18:17 2015 -0700 @@ -212,7 +212,7 @@ * @param len the length to compare. * The start indices and start+len must be valid. */ - final static boolean arrayRegionMatches(byte[] source, int sourceStart, + static final boolean arrayRegionMatches(byte[] source, int sourceStart, byte[] target, int targetStart, int len) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java --- a/src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java Fri Sep 18 09:18:17 2015 -0700 @@ -98,7 +98,7 @@ // Intermediate class: // Has NormalizerImpl and does boilerplate argument checking and setup. - public static abstract class Normalizer2WithImpl extends Normalizer2 { + public abstract static class Normalizer2WithImpl extends Normalizer2 { public Normalizer2WithImpl(NormalizerImpl ni) { impl=ni; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/text/normalizer/NormalizerBase.java --- a/src/java.base/share/classes/sun/text/normalizer/NormalizerBase.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/text/normalizer/NormalizerBase.java Fri Sep 18 09:18:17 2015 -0700 @@ -249,7 +249,7 @@ * and any fields or methods should not be called or overridden by users. * @stable ICU 2.8 */ - public static abstract class Mode { + public abstract static class Mode { /** * Sole constructor diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/text/normalizer/Trie2.java --- a/src/java.base/share/classes/sun/text/normalizer/Trie2.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/text/normalizer/Trie2.java Fri Sep 18 09:18:17 2015 -0700 @@ -193,7 +193,7 @@ * @param codePoint the code point * @return the value */ - abstract public int get(int codePoint); + public abstract int get(int codePoint); /** * Get the trie value for a UTF-16 code unit. @@ -230,7 +230,7 @@ * @param c the code point or lead surrogate value. * @return the value */ - abstract public int getFromU16SingleLead(char c); + public abstract int getFromU16SingleLead(char c); /** * When iterating over the contents of a Trie2, Elements of this type are produced. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/text/normalizer/UBiDiProps.java --- a/src/java.base/share/classes/sun/text/normalizer/UBiDiProps.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/text/normalizer/UBiDiProps.java Fri Sep 18 09:18:17 2015 -0700 @@ -108,7 +108,7 @@ } // implement ICUBinary.Authenticate - private final static class IsAcceptable implements ICUBinary.Authenticate { + private static final class IsAcceptable implements ICUBinary.Authenticate { public boolean isDataVersionAcceptable(byte version[]) { return version[0]==2; } diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/text/normalizer/Utility.java --- a/src/java.base/share/classes/sun/text/normalizer/Utility.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/text/normalizer/Utility.java Fri Sep 18 09:18:17 2015 -0700 @@ -61,7 +61,7 @@ } /* This map must be in ASCENDING ORDER OF THE ESCAPE CODE */ - static private final char[] UNESCAPE_MAP = { + private static final char[] UNESCAPE_MAP = { /*" 0x22, 0x22 */ /*' 0x27, 0x27 */ /*? 0x3F, 0x3F */ @@ -207,7 +207,7 @@ /** * Supplies a zero-padded hex representation of an integer (without 0x) */ - static public String hex(long i, int places) { + public static String hex(long i, int places) { if (i == Long.MIN_VALUE) return "-8000000000000000"; boolean negative = i < 0; if (negative) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/util/calendar/CalendarSystem.java --- a/src/java.base/share/classes/sun/util/calendar/CalendarSystem.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/util/calendar/CalendarSystem.java Fri Sep 18 09:18:17 2015 -0700 @@ -76,7 +76,7 @@ /////////////////////// Calendar Factory Methods ///////////////////////// - private volatile static boolean initialized = false; + private static volatile boolean initialized = false; // Map of calendar names and calendar class names private static ConcurrentMap names; @@ -118,7 +118,7 @@ } } - private final static Gregorian GREGORIAN_INSTANCE = new Gregorian(); + private static final Gregorian GREGORIAN_INSTANCE = new Gregorian(); /** * Returns the singleton instance of the Gregorian diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/util/calendar/ZoneInfo.java --- a/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java Fri Sep 18 09:18:17 2015 -0700 @@ -170,7 +170,7 @@ /** * True if the object has been modified after its instantiation. */ - transient private boolean dirty = false; + private transient boolean dirty = false; private static final long serialVersionUID = 2653134537216586139L; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java --- a/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Fri Sep 18 09:18:17 2015 -0700 @@ -206,7 +206,7 @@ } private static String versionId; - private final static Map zones = new ConcurrentHashMap<>(); + private static final Map zones = new ConcurrentHashMap<>(); private static Map aliases = new HashMap<>(); private static byte[][] ruleArray; diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java --- a/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java Fri Sep 18 09:18:17 2015 -0700 @@ -39,8 +39,8 @@ * @author Naoto Sato */ public class CalendarDataUtility { - public final static String FIRST_DAY_OF_WEEK = "firstDayOfWeek"; - public final static String MINIMAL_DAYS_IN_FIRST_WEEK = "minimalDaysInFirstWeek"; + public static final String FIRST_DAY_OF_WEEK = "firstDayOfWeek"; + public static final String MINIMAL_DAYS_IN_FIRST_WEEK = "minimalDaysInFirstWeek"; // No instantiation private CalendarDataUtility() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/util/locale/provider/CollationRules.java --- a/src/java.base/share/classes/sun/util/locale/provider/CollationRules.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/util/locale/provider/CollationRules.java Fri Sep 18 09:18:17 2015 -0700 @@ -47,7 +47,7 @@ * @author Helena Shih, Mark Davis */ final class CollationRules { - final static String DEFAULTRULES = + static final String DEFAULTRULES = "" // no FRENCH accent order by default, add in French Delta // IGNORABLES (up to first < character) // COMPLETELY IGNORE format characters diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/util/logging/PlatformLogger.java --- a/src/java.base/share/classes/sun/util/logging/PlatformLogger.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/util/logging/PlatformLogger.java Fri Sep 18 09:18:17 2015 -0700 @@ -408,7 +408,7 @@ /** * Abstract base class for logging support, defining the API and common field. */ - private static abstract class LoggerProxy { + private abstract static class LoggerProxy { final String name; protected LoggerProxy(String name) { diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/classes/sun/util/resources/OpenListResourceBundle.java --- a/src/java.base/share/classes/sun/util/resources/OpenListResourceBundle.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/classes/sun/util/resources/OpenListResourceBundle.java Fri Sep 18 09:18:17 2015 -0700 @@ -118,7 +118,7 @@ /** * See ListResourceBundle class description. */ - abstract protected Object[][] getContents(); + protected abstract Object[][] getContents(); /** * Load lookup tables if they haven't been loaded already. diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/include/jvm.h --- a/src/java.base/share/native/include/jvm.h Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/native/include/jvm.h Fri Sep 18 09:18:17 2015 -0700 @@ -557,48 +557,6 @@ JVM_SupportsCX8(void); /* - * jdk.internal.jimage - */ - -JNIEXPORT jlong JNICALL -JVM_ImageOpen(JNIEnv *env, const char *nativePath, jboolean big_endian); - -JNIEXPORT void JNICALL -JVM_ImageClose(JNIEnv *env, jlong id); - -JNIEXPORT jlong JNICALL -JVM_ImageGetIndexAddress(JNIEnv *env, jlong id); - -JNIEXPORT jlong JNICALL -JVM_ImageGetDataAddress(JNIEnv *env,jlong id); - -JNIEXPORT jboolean JNICALL -JVM_ImageRead(JNIEnv *env, jlong id, jlong offset, - unsigned char* uncompressedAddress, jlong uncompressed_size); - -JNIEXPORT jboolean JNICALL -JVM_ImageReadCompressed(JNIEnv *env, jlong id, jlong offset, - unsigned char* compressedBuffer, jlong compressed_size, - unsigned char* uncompressedBuffer, jlong uncompressed_size); - -JNIEXPORT const char* JNICALL -JVM_ImageGetStringBytes(JNIEnv *env, jlong id, jint offset); - -JNIEXPORT jlong* JNICALL -JVM_ImageGetAttributes(JNIEnv *env, jlong* rawAttributes, jlong id, jint offset); - -JNIEXPORT jsize JNICALL -JVM_ImageGetAttributesCount(JNIEnv *env); - -JNIEXPORT jlong* JNICALL -JVM_ImageFindAttributes(JNIEnv *env, jlong* rawAttributes, jbyte* rawBytes, jsize size, jlong id); - -JNIEXPORT jint* JNICALL -JVM_ImageAttributeOffsets(JNIEnv *env, jint* rawOffsets, unsigned int length, jlong id); - -JNIEXPORT unsigned int JNICALL -JVM_ImageAttributeOffsetsLength(JNIEnv *env, jlong id); -/* * com.sun.dtrace.jsdt support */ diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libfdlibm/e_pow.c --- a/src/java.base/share/native/libfdlibm/e_pow.c Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,320 +0,0 @@ - -/* - * Copyright (c) 1998, 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* __ieee754_pow(x,y) return x**y - * - * n - * Method: Let x = 2 * (1+f) - * 1. Compute and return log2(x) in two pieces: - * log2(x) = w1 + w2, - * where w1 has 53-24 = 29 bit trailing zeros. - * 2. Perform y*log2(x) = n+y' by simulating muti-precision - * arithmetic, where |y'|<=0.5. - * 3. Return x**y = 2**n*exp(y'*log2) - * - * Special cases: - * 1. (anything) ** 0 is 1 - * 2. (anything) ** 1 is itself - * 3. (anything) ** NAN is NAN - * 4. NAN ** (anything except 0) is NAN - * 5. +-(|x| > 1) ** +INF is +INF - * 6. +-(|x| > 1) ** -INF is +0 - * 7. +-(|x| < 1) ** +INF is +0 - * 8. +-(|x| < 1) ** -INF is +INF - * 9. +-1 ** +-INF is NAN - * 10. +0 ** (+anything except 0, NAN) is +0 - * 11. -0 ** (+anything except 0, NAN, odd integer) is +0 - * 12. +0 ** (-anything except 0, NAN) is +INF - * 13. -0 ** (-anything except 0, NAN, odd integer) is +INF - * 14. -0 ** (odd integer) = -( +0 ** (odd integer) ) - * 15. +INF ** (+anything except 0,NAN) is +INF - * 16. +INF ** (-anything except 0,NAN) is +0 - * 17. -INF ** (anything) = -0 ** (-anything) - * 18. (-anything) ** (integer) is (-1)**(integer)*(+anything**integer) - * 19. (-anything except 0 and inf) ** (non-integer) is NAN - * - * Accuracy: - * pow(x,y) returns x**y nearly rounded. In particular - * pow(integer,integer) - * always returns the correct integer provided it is - * representable. - * - * Constants : - * The hexadecimal values are the intended ones for the following - * constants. The decimal values may be used, provided that the - * compiler will convert from decimal to binary accurately enough - * to produce the hexadecimal values shown. - */ - -#include "fdlibm.h" - -#ifdef __STDC__ -static const double -#else -static double -#endif -bp[] = {1.0, 1.5,}, -dp_h[] = { 0.0, 5.84962487220764160156e-01,}, /* 0x3FE2B803, 0x40000000 */ -dp_l[] = { 0.0, 1.35003920212974897128e-08,}, /* 0x3E4CFDEB, 0x43CFD006 */ -zero = 0.0, -one = 1.0, -two = 2.0, -two53 = 9007199254740992.0, /* 0x43400000, 0x00000000 */ -huge = 1.0e300, -tiny = 1.0e-300, - /* poly coefs for (3/2)*(log(x)-2s-2/3*s**3 */ -L1 = 5.99999999999994648725e-01, /* 0x3FE33333, 0x33333303 */ -L2 = 4.28571428578550184252e-01, /* 0x3FDB6DB6, 0xDB6FABFF */ -L3 = 3.33333329818377432918e-01, /* 0x3FD55555, 0x518F264D */ -L4 = 2.72728123808534006489e-01, /* 0x3FD17460, 0xA91D4101 */ -L5 = 2.30660745775561754067e-01, /* 0x3FCD864A, 0x93C9DB65 */ -L6 = 2.06975017800338417784e-01, /* 0x3FCA7E28, 0x4A454EEF */ -P1 = 1.66666666666666019037e-01, /* 0x3FC55555, 0x5555553E */ -P2 = -2.77777777770155933842e-03, /* 0xBF66C16C, 0x16BEBD93 */ -P3 = 6.61375632143793436117e-05, /* 0x3F11566A, 0xAF25DE2C */ -P4 = -1.65339022054652515390e-06, /* 0xBEBBBD41, 0xC5D26BF1 */ -P5 = 4.13813679705723846039e-08, /* 0x3E663769, 0x72BEA4D0 */ -lg2 = 6.93147180559945286227e-01, /* 0x3FE62E42, 0xFEFA39EF */ -lg2_h = 6.93147182464599609375e-01, /* 0x3FE62E43, 0x00000000 */ -lg2_l = -1.90465429995776804525e-09, /* 0xBE205C61, 0x0CA86C39 */ -ovt = 8.0085662595372944372e-0017, /* -(1024-log2(ovfl+.5ulp)) */ -cp = 9.61796693925975554329e-01, /* 0x3FEEC709, 0xDC3A03FD =2/(3ln2) */ -cp_h = 9.61796700954437255859e-01, /* 0x3FEEC709, 0xE0000000 =(float)cp */ -cp_l = -7.02846165095275826516e-09, /* 0xBE3E2FE0, 0x145B01F5 =tail of cp_h*/ -ivln2 = 1.44269504088896338700e+00, /* 0x3FF71547, 0x652B82FE =1/ln2 */ -ivln2_h = 1.44269502162933349609e+00, /* 0x3FF71547, 0x60000000 =24b 1/ln2*/ -ivln2_l = 1.92596299112661746887e-08; /* 0x3E54AE0B, 0xF85DDF44 =1/ln2 tail*/ - -#ifdef __STDC__ - double __ieee754_pow(double x, double y) -#else - double __ieee754_pow(x,y) - double x, y; -#endif -{ - double z,ax,z_h,z_l,p_h,p_l; - double y1,t1,t2,r,s,t,u,v,w; - int i0,i1,i,j,k,yisint,n; - int hx,hy,ix,iy; - unsigned lx,ly; - - i0 = ((*(int*)&one)>>29)^1; i1=1-i0; - hx = __HI(x); lx = __LO(x); - hy = __HI(y); ly = __LO(y); - ix = hx&0x7fffffff; iy = hy&0x7fffffff; - - /* y==zero: x**0 = 1 */ - if((iy|ly)==0) return one; - - /* +-NaN return x+y */ - if(ix > 0x7ff00000 || ((ix==0x7ff00000)&&(lx!=0)) || - iy > 0x7ff00000 || ((iy==0x7ff00000)&&(ly!=0))) - return x+y; - - /* determine if y is an odd int when x < 0 - * yisint = 0 ... y is not an integer - * yisint = 1 ... y is an odd int - * yisint = 2 ... y is an even int - */ - yisint = 0; - if(hx<0) { - if(iy>=0x43400000) yisint = 2; /* even integer y */ - else if(iy>=0x3ff00000) { - k = (iy>>20)-0x3ff; /* exponent */ - if(k>20) { - j = ly>>(52-k); - if((j<<(52-k))==ly) yisint = 2-(j&1); - } else if(ly==0) { - j = iy>>(20-k); - if((j<<(20-k))==iy) yisint = 2-(j&1); - } - } - } - - /* special value of y */ - if(ly==0) { - if (iy==0x7ff00000) { /* y is +-inf */ - if(((ix-0x3ff00000)|lx)==0) - return y - y; /* inf**+-1 is NaN */ - else if (ix >= 0x3ff00000)/* (|x|>1)**+-inf = inf,0 */ - return (hy>=0)? y: zero; - else /* (|x|<1)**-,+inf = inf,0 */ - return (hy<0)?-y: zero; - } - if(iy==0x3ff00000) { /* y is +-1 */ - if(hy<0) return one/x; else return x; - } - if(hy==0x40000000) return x*x; /* y is 2 */ - if(hy==0x3fe00000) { /* y is 0.5 */ - if(hx>=0) /* x >= +0 */ - return sqrt(x); - } - } - - ax = fabs(x); - /* special value of x */ - if(lx==0) { - if(ix==0x7ff00000||ix==0||ix==0x3ff00000){ - z = ax; /*x is +-0,+-inf,+-1*/ - if(hy<0) z = one/z; /* z = (1/|x|) */ - if(hx<0) { - if(((ix-0x3ff00000)|yisint)==0) { - z = (z-z)/(z-z); /* (-1)**non-int is NaN */ - } else if(yisint==1) - z = -1.0*z; /* (x<0)**odd = -(|x|**odd) */ - } - return z; - } - } - - n = (hx>>31)+1; - - /* (x<0)**(non-int) is NaN */ - if((n|yisint)==0) return (x-x)/(x-x); - - s = one; /* s (sign of result -ve**odd) = -1 else = 1 */ - if((n|(yisint-1))==0) s = -one;/* (-ve)**(odd int) */ - - /* |y| is huge */ - if(iy>0x41e00000) { /* if |y| > 2**31 */ - if(iy>0x43f00000){ /* if |y| > 2**64, must o/uflow */ - if(ix<=0x3fefffff) return (hy<0)? huge*huge:tiny*tiny; - if(ix>=0x3ff00000) return (hy>0)? huge*huge:tiny*tiny; - } - /* over/underflow if x is not close to one */ - if(ix<0x3fefffff) return (hy<0)? s*huge*huge:s*tiny*tiny; - if(ix>0x3ff00000) return (hy>0)? s*huge*huge:s*tiny*tiny; - /* now |1-x| is tiny <= 2**-20, suffice to compute - log(x) by x-x^2/2+x^3/3-x^4/4 */ - t = ax-one; /* t has 20 trailing zeros */ - w = (t*t)*(0.5-t*(0.3333333333333333333333-t*0.25)); - u = ivln2_h*t; /* ivln2_h has 21 sig. bits */ - v = t*ivln2_l-w*ivln2; - t1 = u+v; - __LO(t1) = 0; - t2 = v-(t1-u); - } else { - double ss,s2,s_h,s_l,t_h,t_l; - n = 0; - /* take care subnormal number */ - if(ix<0x00100000) - {ax *= two53; n -= 53; ix = __HI(ax); } - n += ((ix)>>20)-0x3ff; - j = ix&0x000fffff; - /* determine interval */ - ix = j|0x3ff00000; /* normalize ix */ - if(j<=0x3988E) k=0; /* |x|>1)|0x20000000)+0x00080000+(k<<18); - t_l = ax - (t_h-bp[k]); - s_l = v*((u-s_h*t_h)-s_h*t_l); - /* compute log(ax) */ - s2 = ss*ss; - r = s2*s2*(L1+s2*(L2+s2*(L3+s2*(L4+s2*(L5+s2*L6))))); - r += s_l*(s_h+ss); - s2 = s_h*s_h; - t_h = 3.0+s2+r; - __LO(t_h) = 0; - t_l = r-((t_h-3.0)-s2); - /* u+v = ss*(1+...) */ - u = s_h*t_h; - v = s_l*t_h+t_l*ss; - /* 2/(3log2)*(ss+...) */ - p_h = u+v; - __LO(p_h) = 0; - p_l = v-(p_h-u); - z_h = cp_h*p_h; /* cp_h+cp_l = 2/(3*log2) */ - z_l = cp_l*p_h+p_l*cp+dp_l[k]; - /* log2(ax) = (ss+..)*2/(3*log2) = n + dp_h + z_h + z_l */ - t = (double)n; - t1 = (((z_h+z_l)+dp_h[k])+t); - __LO(t1) = 0; - t2 = z_l-(((t1-t)-dp_h[k])-z_h); - } - - /* split up y into y1+y2 and compute (y1+y2)*(t1+t2) */ - y1 = y; - __LO(y1) = 0; - p_l = (y-y1)*t1+y*t2; - p_h = y1*t1; - z = p_l+p_h; - j = __HI(z); - i = __LO(z); - if (j>=0x40900000) { /* z >= 1024 */ - if(((j-0x40900000)|i)!=0) /* if z > 1024 */ - return s*huge*huge; /* overflow */ - else { - if(p_l+ovt>z-p_h) return s*huge*huge; /* overflow */ - } - } else if((j&0x7fffffff)>=0x4090cc00 ) { /* z <= -1075 */ - if(((j-0xc090cc00)|i)!=0) /* z < -1075 */ - return s*tiny*tiny; /* underflow */ - else { - if(p_l<=z-p_h) return s*tiny*tiny; /* underflow */ - } - } - /* - * compute 2**(p_h+p_l) - */ - i = j&0x7fffffff; - k = (i>>20)-0x3ff; - n = 0; - if(i>0x3fe00000) { /* if |z| > 0.5, set n = [z+0.5] */ - n = j+(0x00100000>>(k+1)); - k = ((n&0x7fffffff)>>20)-0x3ff; /* new k for n */ - t = zero; - __HI(t) = (n&~(0x000fffff>>k)); - n = ((n&0x000fffff)|0x00100000)>>(20-k); - if(j<0) n = -n; - p_h -= t; - } - t = p_l+p_h; - __LO(t) = 0; - u = t*lg2_h; - v = (p_l-(t-p_h))*lg2+t*lg2_l; - z = u+v; - w = v-(z-u); - t = z*z; - t1 = z - t*(P1+t*(P2+t*(P3+t*(P4+t*P5)))); - r = (z*t1)/(t1-two)-(w+z*w); - z = one-(r-z); - j = __HI(z); - j += (n<<20); - if((j>>20)<=0) z = scalbn(z,n); /* subnormal output */ - else __HI(z) += (n<<20); - return s*z; -} diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libfdlibm/fdlibm.h --- a/src/java.base/share/native/libfdlibm/fdlibm.h Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/native/libfdlibm/fdlibm.h Fri Sep 18 09:18:17 2015 -0700 @@ -133,7 +133,6 @@ extern double log10 __P((double)); extern double modf __P((double, double *)); -extern double pow __P((double, double)); extern double sqrt __P((double)); extern double ceil __P((double)); @@ -187,7 +186,6 @@ extern double __ieee754_exp __P((double)); extern double __ieee754_cosh __P((double)); extern double __ieee754_fmod __P((double,double)); -extern double __ieee754_pow __P((double,double)); extern double __ieee754_log10 __P((double)); extern double __ieee754_sinh __P((double)); extern double __ieee754_hypot __P((double,double)); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libfdlibm/w_pow.c --- a/src/java.base/share/native/libfdlibm/w_pow.c Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,73 +0,0 @@ - - -/* - * Copyright (c) 1998, 2001, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -/* - * wrapper pow(x,y) return x**y - */ - -#include "fdlibm.h" - - -#ifdef __STDC__ - double pow(double x, double y) /* wrapper pow */ -#else - double pow(x,y) /* wrapper pow */ - double x,y; -#endif -{ -#ifdef _IEEE_LIBM - return __ieee754_pow(x,y); -#else - double z; - z=__ieee754_pow(x,y); - if(_LIB_VERSION == _IEEE_|| isnan(y)) return z; - if(isnan(x)) { - if(y==0.0) - return __kernel_standard(x,y,42); /* pow(NaN,0.0) */ - else - return z; - } - if(x==0.0){ - if(y==0.0) - return __kernel_standard(x,y,20); /* pow(0.0,0.0) */ - if(finite(y)&&y<0.0) - return __kernel_standard(x,y,23); /* pow(0.0,negative) */ - return z; - } - if(!finite(z)) { - if(finite(x)&&finite(y)) { - if(isnan(z)) - return __kernel_standard(x,y,24); /* pow neg**non-int */ - else - return __kernel_standard(x,y,21); /* pow overflow */ - } - } - if(z==0.0&&finite(x)&&finite(y)) - return __kernel_standard(x,y,22); /* pow underflow */ - return z; -#endif -} diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjava/Image.c --- a/src/java.base/share/native/libjava/Image.c Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,189 +0,0 @@ -/* - * Copyright (c) 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -#include - -#include "jni.h" -#include "jvm.h" -#include "jdk_internal_jimage_ImageNativeSubstrate.h" - -JNIEXPORT jlong JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_openImage(JNIEnv *env, - jclass cls, jstring path, jboolean big_endian) { - const char *nativePath; - jlong ret; - - nativePath = (*env)->GetStringUTFChars(env, path, NULL); - ret = JVM_ImageOpen(env, nativePath, big_endian); - (*env)->ReleaseStringUTFChars(env, path, nativePath); - return ret; -} - -JNIEXPORT void JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_closeImage(JNIEnv *env, - jclass cls, jlong id) { - JVM_ImageClose(env, id); -} - -JNIEXPORT jlong JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_getIndexAddress(JNIEnv *env, - jclass cls, jlong id) { - return JVM_ImageGetIndexAddress(env, id); -} - -JNIEXPORT jlong JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_getDataAddress(JNIEnv *env, - jclass cls, jlong id) { - return JVM_ImageGetDataAddress(env, id); -} - -JNIEXPORT jboolean JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_read(JNIEnv *env, - jclass cls, jlong id, jlong offset, - jobject uncompressedBuffer, jlong uncompressed_size) { - unsigned char* uncompressedAddress; - - uncompressedAddress = (unsigned char*) (*env)->GetDirectBufferAddress(env, uncompressedBuffer); - if (uncompressedBuffer == NULL) { - return JNI_FALSE; - } - return JVM_ImageRead(env, id, offset, uncompressedAddress, uncompressed_size); -} - -JNIEXPORT jboolean JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_readCompressed(JNIEnv *env, - jclass cls, jlong id, jlong offset, - jobject compressedBuffer, jlong compressed_size, - jobject uncompressedBuffer, jlong uncompressed_size) { - // Get address of read direct buffer. - unsigned char* compressedAddress; - unsigned char* uncompressedAddress; - - compressedAddress = (unsigned char*) (*env)->GetDirectBufferAddress(env, compressedBuffer); - // Get address of decompression direct buffer. - uncompressedAddress = (unsigned char*) (*env)->GetDirectBufferAddress(env, uncompressedBuffer); - if (uncompressedBuffer == NULL || compressedBuffer == NULL) { - return JNI_FALSE; - } - return JVM_ImageReadCompressed(env, id, offset, compressedAddress, compressed_size, - uncompressedAddress, uncompressed_size); -} - -JNIEXPORT jbyteArray JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_getStringBytes(JNIEnv *env, - jclass cls, jlong id, jint offset) { - const char* data; - size_t size; - jbyteArray byteArray; - jbyte* rawBytes; - - data = JVM_ImageGetStringBytes(env, id, offset); - // Determine String length. - size = strlen(data); - // Allocate byte array. - byteArray = (*env)->NewByteArray(env, (jsize) size); - if (byteArray == NULL) { - return NULL; - } - // Get array base address. - rawBytes = (*env)->GetByteArrayElements(env, byteArray, NULL); - // Copy bytes from image string table. - memcpy(rawBytes, data, size); - // Release byte array base address. - (*env)->ReleaseByteArrayElements(env, byteArray, rawBytes, 0); - return byteArray; -} - -JNIEXPORT jlongArray JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_getAttributes(JNIEnv *env, - jclass cls, jlong id, jint offset) { - // Allocate a jlong large enough for all location attributes. - jlongArray attributes; - jlong* rawAttributes; - jlong* ret; - - attributes = (*env)->NewLongArray(env, JVM_ImageGetAttributesCount(env)); - if (attributes == NULL) { - return NULL; - } - // Get base address for jlong array. - rawAttributes = (*env)->GetLongArrayElements(env, attributes, NULL); - ret = JVM_ImageGetAttributes(env, rawAttributes, id, offset); - // Release jlong array base address. - (*env)->ReleaseLongArrayElements(env, attributes, rawAttributes, 0); - return ret == NULL ? NULL : attributes; -} - -JNIEXPORT jlongArray JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_findAttributes(JNIEnv *env, - jclass cls, jlong id, jbyteArray utf8) { - // Allocate a jlong large enough for all location attributes. - jsize count; - jlongArray attributes; - jlong* rawAttributes; - jsize size; - jbyte* rawBytes; - jlong* ret; - - count = JVM_ImageGetAttributesCount(env); - attributes = (*env)->NewLongArray(env, JVM_ImageGetAttributesCount(env)); - if (attributes == NULL) { - return NULL; - } - // Get base address for jlong array. - rawAttributes = (*env)->GetLongArrayElements(env, attributes, NULL); - size = (*env)->GetArrayLength(env, utf8); - rawBytes = (*env)->GetByteArrayElements(env, utf8, NULL); - ret = JVM_ImageFindAttributes(env, rawAttributes, rawBytes, size, id); - (*env)->ReleaseByteArrayElements(env, utf8, rawBytes, 0); - // Release jlong array base address. - (*env)->ReleaseLongArrayElements(env, attributes, rawAttributes, 0); - return ret == NULL ? NULL : attributes; - -} - -JNIEXPORT jintArray JNICALL -Java_jdk_internal_jimage_ImageNativeSubstrate_attributeOffsets(JNIEnv *env, - jclass cls, jlong id) { - unsigned int length; - jintArray offsets; - jint* rawOffsets; - jint* ret; - - length = JVM_ImageAttributeOffsetsLength(env, id); - offsets = (*env)->NewIntArray(env, length); - if (offsets == NULL) { - return NULL; - } - // Get base address of result. - rawOffsets = (*env)->GetIntArrayElements(env, offsets, NULL); - ret = JVM_ImageAttributeOffsets(env, rawOffsets, length, id); - if (length == 0) { - return NULL; - } - // Release result base address. - (*env)->ReleaseIntArrayElements(env, offsets, rawOffsets, 0); - return ret == NULL ? NULL : offsets; -} diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjava/StrictMath.c --- a/src/java.base/share/native/libjava/StrictMath.c Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/share/native/libjava/StrictMath.c Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1994, 2003, 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 @@ -101,12 +101,6 @@ } JNIEXPORT jdouble JNICALL -Java_java_lang_StrictMath_pow(JNIEnv *env, jclass unused, jdouble d1, jdouble d2) -{ - return (jdouble) jpow((double)d1, (double)d2); -} - -JNIEXPORT jdouble JNICALL Java_java_lang_StrictMath_IEEEremainder(JNIEnv *env, jclass unused, jdouble dividend, jdouble divisor) diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/ImageNativeSubstrate.cpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,598 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include + +#include "jni.h" +#include "jni_util.h" +#include "jdk_util.h" +#include "endian.hpp" +#include "imageDecompressor.hpp" +#include "imageFile.hpp" +#include "inttypes.hpp" +#include "jimage.hpp" +#include "osSupport.hpp" + +#include "jdk_internal_jimage_ImageNativeSubstrate.h" + +extern bool MemoryMapImage; + +// jdk.internal.jimage ///////////////////////////////////////////////////////// + +// Java entry to open an image file for sharing. + +static jlong JIMAGE_Open(JNIEnv *env, const char *nativePath, jboolean big_endian) { + // Open image file for reading. + ImageFileReader* reader = ImageFileReader::open(nativePath, big_endian != JNI_FALSE); + // Return image ID as a jlong. + return ImageFileReader::readerToID(reader); +} + +// Java entry for closing a shared image file. + +static void JIMAGE_Close(JNIEnv *env, jlong id) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // If valid reader the close. + if (reader != NULL) { + ImageFileReader::close(reader); + } +} + +// Java entry for accessing the base address of the image index. + +static jlong JIMAGE_GetIndexAddress(JNIEnv *env, jlong id) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // If valid reader return index base address (as jlong) else zero. + return reader != NULL ? (jlong) reader->get_index_address() : 0L; +} + +// Java entry for accessing the base address of the image data. + +static jlong JIMAGE_GetDataAddress(JNIEnv *env, jlong id) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // If valid reader return data base address (as jlong) else zero. + return MemoryMapImage && reader != NULL ? (jlong) reader->get_data_address() : 0L; +} + +// Java entry for reading an uncompressed resource from the image. + +static jboolean JIMAGE_Read(JNIEnv *env, jlong id, jlong offset, + unsigned char* uncompressedAddress, jlong uncompressed_size) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id);\ + // If not a valid reader the fail the read. + if (reader == NULL) return false; + // Get the file offset of resource data. + u8 file_offset = reader->get_index_size() + offset; + // Check validity of arguments. + if (offset < 0 || + uncompressed_size < 0 || + file_offset > reader->file_size() - uncompressed_size) { + return false; + } + // Read file content into buffer. + return (jboolean) reader->read_at((u1*) uncompressedAddress, uncompressed_size, + file_offset); +} + +// Java entry for reading a compressed resource from the image. + +static jboolean JIMAGE_ReadCompressed(JNIEnv *env, + jlong id, jlong offset, + unsigned char* compressedAddress, jlong compressed_size, + unsigned char* uncompressedAddress, jlong uncompressed_size) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // If not a valid reader the fail the read. + if (reader == NULL) return false; + // Get the file offset of resource data. + u8 file_offset = reader->get_index_size() + offset; + // Check validity of arguments. + if (offset < 0 || + compressed_size < 0 || + uncompressed_size < 0 || + file_offset > reader->file_size() - compressed_size) { + return false; + } + + // Read file content into buffer. + bool is_read = reader->read_at(compressedAddress, compressed_size, + file_offset); + // If successfully read then decompress. + if (is_read) { + const ImageStrings strings = reader->get_strings(); + ImageDecompressor::decompress_resource(compressedAddress, uncompressedAddress, + (u4) uncompressed_size, &strings); + } + return (jboolean) is_read; +} + +// Java entry for retrieving UTF-8 bytes from image string table. + +static const char* JIMAGE_GetStringBytes(JNIEnv *env, jlong id, jint offset) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // Fail if not valid reader. + if (reader == NULL) return NULL; + // Manage image string table. + ImageStrings strings = reader->get_strings(); + // Retrieve string adrress from table. + const char* data = strings.get(offset); + return data; +} + +// Utility function to copy location information into a jlong array. +// WARNING: This function is experimental and temporary during JDK 9 development +// cycle. It will not be supported in the eventual JDK 9 release. + +static void image_expand_location(JNIEnv *env, jlong* rawAttributes, ImageLocation& location) { + // Copy attributes from location. + for (int kind = ImageLocation::ATTRIBUTE_END + 1; + kind < ImageLocation::ATTRIBUTE_COUNT; + kind++) { + rawAttributes[kind] = location.get_attribute(kind); + } +} + +// Java entry for retrieving location attributes for attribute offset. + +static jlong* JIMAGE_GetAttributes(JNIEnv *env, jlong* rawAttributes, jlong id, jint offset) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // Fail if not valid reader. + if (reader == NULL) return NULL; + // Retrieve first byte address of resource's location attribute stream. + u1* data = reader->get_location_offset_data(offset); + // Fail if not valid offset. + if (data == NULL) return NULL; + // Expand stream into array. + ImageLocation location(data); + image_expand_location(env, rawAttributes, location); + return rawAttributes; +} + +// Java entry for retrieving location attributes count for attribute offset. + +static jsize JIMAGE_GetAttributesCount(JNIEnv *env) { + return ImageLocation::ATTRIBUTE_COUNT; +} + +// Java entry for retrieving location attributes for named resource. + +static jlong* JIMAGE_FindAttributes(JNIEnv *env, jlong* rawAttributes, jbyte* rawBytes, jsize size, jlong id) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // Fail if not valid reader. + if (reader == NULL) return NULL; + // Convert byte array to a cstring. + char* path = new char[size + 1]; + memcpy(path, rawBytes, size); + path[size] = '\0'; + // Locate resource location data. + ImageLocation location; + bool found = reader->find_location(path, location); + delete path; + // Resource not found. + if (!found) return NULL; + // Expand stream into array. + image_expand_location(env, rawAttributes, location); + return rawAttributes; +} + +// Java entry for retrieving all the attribute stream offsets from an image. + +static jint* JIMAGE_AttributeOffsets(JNIEnv *env, jint* rawOffsets, unsigned int length, jlong id) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // Fail if not valid reader. + if (reader == NULL) return NULL; + // Determine endian for reader. + Endian* endian = reader->endian(); + // Get base address of attribute stream offsets table. + u4* offsets_table = reader->offsets_table(); + // Allocate int array result. + // Copy values to result (converting endian.) + for (u4 i = 0; i < length; i++) { + rawOffsets[i] = endian->get(offsets_table[i]); + } + return rawOffsets; +} + +// Java entry for retrieving all the attribute stream offsets length from an image. + +static unsigned int JIMAGE_AttributeOffsetsLength(JNIEnv *env, jlong id) { + // Convert image ID to image reader structure. + ImageFileReader* reader = ImageFileReader::idToReader(id); + // Fail if not valid reader. + if (reader == NULL) return 0; + // Get perfect hash table length. + u4 length = reader->table_length(); + return (jint) length; +} + +JNIEXPORT jint JNICALL +JNI_OnLoad(JavaVM *vm, void *reserved) { + JNIEnv *env; + + if (vm->GetEnv((void**) &env, JNI_VERSION_1_2) != JNI_OK) { + return JNI_EVERSION; /* JNI version not supported */ + } + + return JNI_VERSION_1_2; +} + +JNIEXPORT jlong JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_openImage(JNIEnv *env, + jclass cls, jstring path, jboolean big_endian) { + const char *nativePath; + jlong ret; + + nativePath = env->GetStringUTFChars(path, NULL); + ret = JIMAGE_Open(env, nativePath, big_endian); + env->ReleaseStringUTFChars(path, nativePath); + return ret; +} + +JNIEXPORT void JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_closeImage(JNIEnv *env, + jclass cls, jlong id) { + JIMAGE_Close(env, id); +} + +JNIEXPORT jlong JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_getIndexAddress(JNIEnv *env, + jclass cls, jlong id) { + return JIMAGE_GetIndexAddress(env, id); +} + +JNIEXPORT jlong JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_getDataAddress(JNIEnv *env, + jclass cls, jlong id) { + return JIMAGE_GetDataAddress(env, id); +} + +JNIEXPORT jboolean JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_read(JNIEnv *env, + jclass cls, jlong id, jlong offset, + jobject uncompressedBuffer, jlong uncompressed_size) { + unsigned char* uncompressedAddress; + + uncompressedAddress = (unsigned char*) env->GetDirectBufferAddress(uncompressedBuffer); + if (uncompressedAddress == NULL) { + return JNI_FALSE; + } + return JIMAGE_Read(env, id, offset, uncompressedAddress, uncompressed_size); +} + +JNIEXPORT jboolean JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_readCompressed(JNIEnv *env, + jclass cls, jlong id, jlong offset, + jobject compressedBuffer, jlong compressed_size, + jobject uncompressedBuffer, jlong uncompressed_size) { + // Get address of read direct buffer. + unsigned char* compressedAddress; + unsigned char* uncompressedAddress; + + compressedAddress = (unsigned char*) env->GetDirectBufferAddress(compressedBuffer); + // Get address of decompression direct buffer. + uncompressedAddress = (unsigned char*) env->GetDirectBufferAddress(uncompressedBuffer); + if (compressedAddress == NULL || uncompressedAddress == NULL) { + return JNI_FALSE; + } + return JIMAGE_ReadCompressed(env, id, offset, compressedAddress, compressed_size, + uncompressedAddress, uncompressed_size); +} + +JNIEXPORT jbyteArray JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_getStringBytes(JNIEnv *env, + jclass cls, jlong id, jint offset) { + const char* data; + size_t size; + jbyteArray byteArray; + jbyte* rawBytes; + + data = JIMAGE_GetStringBytes(env, id, offset); + // Determine String length. + size = strlen(data); + // Allocate byte array. + byteArray = env->NewByteArray((jsize) size); + if (byteArray == NULL) { + return NULL; + } + // Get array base address. + rawBytes = env->GetByteArrayElements(byteArray, NULL); + // Copy bytes from image string table. + memcpy(rawBytes, data, size); + // Release byte array base address. + env->ReleaseByteArrayElements(byteArray, rawBytes, 0); + return byteArray; +} + +JNIEXPORT jlongArray JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_getAttributes(JNIEnv *env, + jclass cls, jlong id, jint offset) { + // Allocate a jlong large enough for all location attributes. + jlongArray attributes; + jlong* rawAttributes; + jlong* ret; + + attributes = env->NewLongArray(JIMAGE_GetAttributesCount(env)); + if (attributes == NULL) { + return NULL; + } + // Get base address for jlong array. + rawAttributes = env->GetLongArrayElements(attributes, NULL); + ret = JIMAGE_GetAttributes(env, rawAttributes, id, offset); + // Release jlong array base address. + env->ReleaseLongArrayElements(attributes, rawAttributes, 0); + return ret == NULL ? NULL : attributes; +} + +JNIEXPORT jlongArray JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_findAttributes(JNIEnv *env, + jclass cls, jlong id, jbyteArray utf8) { + // Allocate a jlong large enough for all location attributes. + jsize count; + jlongArray attributes; + jlong* rawAttributes; + jsize size; + jbyte* rawBytes; + jlong* ret; + + count = JIMAGE_GetAttributesCount(env); + attributes = env->NewLongArray(JIMAGE_GetAttributesCount(env)); + if (attributes == NULL) { + return NULL; + } + // Get base address for jlong array. + rawAttributes = env->GetLongArrayElements(attributes, NULL); + size = env->GetArrayLength(utf8); + rawBytes = env->GetByteArrayElements(utf8, NULL); + ret = JIMAGE_FindAttributes(env, rawAttributes, rawBytes, size, id); + env->ReleaseByteArrayElements(utf8, rawBytes, 0); + // Release jlong array base address. + env->ReleaseLongArrayElements(attributes, rawAttributes, 0); + return ret == NULL ? NULL : attributes; + +} + +JNIEXPORT jintArray JNICALL +Java_jdk_internal_jimage_ImageNativeSubstrate_attributeOffsets(JNIEnv *env, + jclass cls, jlong id) { + unsigned int length; + jintArray offsets; + jint* rawOffsets; + jint* ret; + + length = JIMAGE_AttributeOffsetsLength(env, id); + offsets = env->NewIntArray(length); + if (offsets == NULL) { + return NULL; + } + // Get base address of result. + rawOffsets = env->GetIntArrayElements(offsets, NULL); + ret = JIMAGE_AttributeOffsets(env, rawOffsets, length, id); + if (length == 0) { + return NULL; + } + // Release result base address. + env->ReleaseIntArrayElements(offsets, rawOffsets, 0); + return ret == NULL ? NULL : offsets; +} + +/* + * Class: jdk_internal_jimage_ImageNativeSubstrate + * Method: JIMAGE_open + * Signature: (Ljava/lang/String;)J + */ +JNIEXPORT jlong JNICALL Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1Open +(JNIEnv *env, jclass, jstring path) { + const char *nativePath = env->GetStringUTFChars(path, NULL); + if (nativePath == NULL) + return 0; // Exception already thrown + jint error; + jlong ret = (jlong) JIMAGE_Open(nativePath, &error); + env->ReleaseStringUTFChars(path, nativePath); + return ret; +} + +/* + * Class: jdk_internal_jimage_ImageNativeSubstrate + * Method: JIMAGE_Close + * Signature: (J)J + */ +JNIEXPORT void JNICALL Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1Close +(JNIEnv *env, jclass, jlong jimageHandle) { + JIMAGE_Close((JImageFile*) jimageHandle); +} + +/* + * Class: jdk_internal_jimage_ImageNativeSubstrate + * Method: JIMAGE_FindResource + * Signature: (JLjava/lang/String;Ljava/lang/String;Ljava/lang/String;[J)J + */ +JNIEXPORT jlong JNICALL Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1FindResource +(JNIEnv *env, jclass, jlong jimageHandle, jstring moduleName, + jstring version, jstring path, jlongArray output_size) { + const char *native_module = NULL; + const char *native_version = NULL; + const char *native_path = NULL; + jlong * native_array = NULL; + jlong size = 0; + jlong ret = 0; + + do { + native_module = env->GetStringUTFChars(moduleName, NULL); + if (native_module == NULL) + break; + native_version = env->GetStringUTFChars(version, NULL); + if (native_version == NULL) + break; + native_path = env->GetStringUTFChars(path, NULL); + if (native_path == NULL) + break; + if (env->GetArrayLength(output_size) < 1) + break; + // Get base address for jlong array. + native_array = env->GetLongArrayElements(output_size, NULL); + if (native_array == NULL) + break; + + ret = (jlong) JIMAGE_FindResource((JImageFile *) jimageHandle, + native_module, native_version, native_path, &size); + if (ret != 0) + *native_array = size; + } while (0); + + if (native_array != NULL) + env->ReleaseLongArrayElements(output_size, native_array, 0); + if (native_path != NULL) + env->ReleaseStringUTFChars(path, native_path); + if (native_version != NULL) + env->ReleaseStringUTFChars(path, native_version); + if (native_module != NULL) + env->ReleaseStringUTFChars(path, native_module); + + return ret; +} + +/* + * Class: jdk_internal_jimage_ImageNativeSubstrate + * Method: JIMAGE_GetResource + * Signature: (JJ[BJ)J + */ +JNIEXPORT jlong JNICALL Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1GetResource +(JNIEnv *env, jclass, jlong jimageHandle, jlong jlocationHandle, jbyteArray buffer, jlong size) { + jbyte * native_buffer = NULL; + jlong actual_size = 0; + do { + if (env->GetArrayLength(buffer) < size) + break; + + native_buffer = env->GetByteArrayElements(buffer, NULL); + if (native_buffer == NULL) + break; + + actual_size = JIMAGE_GetResource((JImageFile*) jimageHandle, + (JImageLocationRef) jlocationHandle, + (char *) native_buffer, size); + } while (0); + // Release byte array + if (native_buffer != NULL) + env->ReleaseByteArrayElements(buffer, native_buffer, 0); + + return actual_size; +} + +// Structure passed from iterator to a visitor to accumulate the results + +struct VisitorData { + JNIEnv *env; + int size; // current number of strings + int max; // Maximum number of strings + jobjectArray array; // String array to store the strings +}; + +// Visitor to accumulate fully qualified resource names + +static bool resourceVisitor(JImageFile* image, + const char* module, const char* version, const char* package, + const char* name, const char* extension, void* arg) { + struct VisitorData *vdata = (struct VisitorData *) arg; + JNIEnv* env = vdata->env; + if (vdata->size < vdata->max) { + // Store if there is room in the array + // Concatenate to get full path + char fullpath[IMAGE_MAX_PATH]; + fullpath[0] = '\0'; + if (*module != '\0') { + strncpy(fullpath, "/", IMAGE_MAX_PATH - 1); + strncat(fullpath, module, IMAGE_MAX_PATH - 1); + strncat(fullpath, "/", IMAGE_MAX_PATH - 1); + } + if (*package != '\0') { + strncat(fullpath, package, IMAGE_MAX_PATH - 1); + strncat(fullpath, "/", IMAGE_MAX_PATH - 1); + } + strncat(fullpath, name, IMAGE_MAX_PATH - 1); + if (*extension != '\0') { + strncat(fullpath, ".", IMAGE_MAX_PATH - 1); + strncat(fullpath, extension, IMAGE_MAX_PATH - 1); + } + jobject str = env->NewStringUTF(fullpath); + JNU_CHECK_EXCEPTION_RETURN(env, true); + env->SetObjectArrayElement(vdata->array, vdata->size, str); + JNU_CHECK_EXCEPTION_RETURN(env, true); + } + vdata->size++; // always count so the total size is returned + return true; +} + +/* + * Class: jdk_internal_jimage_ImageNativeSubstrate + * Method: JIMAGE_Resources + * Signature: (J)V + */ +JNIEXPORT jint JNICALL Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1Resources +(JNIEnv *env, jclass, jlong jimageHandle, + jobjectArray outputNames) { + struct VisitorData vdata; + vdata.env = env; + vdata.max = 0; + vdata.size = 0; + vdata.array = outputNames; + + vdata.max = (outputNames != NULL) ? env->GetArrayLength(outputNames) : 0; + JIMAGE_ResourceIterator((JImageFile*) jimageHandle, &resourceVisitor, &vdata); + return vdata.size; +} + +/* + * Class: jdk_internal_jimage_ImageNativeSubstrate + * Method: JIMAGE_PackageToModule + * Signature: (JLjava/lang/String;)Ljava/lang/String; + */ +JNIEXPORT jstring JNICALL Java_jdk_internal_jimage_ImageNativeSubstrate_JIMAGE_1PackageToModule +(JNIEnv *env, jclass, jlong jimageHandle, jstring package_name) { + const char *native_package = NULL; + const char *native_module = NULL; + jstring module = NULL; + + native_package = env->GetStringUTFChars(package_name, NULL); + JNU_CHECK_EXCEPTION_RETURN(env, NULL); + + native_module = JIMAGE_PackageToModule((JImageFile*) jimageHandle, native_package); + if (native_module != NULL) { + module = env->NewStringUTF(native_module); + } + env->ReleaseStringUTFChars(package_name, native_package); + return module; +} + +JNIEXPORT void JNICALL JNI_OnUnload(JavaVM *vm, void *reserved) { + ImageDecompressor::image_decompressor_close(); +} diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/endian.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/endian.cpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,102 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "endian.hpp" +#include "inttypes.hpp" + +// Most modern compilers optimize the bswap routines to native instructions. +inline static u2 bswap_16(u2 x) { + return ((x & 0xFF) << 8) | + ((x >> 8) & 0xFF); +} + +inline static u4 bswap_32(u4 x) { + return ((x & 0xFF) << 24) | + ((x & 0xFF00) << 8) | + ((x >> 8) & 0xFF00) | + ((x >> 24) & 0xFF); +} + +inline static u8 bswap_64(u8 x) { + return (u8)bswap_32((u4)x) << 32 | + (u8)bswap_32((u4)(x >> 32)); +} + +u2 NativeEndian::get(u2 x) { return x; } +u4 NativeEndian::get(u4 x) { return x; } +u8 NativeEndian::get(u8 x) { return x; } +s2 NativeEndian::get(s2 x) { return x; } +s4 NativeEndian::get(s4 x) { return x; } +s8 NativeEndian::get(s8 x) { return x; } + +void NativeEndian::set(u2& x, u2 y) { x = y; } +void NativeEndian::set(u4& x, u4 y) { x = y; } +void NativeEndian::set(u8& x, u8 y) { x = y; } +void NativeEndian::set(s2& x, s2 y) { x = y; } +void NativeEndian::set(s4& x, s4 y) { x = y; } +void NativeEndian::set(s8& x, s8 y) { x = y; } + +NativeEndian NativeEndian::_native; + +u2 SwappingEndian::get(u2 x) { return bswap_16(x); } +u4 SwappingEndian::get(u4 x) { return bswap_32(x); } +u8 SwappingEndian::get(u8 x) { return bswap_64(x); } +s2 SwappingEndian::get(s2 x) { return bswap_16(x); } +s4 SwappingEndian::get(s4 x) { return bswap_32(x); } +s8 SwappingEndian::get(s8 x) { return bswap_64(x); } + +void SwappingEndian::set(u2& x, u2 y) { x = bswap_16(y); } +void SwappingEndian::set(u4& x, u4 y) { x = bswap_32(y); } +void SwappingEndian::set(u8& x, u8 y) { x = bswap_64(y); } +void SwappingEndian::set(s2& x, s2 y) { x = bswap_16(y); } +void SwappingEndian::set(s4& x, s4 y) { x = bswap_32(y); } +void SwappingEndian::set(s8& x, s8 y) { x = bswap_64(y); } + +SwappingEndian SwappingEndian::_swapping; + +Endian* Endian::get_handler(bool big_endian) { + // If requesting little endian on a little endian machine or + // big endian on a big endian machine use native handler + if (big_endian == is_big_endian()) { + return NativeEndian::get_native(); + } else { + // Use swapping handler. + return SwappingEndian::get_swapping(); + } +} + +// Return a platform u2 from an array in which Big Endian is applied. +u2 Endian::get_java(u1* x) { + return (u2) (x[0]<<8 | x[1]); +} + +// Add a platform u2 to the array as a Big Endian u2 +void Endian::set_java(u1* p, u2 x) { + p[0] = (x >> 8) & 0xff; + p[1] = x & 0xff; +} + +Endian* Endian::get_native_handler() { + return NativeEndian::get_native(); +} diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/endian.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/endian.hpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,124 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef LIBJIMAGE_ENDIAN_HPP +#define LIBJIMAGE_ENDIAN_HPP + +#include "inttypes.hpp" + +// Selectable endian handling. Endian handlers are used when accessing values +// that are of unknown (until runtime) endian. The only requirement of the values +// accessed are that they are aligned to proper size boundaries (no misalignment.) +// To select an endian handler, one should call Endian::get_handler(big_endian); +// Where big_endian is true if big endian is required and false otherwise. The +// native endian handler can be fetched with Endian::get_native_handler(); +// To retrieve a value using the approprate endian, use one of the overloaded +// calls to get. To set a value, then use one of the overloaded set calls. +// Ex. +// s4 value; // Imported value; +// ... +// Endian* endian = Endian::get_handler(true); // Use big endian +// s4 corrected = endian->get(value); +// endian->set(value, 1); +// +class Endian { +public: + virtual u2 get(u2 x) = 0; + virtual u4 get(u4 x) = 0; + virtual u8 get(u8 x) = 0; + virtual s2 get(s2 x) = 0; + virtual s4 get(s4 x) = 0; + virtual s8 get(s8 x) = 0; + + virtual void set(u2& x, u2 y) = 0; + virtual void set(u4& x, u4 y) = 0; + virtual void set(u8& x, u8 y) = 0; + virtual void set(s2& x, s2 y) = 0; + virtual void set(s4& x, s4 y) = 0; + virtual void set(s8& x, s8 y) = 0; + + // Quick little endian test. + static bool is_little_endian() { u4 x = 1; return *(u1 *)&x != 0; } + + // Quick big endian test. + static bool is_big_endian() { return !is_little_endian(); } + + // Select an appropriate endian handler. + static Endian* get_handler(bool big_endian); + + // Return the native endian handler. + static Endian* get_native_handler(); + + // get platform u2 from Java Big endian + static u2 get_java(u1* x); + // set platform u2 to Java Big endian + static void set_java(u1* p, u2 x); +}; + +// Normal endian handling. +class NativeEndian : public Endian { +private: + static NativeEndian _native; + +public: + u2 get(u2 x); + u4 get(u4 x); + u8 get(u8 x); + s2 get(s2 x); + s4 get(s4 x); + s8 get(s8 x); + + void set(u2& x, u2 y); + void set(u4& x, u4 y); + void set(u8& x, u8 y); + void set(s2& x, s2 y); + void set(s4& x, s4 y); + void set(s8& x, s8 y); + + static Endian* get_native() { return &_native; } +}; + +// Swapping endian handling. +class SwappingEndian : public Endian { +private: + static SwappingEndian _swapping; + +public: + u2 get(u2 x); + u4 get(u4 x); + u8 get(u8 x); + s2 get(s2 x); + s4 get(s4 x); + s8 get(s8 x); + + void set(u2& x, u2 y); + void set(u4& x, u4 y); + void set(u8& x, u8 y); + void set(s2& x, s2 y); + void set(s4& x, s4 y); + void set(s8& x, s8 y); + + static Endian* get_swapping() { return &_swapping; } +}; +#endif // LIBJIMAGE_ENDIAN_HPP diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/imageDecompressor.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/imageDecompressor.cpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,332 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + + +#include "jni.h" +#include "imageDecompressor.hpp" +#include "endian.hpp" +#ifdef WIN32 +#include +#else +#include +#endif + +typedef jboolean (JNICALL *ZipInflateFully_t)(void *inBuf, jlong inLen, void *outBuf, jlong outLen, char **pmsg); +static ZipInflateFully_t ZipInflateFully = NULL; + +#ifndef WIN32 + #define JNI_LIB_PREFIX "lib" + #ifdef __APPLE__ + #define JNI_LIB_SUFFIX ".dylib" + #else + #define JNI_LIB_SUFFIX ".so" + #endif +#endif + +/** + * Return the address of the entry point named in the zip shared library. + * @param name - the name of the entry point + * @return the address of the entry point or NULL + */ +static void* findEntry(const char* name) { + void *addr = NULL; +#ifdef WIN32 + HMODULE handle = GetModuleHandle("zip.dll"); + if (handle == NULL) { + return NULL; + } + addr = (void*) GetProcAddress(handle, name); + return addr; +#else + addr = dlopen(JNI_LIB_PREFIX "zip" JNI_LIB_SUFFIX, RTLD_GLOBAL|RTLD_LAZY); + if (addr == NULL) { + return NULL; + } + addr = dlsym(addr, name); + return addr; +#endif +} + +/* + * Initialize the array of decompressors. + */ +int ImageDecompressor::_decompressors_num = 0; +ImageDecompressor** ImageDecompressor::_decompressors = NULL; +void ImageDecompressor::image_decompressor_init() { + if (_decompressors == NULL) { + ZipInflateFully = (ZipInflateFully_t) findEntry("ZIP_InflateFully"); + assert(ZipInflateFully != NULL && "ZIP decompressor not found."); + _decompressors_num = 2; + _decompressors = new ImageDecompressor*[_decompressors_num]; + _decompressors[0] = new ZipDecompressor("zip"); + _decompressors[1] = new SharedStringDecompressor("compact-cp"); + } +} + +void ImageDecompressor::image_decompressor_close() { + delete _decompressors; +} + +/* + * Locate decompressor. + */ +ImageDecompressor* ImageDecompressor::get_decompressor(const char * decompressor_name) { + image_decompressor_init(); + for (int i = 0; i < _decompressors_num; i++) { + ImageDecompressor* decompressor = _decompressors[i]; + assert(decompressor != NULL && "Decompressors not initialized."); + if (strcmp(decompressor->get_name(), decompressor_name) == 0) { + return decompressor; + } + } + assert(false && "No decompressor found."); + return NULL; +} + +/* + * Decompression entry point. Called from ImageFileReader::get_resource. + */ +void ImageDecompressor::decompress_resource(u1* compressed, u1* uncompressed, + u4 uncompressed_size, const ImageStrings* strings) { + bool has_header = false; + u1* decompressed_resource = compressed; + u1* compressed_resource = compressed; + + // Resource could have been transformed by a stack of decompressors. + // Iterate and decompress resources until there is no more header. + do { + ResourceHeader _header; + memcpy(&_header, compressed_resource, sizeof (ResourceHeader)); + has_header = _header._magic == ResourceHeader::resource_header_magic; + if (has_header) { + // decompressed_resource array contains the result of decompression + decompressed_resource = new u1[_header._uncompressed_size]; + // Retrieve the decompressor name + const char* decompressor_name = strings->get(_header._decompressor_name_offset); + assert(decompressor_name && "image decompressor not found"); + // Retrieve the decompressor instance + ImageDecompressor* decompressor = get_decompressor(decompressor_name); + assert(decompressor && "image decompressor not found"); + u1* compressed_resource_base = compressed_resource; + compressed_resource += ResourceHeader::resource_header_length; + // Ask the decompressor to decompress the compressed content + decompressor->decompress_resource(compressed_resource, decompressed_resource, + &_header, strings); + if (compressed_resource_base != compressed) { + delete compressed_resource_base; + } + compressed_resource = decompressed_resource; + } + } while (has_header); + memcpy(uncompressed, decompressed_resource, uncompressed_size); + delete decompressed_resource; +} + +// Zip decompressor + +void ZipDecompressor::decompress_resource(u1* data, u1* uncompressed, + ResourceHeader* header, const ImageStrings* strings) { + char* msg = NULL; + jboolean res = ZipDecompressor::decompress(data, header->_size, uncompressed, + header->_uncompressed_size, &msg); + assert(res && "decompression failed"); +} + +jboolean ZipDecompressor::decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg) { + return (*ZipInflateFully)(in, inSize, out, outSize, pmsg); +} + +// END Zip Decompressor + +// Shared String decompressor + +// array index is the constant pool tag. value is size. +// eg: array[5] = 8; means size of long is 8 bytes. +const u1 SharedStringDecompressor::sizes[] = {0, 0, 0, 4, 4, 8, 8, 2, 2, 4, 4, 4, 4, 0, 0, 3, 2, 0, 4}; +/** + * Recreate the class by reconstructing the constant pool. + */ +void SharedStringDecompressor::decompress_resource(u1* data, + u1* uncompressed_resource, + ResourceHeader* header, const ImageStrings* strings) { + u1* uncompressed_base = uncompressed_resource; + u1* data_base = data; + int header_size = 8; // magic + major + minor + memcpy(uncompressed_resource, data, header_size + 2); //+ cp count + uncompressed_resource += header_size + 2; + data += header_size; + u2 cp_count = Endian::get_java(data); + data += 2; + for (int i = 1; i < cp_count; i++) { + u1 tag = *data; + data += 1; + switch (tag) { + + case externalized_string: + { // String in Strings table + *uncompressed_resource = 1; + uncompressed_resource += 1; + int i = decompress_int(data); + const char * string = strings->get(i); + int str_length = (int) strlen(string); + Endian::set_java(uncompressed_resource, str_length); + uncompressed_resource += 2; + memcpy(uncompressed_resource, string, str_length); + uncompressed_resource += str_length; + break; + } + // Descriptor String has been split and types added to Strings table + case externalized_string_descriptor: + { + *uncompressed_resource = 1; + uncompressed_resource += 1; + int descriptor_index = decompress_int(data); + int indexes_length = decompress_int(data); + u1* length_address = uncompressed_resource; + uncompressed_resource += 2; + int desc_length = 0; + const char * desc_string = strings->get(descriptor_index); + if (indexes_length > 0) { + u1* indexes_base = data; + data += indexes_length; + char c = *desc_string; + do { + *uncompressed_resource = c; + uncompressed_resource++; + desc_length += 1; + /* + * Every L character is the marker we are looking at in order + * to reconstruct the descriptor. Each time an L is found, then + * we retrieve the couple token/token at the current index and + * add it to the descriptor. + * "(L;I)V" and "java/lang","String" couple of tokens, + * this becomes "(Ljava/lang/String;I)V" + */ + if (c == 'L') { + int index = decompress_int(indexes_base); + const char * pkg = strings->get(index); + int str_length = (int) strlen(pkg); + // the case where we have a package. + // reconstruct the type full name + if (str_length > 0) { + int len = str_length + 1; + char* fullpkg = new char[len]; + char* pkg_base = fullpkg; + memcpy(fullpkg, pkg, str_length); + fullpkg += str_length; + *fullpkg = '/'; + memcpy(uncompressed_resource, pkg_base, len); + uncompressed_resource += len; + delete pkg_base; + desc_length += len; + } else { // Empty package + // Nothing to do. + } + int classIndex = decompress_int(indexes_base); + const char * clazz = strings->get(classIndex); + int clazz_length = (int) strlen(clazz); + memcpy(uncompressed_resource, clazz, clazz_length); + uncompressed_resource += clazz_length; + desc_length += clazz_length; + } + desc_string += 1; + c = *desc_string; + } while (c != '\0'); + } else { + desc_length = (int) strlen(desc_string); + memcpy(uncompressed_resource, desc_string, desc_length); + uncompressed_resource += desc_length; + } + Endian::set_java(length_address, desc_length); + break; + } + + case constant_utf8: + { // UTF-8 + *uncompressed_resource = tag; + uncompressed_resource += 1; + u2 str_length = Endian::get_java(data); + int len = str_length + 2; + memcpy(uncompressed_resource, data, len); + uncompressed_resource += len; + data += len; + break; + } + + case constant_long: + case constant_double: + { + i++; + } + default: + { + *uncompressed_resource = tag; + uncompressed_resource += 1; + int size = sizes[tag]; + memcpy(uncompressed_resource, data, size); + uncompressed_resource += size; + data += size; + } + } + } + u4 remain = header->_size - (int)(data - data_base); + u4 computed = (u4)(uncompressed_resource - uncompressed_base) + remain; + if (header->_uncompressed_size != computed) + printf("Failure, expecting %d but getting %d\n", header->_uncompressed_size, + computed); + assert(header->_uncompressed_size == computed && + "Constant Pool reconstruction failed"); + memcpy(uncompressed_resource, data, remain); +} + +/* + * Decompress integers. Compressed integers are negative. + * If positive, the integer is not decompressed. + * If negative, length extracted from the first byte, then reconstruct the integer + * from the following bytes. + * Example of compression: 1 is compressed on 1 byte: 10100001 + */ +int SharedStringDecompressor::decompress_int(unsigned char*& value) { + int len = 4; + int res = 0; + char b1 = *value; + if (is_compressed((signed char)b1)) { // compressed + len = get_compressed_length(b1); + char clearedValue = b1 &= 0x1F; + if (len == 1) { + res = clearedValue; + } else { + res = (clearedValue & 0xFF) << 8 * (len - 1); + for (int i = 1; i < len; i++) { + res |= (value[i]&0xFF) << 8 * (len - i - 1); + } + } + } else { + res = (value[0] & 0xFF) << 24 | (value[1]&0xFF) << 16 | + (value[2]&0xFF) << 8 | (value[3]&0xFF); + } + value += len; + return res; +} +// END Shared String decompressor diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/imageDecompressor.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/imageDecompressor.hpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,162 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef LIBJIMAGE_IMAGEDECOMPRESSOR_HPP +#define LIBJIMAGE_IMAGEDECOMPRESSOR_HPP + +#include +#include + +#include "imageFile.hpp" +#include "inttypes.hpp" +#include "jni.h" + +/* + * Compressed resources located in image have an header. + * This header contains: + * - _magic: A magic u4, required to retrieved the header in the compressed content + * - _size: The size of the compressed resource. + * - _uncompressed_size: The uncompressed size of the compressed resource. + * - _decompressor_name_offset: The ImageDecompressor instance name StringsTable offset. + * - _decompressor_config_offset: StringsTable offset of configuration that could be needed by + * the decompressor in order to decompress. + * - _is_terminal: 1: the compressed content is terminal. Uncompressing it would + * create the actual resource. 0: the compressed content is not terminal. Uncompressing it + * will result in a compressed content to be decompressed (This occurs when a stack of compressors + * have been used to compress the resource. + */ +struct ResourceHeader { + /* Length of header, needed to retrieve content offset */ + static const u1 resource_header_length = 21; + /* magic bytes that identifies a compressed resource header*/ + static const u4 resource_header_magic = 0xCAFEFAFA; + u4 _magic; // Resource header + u4 _size; // Resource size + u4 _uncompressed_size; // Expected uncompressed size + u4 _decompressor_name_offset; // Strings table decompressor offset + u4 _decompressor_config_offset; // Strings table config offset + u1 _is_terminal; // Last decompressor 1, otherwise 0. +}; + +/* + * Resources located in jimage file can be compressed. Compression occurs at + * jimage file creation time. When compressed a resource is added an header that + * contains the name of the compressor that compressed it. + * Various compression strategies can be applied to compress a resource. + * The same resource can even be compressed multiple time by a stack of compressors. + * At runtime, a resource is decompressed in a loop until there is no more header + * meaning that the resource is equivalent to the not compressed resource. + * In each iteration, the name of the compressor located in the current header + * is used to retrieve the associated instance of ImageDecompressor. + * For example “zip” is the name of the compressor that compresses resources + * using the zip algorithm. The ZipDecompressor class name is also “zip”. + * ImageDecompressor instances are retrieved from a static array in which + * they are registered. + */ +class ImageDecompressor { + +private: + const char* _name; + + /* + * Array of concrete decompressors. This array is used to retrieve the decompressor + * that can handle resource decompression. + */ + static ImageDecompressor** _decompressors; + /** + * Num of decompressors + */ + static int _decompressors_num; + /* + * Identifier of a decompressor. This name is the identification key to retrieve + * decompressor from a resource header. + */ + inline const char* get_name() const { return _name; } + + +protected: + ImageDecompressor(const char* name) : _name(name) { + } + virtual void decompress_resource(u1* data, u1* uncompressed, + ResourceHeader* header, const ImageStrings* strings) = 0; + +public: + static void image_decompressor_init(); + static void image_decompressor_close(); + static ImageDecompressor* get_decompressor(const char * decompressor_name) ; + static void decompress_resource(u1* compressed, u1* uncompressed, + u4 uncompressed_size, const ImageStrings* strings); +}; + +/** + * Zip decompressor. + */ +class ZipDecompressor : public ImageDecompressor { +public: + ZipDecompressor(const char* sym) : ImageDecompressor(sym) { } + void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header, + const ImageStrings* strings); + static jboolean decompress(void *in, u8 inSize, void *out, u8 outSize, char **pmsg); +}; + +/* + * Shared Strings decompressor. This decompressor reconstruct the class + * constant pool UTF_U entries by retrieving strings stored in jimage strings table. + * In addition, if the UTF_8 entry is a descriptor, the descriptor has to be rebuilt, + * all java type having been removed from the descriptor and added to the sting table. + * eg: "(Ljava/lang/String;I)V" ==> "(L;I)V" and "java/lang", "String" + * stored in string table. offsets to the 2 strings are compressed and stored in the + * constantpool entry. + */ +class SharedStringDecompressor : public ImageDecompressor { +private: + // the constant pool tag for UTF8 string located in strings table + static const int externalized_string = 23; + // the constant pool tag for UTF8 descriptors string located in strings table + static const int externalized_string_descriptor = 25; + // the constant pool tag for UTF8 + static const int constant_utf8 = 1; + // the constant pool tag for long + static const int constant_long = 5; + // the constant pool tag for double + static const int constant_double = 6; + // array index is the constant pool tag. value is size. + // eg: array[5] = 8; means size of long is 8 bytes. + static const u1 sizes[]; + // bit 5 and 6 are used to store the length of the compressed integer. + // size can be 1 (01), 2 (10), 3 (11). + // 0x60 ==> 0110000 + static const int compressed_index_size_mask = 0x60; + /* + * mask the length bits (5 and 6) and move to the right 5 bits. + */ + inline static int get_compressed_length(char c) { return ((char) (c & compressed_index_size_mask) >> 5); } + inline static bool is_compressed(signed char b1) { return b1 < 0; } + static int decompress_int(unsigned char*& value); +public: + SharedStringDecompressor(const char* sym) : ImageDecompressor(sym){} + void decompress_resource(u1* data, u1* uncompressed, ResourceHeader* header, + const ImageStrings* strings); +}; +#endif // LIBJIMAGE_IMAGEDECOMPRESSOR_HPP diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/imageFile.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/imageFile.cpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,682 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include +#include +#include + +#include "endian.hpp" +#include "imageDecompressor.hpp" +#include "imageFile.hpp" +#include "inttypes.hpp" +#include "jni.h" +#include "osSupport.hpp" + +// Map the full jimage, only with 64 bit addressing. +bool MemoryMapImage = sizeof(void *) == 8; + +#ifdef WIN32 +const char FileSeparator = '\\'; +#else +const char FileSeparator = '/'; +#endif + +// Image files are an alternate file format for storing classes and resources. The +// goal is to supply file access which is faster and smaller than the jar format. +// +// (More detailed nodes in the header.) +// + +// Compute the Perfect Hashing hash code for the supplied UTF-8 string. +s4 ImageStrings::hash_code(const char* string, s4 seed) { + // Access bytes as unsigned. + u1* bytes = (u1*)string; + // Compute hash code. + for (u1 byte = *bytes++; byte; byte = *bytes++) { + seed = (seed * HASH_MULTIPLIER) ^ byte; + } + // Ensure the result is not signed. + return seed & 0x7FFFFFFF; +} + +// Match up a string in a perfect hash table. +// Returns the index where the name should be. +// Result still needs validation for precise match (false positive.) +s4 ImageStrings::find(Endian* endian, const char* name, s4* redirect, u4 length) { + // If the table is empty, then short cut. + if (!redirect || !length) { + return NOT_FOUND; + } + // Compute the basic perfect hash for name. + s4 hash_code = ImageStrings::hash_code(name); + // Modulo table size. + s4 index = hash_code % length; + // Get redirect entry. + // value == 0 then not found + // value < 0 then -1 - value is true index + // value > 0 then value is seed for recomputing hash. + s4 value = endian->get(redirect[index]); + // if recompute is required. + if (value > 0 ) { + // Entry collision value, need to recompute hash. + hash_code = ImageStrings::hash_code(name, value); + // Modulo table size. + return hash_code % length; + } else if (value < 0) { + // Compute direct index. + return -1 - value; + } + // No entry found. + return NOT_FOUND; +} + +// Test to see if UTF-8 string begins with the start UTF-8 string. If so, +// return non-NULL address of remaining portion of string. Otherwise, return +// NULL. Used to test sections of a path without copying from image string +// table. +const char* ImageStrings::starts_with(const char* string, const char* start) { + char ch1, ch2; + // Match up the strings the best we can. + while ((ch1 = *string) && (ch2 = *start)) { + if (ch1 != ch2) { + // Mismatch, return NULL. + return NULL; + } + // Next characters. + string++, start++; + } + // Return remainder of string. + return string; +} + +// Inflates the attribute stream into individual values stored in the long +// array _attributes. This allows an attribute value to be quickly accessed by +// direct indexing. Unspecified values default to zero (from constructor.) +void ImageLocation::set_data(u1* data) { + // Deflate the attribute stream into an array of attributes. + u1 byte; + // Repeat until end header is found. + while ((byte = *data)) { + // Extract kind from header byte. + u1 kind = attribute_kind(byte); + assert(kind < ATTRIBUTE_COUNT && "invalid image location attribute"); + // Extract length of data (in bytes). + u1 n = attribute_length(byte); + // Read value (most significant first.) + _attributes[kind] = attribute_value(data + 1, n); + // Position to next attribute by skipping attribute header and data bytes. + data += n + 1; + } +} + +// Zero all attribute values. +void ImageLocation::clear_data() { + // Set defaults to zero. + memset(_attributes, 0, sizeof(_attributes)); +} + +// ImageModuleData constructor maps out sub-tables for faster access. +ImageModuleData::ImageModuleData(const ImageFileReader* image_file, + const char* module_data_name) : + _image_file(image_file), + _endian(image_file->endian()), + _strings(image_file->get_strings()) { + // Retrieve the resource containing the module data for the image file. + ImageLocation location; + bool found = image_file->find_location(module_data_name, location); + if (found) { + u8 data_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED); + _data = new u1[(size_t)data_size]; + _image_file->get_resource(location, _data); + // Map out the header. + _header = (Header*)_data; + // Get the package to module entry count. + u4 ptm_count = _header->ptm_count(_endian); + // Get the module to package entry count. + u4 mtp_count = _header->mtp_count(_endian); + // Compute the offset of the package to module perfect hash redirect. + u4 ptm_redirect_offset = sizeof(Header); + // Compute the offset of the package to module data. + u4 ptm_data_offset = ptm_redirect_offset + ptm_count * sizeof(s4); + // Compute the offset of the module to package perfect hash redirect. + u4 mtp_redirect_offset = ptm_data_offset + ptm_count * sizeof(PTMData); + // Compute the offset of the module to package data. + u4 mtp_data_offset = mtp_redirect_offset + mtp_count * sizeof(s4); + // Compute the offset of the module to package tables. + u4 mtp_packages_offset = mtp_data_offset + mtp_count * sizeof(MTPData); + // Compute the address of the package to module perfect hash redirect. + _ptm_redirect = (s4*)(_data + ptm_redirect_offset); + // Compute the address of the package to module data. + _ptm_data = (PTMData*)(_data + ptm_data_offset); + // Compute the address of the module to package perfect hash redirect. + _mtp_redirect = (s4*)(_data + mtp_redirect_offset); + // Compute the address of the module to package data. + _mtp_data = (MTPData*)(_data + mtp_data_offset); + // Compute the address of the module to package tables. + _mtp_packages = (s4*)(_data + mtp_packages_offset); + } else { + // No module data present. + _data = NULL; + _header = NULL; + _ptm_redirect = NULL; + _ptm_data = NULL; + _mtp_redirect = NULL; + _mtp_data = NULL; + _mtp_packages = NULL; + } +} + +// Release module data resource. +ImageModuleData::~ImageModuleData() { + if (_data) { + delete _data; + } +} + +// Return the name of the module data resource. Ex. "./lib/modules/file.jimage" +// yields "file.jdata" +void ImageModuleData::module_data_name(char* buffer, const char* image_file_name) { + // Locate the last slash in the file name path. + const char* slash = strrchr(image_file_name, FileSeparator); + // Trim the path to name and extension. + const char* name = slash ? slash + 1 : (char *)image_file_name; + // Locate the extension period. + const char* dot = strrchr(name, '.'); + assert(dot && "missing extension on jimage name"); + // Trim to only base name. + int length = (int)(dot - name); + strncpy(buffer, name, length); + buffer[length] = '\0'; + // Append extension. + strcat(buffer, ".jdata"); +} + +// Return the module in which a package resides. Returns NULL if not found. +const char* ImageModuleData::package_to_module(const char* package_name) { + // Test files may contain no module data. + if (_data != NULL) { + // Search the package to module table. + s4 index = ImageStrings::find(_endian, package_name, _ptm_redirect, + _header->ptm_count(_endian)); + // If entry is found. + if (index != ImageStrings::NOT_FOUND) { + // Retrieve the package to module entry. + PTMData* data = _ptm_data + index; + // Verify that it is the correct data. + if (strcmp(package_name, get_string(data->name_offset(_endian))) != 0) { + return NULL; + } + // Return the module name. + return get_string(data->module_name_offset(_endian)); + } + } + return NULL; +} + +// Returns all the package names in a module in a NULL terminated array. +// Returns NULL if module not found. +const char** ImageModuleData::module_to_packages(const char* module_name) { + // Test files may contain no module data. + if (_data != NULL) { + // Search the module to package table. + s4 index = ImageStrings::find(_endian, module_name, _mtp_redirect, + _header->mtp_count(_endian)); + // If entry is found. + if (index != ImageStrings::NOT_FOUND) { + // Retrieve the module to package entry. + MTPData* data = _mtp_data + index; + // Verify that it is the correct data. + if (strcmp(module_name, get_string(data->name_offset(_endian))) != 0) { + return NULL; + } + // Construct an array of all the package entries. + u4 count = data->package_count(_endian); + const char** packages = new const char*[count + 1]; + s4 package_offset = data->package_offset(_endian); + for (u4 i = 0; i < count; i++) { + u4 package_name_offset = mtp_package(package_offset + i); + const char* package_name = get_string(package_name_offset); + packages[i] = package_name; + } + packages[count] = NULL; + return packages; + } + } + return NULL; +} + +// Manage a table of open image files. This table allows multiple access points +// to share an open image. +ImageFileReaderTable::ImageFileReaderTable() : _count(0), _max(_growth) { + _table = new ImageFileReader*[_max]; +} + +ImageFileReaderTable::~ImageFileReaderTable() { + delete _table; +} + +// Add a new image entry to the table. +void ImageFileReaderTable::add(ImageFileReader* image) { + if (_count == _max) { + _max += _growth; + _table = static_cast(realloc(_table, _max * sizeof(ImageFileReader*))); + } + _table[_count++] = image; +} + +// Remove an image entry from the table. +void ImageFileReaderTable::remove(ImageFileReader* image) { + s4 last = _count - 1; + for (s4 i = 0; _count; i++) { + if (_table[i] == image) { + if (i != last) { + _table[i] = _table[last]; + _count = last; + } + break; + } + } + + if (_count != 0 && _count == _max - _growth) { + _max -= _growth; + _table = static_cast(realloc(_table, _max * sizeof(ImageFileReader*))); + } +} + +// Determine if image entry is in table. +bool ImageFileReaderTable::contains(ImageFileReader* image) { + for (s4 i = 0; _count; i++) { + if (_table[i] == image) { + return true; + } + } + return false; +} + +// Table to manage multiple opens of an image file. +ImageFileReaderTable ImageFileReader::_reader_table; + +SimpleCriticalSection _reader_table_lock; + +// Open an image file, reuse structure if file already open. +ImageFileReader* ImageFileReader::open(const char* name, bool big_endian) { + { + // Lock out _reader_table. + SimpleCriticalSectionLock cs(&_reader_table_lock); + // Search for an exist image file. + for (u4 i = 0; i < _reader_table.count(); i++) { + // Retrieve table entry. + ImageFileReader* reader = _reader_table.get(i); + // If name matches, then reuse (bump up use count.) + if (strcmp(reader->name(), name) == 0) { + reader->inc_use(); + return reader; + } + } + } // Unlock the mutex + + // Need a new image reader. + ImageFileReader* reader = new ImageFileReader(name, big_endian); + bool opened = reader->open(); + // If failed to open. + if (!opened) { + delete reader; + return NULL; + } + + // Lock to update + SimpleCriticalSectionLock cs(&_reader_table_lock); + // Search for an exist image file. + for (u4 i = 0; i < _reader_table.count(); i++) { + // Retrieve table entry. + ImageFileReader* existing_reader = _reader_table.get(i); + // If name matches, then reuse (bump up use count.) + if (strcmp(existing_reader->name(), name) == 0) { + existing_reader->inc_use(); + reader->close(); + delete reader; + return existing_reader; + } + } + // Bump use count and add to table. + reader->inc_use(); + _reader_table.add(reader); + return reader; +} + +// Close an image file if the file is not in use elsewhere. +void ImageFileReader::close(ImageFileReader *reader) { + // Lock out _reader_table. + SimpleCriticalSectionLock cs(&_reader_table_lock); + // If last use then remove from table and then close. + if (reader->dec_use()) { + _reader_table.remove(reader); + delete reader; + } +} + +// Return an id for the specifed ImageFileReader. +u8 ImageFileReader::readerToID(ImageFileReader *reader) { + // ID is just the cloaked reader address. + return (u8)reader; +} + +// Validate the image id. +bool ImageFileReader::idCheck(u8 id) { + // Make sure the ID is a managed (_reader_table) reader. + SimpleCriticalSectionLock cs(&_reader_table_lock); + return _reader_table.contains((ImageFileReader*)id); +} + +// Return an id for the specifed ImageFileReader. +ImageFileReader* ImageFileReader::idToReader(u8 id) { + assert(idCheck(id) && "invalid image id"); + return (ImageFileReader*)id; +} + +// Constructor intializes to a closed state. +ImageFileReader::ImageFileReader(const char* name, bool big_endian) { + // Copy the image file name. + int len = (int) strlen(name) + 1; + _name = new char[len]; + strncpy(_name, name, len); + // Initialize for a closed file. + _fd = -1; + _endian = Endian::get_handler(big_endian); + _index_data = NULL; +} + +// Close image and free up data structures. +ImageFileReader::~ImageFileReader() { + // Ensure file is closed. + close(); + // Free up name. + if (_name) { + delete _name; + _name = NULL; + } +} + +// Open image file for read access. +bool ImageFileReader::open() { + char buffer[IMAGE_MAX_PATH]; + + // If file exists open for reading. + _fd = osSupport::openReadOnly(_name); + if (_fd == -1) { + return false; + } + // Retrieve the file size. + _file_size = osSupport::size(_name); + // Read image file header and verify it has a valid header. + size_t header_size = sizeof(ImageHeader); + if (_file_size < header_size || + !read_at((u1*)&_header, header_size, 0) || + _header.magic(_endian) != IMAGE_MAGIC || + _header.major_version(_endian) != MAJOR_VERSION || + _header.minor_version(_endian) != MINOR_VERSION) { + close(); + return false; + } + // Size of image index. + _index_size = index_size(); + // Make sure file is large enough to contain the index. + if (_file_size < _index_size) { + return false; + } + // Determine how much of the image is memory mapped. + size_t map_size = (size_t)(MemoryMapImage ? _file_size : _index_size); + // Memory map image (minimally the index.) + _index_data = (u1*)osSupport::map_memory(_fd, _name, 0, map_size); + assert(_index_data && "image file not memory mapped"); + // Retrieve length of index perfect hash table. + u4 length = table_length(); + // Compute offset of the perfect hash table redirect table. + u4 redirect_table_offset = (u4)header_size; + // Compute offset of index attribute offsets. + u4 offsets_table_offset = redirect_table_offset + length * sizeof(s4); + // Compute offset of index location attribute data. + u4 location_bytes_offset = offsets_table_offset + length * sizeof(u4); + // Compute offset of index string table. + u4 string_bytes_offset = location_bytes_offset + locations_size(); + // Compute address of the perfect hash table redirect table. + _redirect_table = (s4*)(_index_data + redirect_table_offset); + // Compute address of index attribute offsets. + _offsets_table = (u4*)(_index_data + offsets_table_offset); + // Compute address of index location attribute data. + _location_bytes = _index_data + location_bytes_offset; + // Compute address of index string table. + _string_bytes = _index_data + string_bytes_offset; + + // Initialize the module data + ImageModuleData::module_data_name(buffer, _name); + module_data = new ImageModuleData(this, buffer); + // Successful open. + return true; +} + +// Close image file. +void ImageFileReader::close() { + // Deallocate the index. + if (_index_data) { + osSupport::unmap_memory((char*)_index_data, _index_size); + _index_data = NULL; + } + // Close file. + if (_fd != -1) { + osSupport::close(_fd); + _fd = -1; + } +} + +// Read directly from the file. +bool ImageFileReader::read_at(u1* data, u8 size, u8 offset) const { + return (u8)osSupport::read(_fd, (char*)data, size, offset) == size; +} + +// Find the location attributes associated with the path. Returns true if +// the location is found, false otherwise. +bool ImageFileReader::find_location(const char* path, ImageLocation& location) const { + // Locate the entry in the index perfect hash table. + s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length()); + // If is found. + if (index != ImageStrings::NOT_FOUND) { + // Get address of first byte of location attribute stream. + u1* data = get_location_data(index); + // Expand location attributes. + location.set_data(data); + // Make sure result is not a false positive. + return verify_location(location, path); + } + return false; +} + +// Find the location index and size associated with the path. +// Returns the location index and size if the location is found, 0 otherwise. +u4 ImageFileReader::find_location_index(const char* path, u8 *size) const { + // Locate the entry in the index perfect hash table. + s4 index = ImageStrings::find(_endian, path, _redirect_table, table_length()); + // If found. + if (index != ImageStrings::NOT_FOUND) { + // Get address of first byte of location attribute stream. + u4 offset = get_location_offset(index); + u1* data = get_location_offset_data(offset); + // Expand location attributes. + ImageLocation location(data); + // Make sure result is not a false positive. + if (verify_location(location, path)) { + *size = (jlong)location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED); + return offset; + } + } + return 0; // not found +} + +// Assemble the location path from the string fragments indicated in the location attributes. +void ImageFileReader::location_path(ImageLocation& location, char* path, size_t max) const { + // Manage the image string table. + ImageStrings strings(_string_bytes, _header.strings_size(_endian)); + // Position to first character of the path buffer. + char* next = path; + // Temp for string length. + size_t length; + // Get module string. + const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings); + // If module string is not empty string. + if (*module != '\0') { + // Get length of module name. + length = strlen(module); + // Make sure there is no buffer overflow. + assert(next - path + length + 2 < max && "buffer overflow"); + // Append '/module/'. + *next++ = '/'; + strncpy(next, module, length); next += length; + *next++ = '/'; + } + // Get parent (package) string. + const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings); + // If parent string is not empty string. + if (*parent != '\0') { + // Get length of module string. + length = strlen(parent); + // Make sure there is no buffer overflow. + assert(next - path + length + 1 < max && "buffer overflow"); + // Append 'patent/' . + strncpy(next, parent, length); next += length; + *next++ = '/'; + } + // Get base name string. + const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings); + // Get length of base name. + length = strlen(base); + // Make sure there is no buffer overflow. + assert(next - path + length < max && "buffer overflow"); + // Append base name. + strncpy(next, base, length); next += length; + // Get extension string. + const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings); + // If extension string is not empty string. + if (*extension != '\0') { + // Get length of extension string. + length = strlen(extension); + // Make sure there is no buffer overflow. + assert(next - path + length + 1 < max && "buffer overflow"); + // Append '.extension' . + *next++ = '.'; + strncpy(next, extension, length); next += length; + } + // Make sure there is no buffer overflow. + assert((size_t)(next - path) < max && "buffer overflow"); + // Terminate string. + *next = '\0'; +} + +// Verify that a found location matches the supplied path (without copying.) +bool ImageFileReader::verify_location(ImageLocation& location, const char* path) const { + // Manage the image string table. + ImageStrings strings(_string_bytes, _header.strings_size(_endian)); + // Position to first character of the path string. + const char* next = path; + // Get module name string. + const char* module = location.get_attribute(ImageLocation::ATTRIBUTE_MODULE, strings); + // If module string is not empty. + if (*module != '\0') { + // Compare '/module/' . + if (*next++ != '/') return false; + if (!(next = ImageStrings::starts_with(next, module))) return false; + if (*next++ != '/') return false; + } + // Get parent (package) string + const char* parent = location.get_attribute(ImageLocation::ATTRIBUTE_PARENT, strings); + // If parent string is not empty string. + if (*parent != '\0') { + // Compare 'parent/' . + if (!(next = ImageStrings::starts_with(next, parent))) return false; + if (*next++ != '/') return false; + } + // Get base name string. + const char* base = location.get_attribute(ImageLocation::ATTRIBUTE_BASE, strings); + // Compare with basne name. + if (!(next = ImageStrings::starts_with(next, base))) return false; + // Get extension string. + const char* extension = location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION, strings); + // If extension is not empty. + if (*extension != '\0') { + // Compare '.extension' . + if (*next++ != '.') return false; + if (!(next = ImageStrings::starts_with(next, extension))) return false; + } + // True only if complete match and no more characters. + return *next == '\0'; +} + +// Return the resource for the supplied location offset. +void ImageFileReader::get_resource(u4 offset, u1* uncompressed_data) const { + // Get address of first byte of location attribute stream. + u1* data = get_location_offset_data(offset); + // Expand location attributes. + ImageLocation location(data); + // Read the data + get_resource(location, uncompressed_data); +} + +// Return the resource for the supplied location. +void ImageFileReader::get_resource(ImageLocation& location, u1* uncompressed_data) const { + // Retrieve the byte offset and size of the resource. + u8 offset = location.get_attribute(ImageLocation::ATTRIBUTE_OFFSET); + u8 uncompressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_UNCOMPRESSED); + u8 compressed_size = location.get_attribute(ImageLocation::ATTRIBUTE_COMPRESSED); + // If the resource is compressed. + if (compressed_size != 0) { + u1* compressed_data; + // If not memory mapped read in bytes. + if (!MemoryMapImage) { + // Allocate buffer for compression. + compressed_data = new u1[(u4)compressed_size]; + // Read bytes from offset beyond the image index. + bool is_read = read_at(compressed_data, compressed_size, _index_size + offset); + assert(is_read && "error reading from image or short read"); + } else { + compressed_data = get_data_address() + offset; + } + // Get image string table. + const ImageStrings strings = get_strings(); + // Decompress resource. + ImageDecompressor::decompress_resource(compressed_data, uncompressed_data, (u4)uncompressed_size, + &strings); + // If not memory mapped then release temporary buffer. + if (!MemoryMapImage) { + delete compressed_data; + } + } else { + // Read bytes from offset beyond the image index. + bool is_read = read_at(uncompressed_data, uncompressed_size, _index_size + offset); + assert(is_read && "error reading from image or short read"); + } +} + +// Return the ImageModuleData for this image +ImageModuleData * ImageFileReader::get_image_module_data() { + return module_data; +} diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/imageFile.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/imageFile.hpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,648 @@ +/* + * Copyright (c) 2014, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef LIBJIMAGE_IMAGEFILE_HPP +#define LIBJIMAGE_IMAGEFILE_HPP + +#include + +#include "endian.hpp" +#include "inttypes.hpp" + +// Image files are an alternate file format for storing classes and resources. The +// goal is to supply file access which is faster and smaller than the jar format. +// It should be noted that unlike jars, information stored in an image is in native +// endian format. This allows the image to be mapped into memory without endian +// translation. This also means that images are platform dependent. +// +// Image files are structured as three sections; +// +// +-----------+ +// | Header | +// +-----------+ +// | | +// | Index | +// | | +// +-----------+ +// | | +// | | +// | Resources | +// | | +// | | +// +-----------+ +// +// The header contains information related to identification and description of +// contents. +// +// +-------------------------+ +// | Magic (0xCAFEDADA) | +// +------------+------------+ +// | Major Vers | Minor Vers | +// +------------+------------+ +// | Flags | +// +-------------------------+ +// | Resource Count | +// +-------------------------+ +// | Table Length | +// +-------------------------+ +// | Attributes Size | +// +-------------------------+ +// | Strings Size | +// +-------------------------+ +// +// Magic - means of identifying validity of the file. This avoids requiring a +// special file extension. +// Major vers, minor vers - differences in version numbers indicate structural +// changes in the image. +// Flags - various image wide flags (future). +// Resource count - number of resources in the file. +// Table length - the length of lookup tables used in the index. +// Attributes size - number of bytes in the region used to store location attribute +// streams. +// Strings size - the size of the region used to store strings used by the +// index and meta data. +// +// The index contains information related to resource lookup. The algorithm +// used for lookup is "A Practical Minimal Perfect Hashing Method" +// (http://homepages.dcc.ufmg.br/~nivio/papers/wea05.pdf). Given a path string +// in the form ///. return the resource location +// information; +// +// redirectIndex = hash(path, DEFAULT_SEED) % table_length; +// redirect = redirectTable[redirectIndex]; +// if (redirect == 0) return not found; +// locationIndex = redirect < 0 ? -1 - redirect : hash(path, redirect) % table_length; +// location = locationTable[locationIndex]; +// if (!verify(location, path)) return not found; +// return location; +// +// Note: The hash function takes an initial seed value. A different seed value +// usually returns a different result for strings that would otherwise collide with +// other seeds. The verify function guarantees the found resource location is +// indeed the resource we are looking for. +// +// The following is the format of the index; +// +// +-------------------+ +// | Redirect Table | +// +-------------------+ +// | Attribute Offsets | +// +-------------------+ +// | Attribute Data | +// +-------------------+ +// | Strings | +// +-------------------+ +// +// Redirect Table - Array of 32-bit signed values representing actions that +// should take place for hashed strings that map to that +// value. Negative values indicate no hash collision and can be +// quickly converted to indices into attribute offsets. Positive +// values represent a new seed for hashing an index into attribute +// offsets. Zero indicates not found. +// Attribute Offsets - Array of 32-bit unsigned values representing offsets into +// attribute data. Attribute offsets can be iterated to do a +// full survey of resources in the image. Offset of zero +// indicates no attributes. +// Attribute Data - Bytes representing compact attribute data for locations. (See +// comments in ImageLocation.) +// Strings - Collection of zero terminated UTF-8 strings used by the index and +// image meta data. Each string is accessed by offset. Each string is +// unique. Offset zero is reserved for the empty string. +// +// Note that the memory mapped index assumes 32 bit alignment of each component +// in the index. +// +// Endianness of an image. +// An image booted by hotspot is always in native endian. However, it is possible +// to read (by the JDK) in alternate endian format. Primarily, this is during +// cross platform scenarios. Ex, where javac needs to read an embedded image +// to access classes for crossing compilation. +// + +class ImageFileReader; // forward declaration + +// Manage image file string table. +class ImageStrings { +private: + u1* _data; // Data bytes for strings. + u4 _size; // Number of bytes in the string table. +public: + enum { + // Not found result from find routine. + NOT_FOUND = -1, + // Prime used to generate hash for Perfect Hashing. + HASH_MULTIPLIER = 0x01000193 + }; + + ImageStrings(u1* data, u4 size) : _data(data), _size(size) {} + + // Return the UTF-8 string beginning at offset. + inline const char* get(u4 offset) const { + assert(offset < _size && "offset exceeds string table size"); + return (const char*)(_data + offset); + } + + // Compute the Perfect Hashing hash code for the supplied UTF-8 string. + inline static u4 hash_code(const char* string) { + return hash_code(string, HASH_MULTIPLIER); + } + + // Compute the Perfect Hashing hash code for the supplied string, starting at seed. + static s4 hash_code(const char* string, s4 seed); + + // Match up a string in a perfect hash table. Result still needs validation + // for precise match. + static s4 find(Endian* endian, const char* name, s4* redirect, u4 length); + + // Test to see if UTF-8 string begins with the start UTF-8 string. If so, + // return non-NULL address of remaining portion of string. Otherwise, return + // NULL. Used to test sections of a path without copying from image string + // table. + static const char* starts_with(const char* string, const char* start); + + // Test to see if UTF-8 string begins with start char. If so, return non-NULL + // address of remaining portion of string. Otherwise, return NULL. Used + // to test a character of a path without copying. + inline static const char* starts_with(const char* string, const char ch) { + return *string == ch ? string + 1 : NULL; + } +}; + +// Manage image file location attribute data. Within an image, a location's +// attributes are compressed into a stream of bytes. An attribute stream is +// composed of individual attribute sequences. Each attribute sequence begins with +// a header byte containing the attribute 'kind' (upper 5 bits of header) and the +// 'length' less 1 (lower 3 bits of header) of bytes that follow containing the +// attribute value. Attribute values present as most significant byte first. +// +// Ex. Container offset (ATTRIBUTE_OFFSET) 0x33562 would be represented as 0x22 +// (kind = 4, length = 3), 0x03, 0x35, 0x62. +// +// An attribute stream is terminated with a header kind of ATTRIBUTE_END (header +// byte of zero.) +// +// ImageLocation inflates the stream into individual values stored in the long +// array _attributes. This allows an attribute value can be quickly accessed by +// direct indexing. Unspecified values default to zero. +// +// Notes: +// - Even though ATTRIBUTE_END is used to mark the end of the attribute stream, +// streams will contain zero byte values to represent lesser significant bits. +// Thus, detecting a zero byte is not sufficient to detect the end of an attribute +// stream. +// - ATTRIBUTE_OFFSET represents the number of bytes from the beginning of the region +// storing the resources. Thus, in an image this represents the number of bytes +// after the index. +// - Currently, compressed resources are represented by having a non-zero +// ATTRIBUTE_COMPRESSED value. This represents the number of bytes stored in the +// image, and the value of ATTRIBUTE_UNCOMPRESSED represents number of bytes of the +// inflated resource in memory. If the ATTRIBUTE_COMPRESSED is zero then the value +// of ATTRIBUTE_UNCOMPRESSED represents both the number of bytes in the image and +// in memory. In the future, additional compression techniques will be used and +// represented differently. +// - Package strings include trailing slash and extensions include prefix period. +// +class ImageLocation { +public: + enum { + ATTRIBUTE_END, // End of attribute stream marker + ATTRIBUTE_MODULE, // String table offset of module name + ATTRIBUTE_PARENT, // String table offset of resource path parent + ATTRIBUTE_BASE, // String table offset of resource path base + ATTRIBUTE_EXTENSION, // String table offset of resource path extension + ATTRIBUTE_OFFSET, // Container byte offset of resource + ATTRIBUTE_COMPRESSED, // In image byte size of the compressed resource + ATTRIBUTE_UNCOMPRESSED, // In memory byte size of the uncompressed resource + ATTRIBUTE_COUNT // Number of attribute kinds + }; + +private: + // Values of inflated attributes. + u8 _attributes[ATTRIBUTE_COUNT]; + + // Return the attribute value number of bytes. + inline static u1 attribute_length(u1 data) { + return (data & 0x7) + 1; + } + + // Return the attribute kind. + inline static u1 attribute_kind(u1 data) { + u1 kind = data >> 3; + assert(kind < ATTRIBUTE_COUNT && "invalid attribute kind"); + return kind; + } + + // Return the attribute length. + inline static u8 attribute_value(u1* data, u1 n) { + assert(0 < n && n <= 8 && "invalid attribute value length"); + u8 value = 0; + // Most significant bytes first. + for (u1 i = 0; i < n; i++) { + value <<= 8; + value |= data[i]; + } + return value; + } + +public: + ImageLocation() { + clear_data(); + } + + ImageLocation(u1* data) { + clear_data(); + set_data(data); + } + + // Inflates the attribute stream into individual values stored in the long + // array _attributes. This allows an attribute value to be quickly accessed by + // direct indexing. Unspecified values default to zero. + void set_data(u1* data); + + // Zero all attribute values. + void clear_data(); + + // Retrieve an attribute value from the inflated array. + inline u8 get_attribute(u1 kind) const { + assert(ATTRIBUTE_END < kind && kind < ATTRIBUTE_COUNT && "invalid attribute kind"); + return _attributes[kind]; + } + + // Retrieve an attribute string value from the inflated array. + inline const char* get_attribute(u4 kind, const ImageStrings& strings) const { + return strings.get((u4)get_attribute(kind)); + } +}; + +// +// NOTE: needs revision. +// Each loader requires set of module meta data to identify which modules and +// packages are managed by that loader. Currently, there is one image file per +// builtin loader, so only one module meta data resource per file. +// +// Each element in the module meta data is a native endian 4 byte integer. Note +// that entries with zero offsets for string table entries should be ignored ( +// padding for hash table lookup.) +// +// Format: +// Count of package to module entries +// Count of module to package entries +// Perfect Hash redirect table[Count of package to module entries] +// Package to module entries[Count of package to module entries] +// Offset to package name in string table +// Offset to module name in string table +// Perfect Hash redirect table[Count of module to package entries] +// Module to package entries[Count of module to package entries] +// Offset to module name in string table +// Count of packages in module +// Offset to first package in packages table +// Packages[] +// Offset to package name in string table +// +// Manage the image module meta data. +class ImageModuleData { + class Header { + private: + u4 _ptm_count; // Count of package to module entries + u4 _mtp_count; // Count of module to package entries + public: + inline u4 ptm_count(Endian* endian) const { return endian->get(_ptm_count); } + inline u4 mtp_count(Endian* endian) const { return endian->get(_mtp_count); } + }; + + // Hashtable entry + class HashData { + private: + u4 _name_offset; // Name offset in string table + public: + inline s4 name_offset(Endian* endian) const { return endian->get(_name_offset); } + }; + + // Package to module hashtable entry + class PTMData : public HashData { + private: + u4 _module_name_offset; // Module name offset in string table + public: + inline s4 module_name_offset(Endian* endian) const { return endian->get(_module_name_offset); } + }; + + // Module to package hashtable entry + class MTPData : public HashData { + private: + u4 _package_count; // Number of packages in module + u4 _package_offset; // Offset in package list + public: + inline u4 package_count(Endian* endian) const { return endian->get(_package_count); } + inline u4 package_offset(Endian* endian) const { return endian->get(_package_offset); } + }; + + const ImageFileReader* _image_file; // Source image file + Endian* _endian; // Endian handler + ImageStrings _strings; // Image file strings + u1* _data; // Module data resource data + u8 _data_size; // Size of resource data + Header* _header; // Module data header + s4* _ptm_redirect; // Package to module hashtable redirect + PTMData* _ptm_data; // Package to module data + s4* _mtp_redirect; // Module to packages hashtable redirect + MTPData* _mtp_data; // Module to packages data + s4* _mtp_packages; // Package data (name offsets) + + // Return a string from the string table. + inline const char* get_string(u4 offset) { + return _strings.get(offset); + } + + inline u4 mtp_package(u4 index) { + return _endian->get(_mtp_packages[index]); + } + +public: + ImageModuleData(const ImageFileReader* image_file, const char* module_data_name); + ~ImageModuleData(); + + // Return the name of the module data resource. + static void module_data_name(char* buffer, const char* image_file_name); + + // Return the module in which a package resides. Returns NULL if not found. + const char* package_to_module(const char* package_name); + + // Returns all the package names in a module in a NULL terminated array. + // Returns NULL if module not found. + const char** module_to_packages(const char* module_name); +}; + +// Image file header, starting at offset 0. +class ImageHeader { +private: + u4 _magic; // Image file marker + u4 _version; // Image file major version number + u4 _flags; // Image file flags + u4 _resource_count; // Number of resources in file + u4 _table_length; // Number of slots in index tables + u4 _locations_size; // Number of bytes in attribute table + u4 _strings_size; // Number of bytes in string table + +public: + u4 magic() const { return _magic; } + u4 magic(Endian* endian) const { return endian->get(_magic); } + void set_magic(Endian* endian, u4 magic) { return endian->set(_magic, magic); } + + u4 major_version(Endian* endian) const { return endian->get(_version) >> 16; } + u4 minor_version(Endian* endian) const { return endian->get(_version) & 0xFFFF; } + void set_version(Endian* endian, u4 major_version, u4 minor_version) { + return endian->set(_version, major_version << 16 | minor_version); + } + + u4 flags(Endian* endian) const { return endian->get(_flags); } + void set_flags(Endian* endian, u4 value) { return endian->set(_flags, value); } + + u4 resource_count(Endian* endian) const { return endian->get(_resource_count); } + void set_resource_count(Endian* endian, u4 count) { return endian->set(_resource_count, count); } + + u4 table_length(Endian* endian) const { return endian->get(_table_length); } + void set_table_length(Endian* endian, u4 count) { return endian->set(_table_length, count); } + + u4 locations_size(Endian* endian) const { return endian->get(_locations_size); } + void set_locations_size(Endian* endian, u4 size) { return endian->set(_locations_size, size); } + + u4 strings_size(Endian* endian) const { return endian->get(_strings_size); } + void set_strings_size(Endian* endian, u4 size) { return endian->set(_strings_size, size); } +}; + +// Max path length limit independent of platform. Windows max path is 1024, +// other platforms use 4096. The JCK fails several tests when 1024 is used. +#define IMAGE_MAX_PATH 4096 + +class ImageFileReader; + +// Manage a table of open image files. This table allows multiple access points +// to share an open image. +class ImageFileReaderTable { +private: + const static u4 _growth = 8; // Growth rate of the table + u4 _count; // Number of entries in the table + u4 _max; // Maximum number of entries allocated + ImageFileReader** _table; // Growable array of entries + +public: + ImageFileReaderTable(); + ~ImageFileReaderTable(); + + // Return the number of entries. + inline u4 count() { return _count; } + + // Return the ith entry from the table. + inline ImageFileReader* get(u4 i) { return _table[i]; } + + // Add a new image entry to the table. + void add(ImageFileReader* image); + + // Remove an image entry from the table. + void remove(ImageFileReader* image); + + // Determine if image entry is in table. + bool contains(ImageFileReader* image); +}; + +// Manage the image file. +// ImageFileReader manages the content of an image file. +// Initially, the header of the image file is read for validation. If valid, +// values in the header are used calculate the size of the image index. The +// index is then memory mapped to allow load on demand and sharing. The +// -XX:+MemoryMapImage flag determines if the entire file is loaded (server use.) +// An image can be used by Hotspot and multiple reference points in the JDK, thus +// it is desirable to share a reader. To accomodate sharing, a share table is +// defined (see ImageFileReaderTable in imageFile.cpp) To track the number of +// uses, ImageFileReader keeps a use count (_use). Use is incremented when +// 'opened' by reference point and decremented when 'closed'. Use of zero +// leads the ImageFileReader to be actually closed and discarded. +class ImageFileReader { +private: + // Manage a number of image files such that an image can be shared across + // multiple uses (ex. loader.) + static ImageFileReaderTable _reader_table; + + char* _name; // Name of image + s4 _use; // Use count + int _fd; // File descriptor + Endian* _endian; // Endian handler + u8 _file_size; // File size in bytes + ImageHeader _header; // Image header + size_t _index_size; // Total size of index + u1* _index_data; // Raw index data + s4* _redirect_table; // Perfect hash redirect table + u4* _offsets_table; // Location offset table + u1* _location_bytes; // Location attributes + u1* _string_bytes; // String table + ImageModuleData *module_data; // The ImageModuleData for this image + + ImageFileReader(const char* name, bool big_endian); + ~ImageFileReader(); + + // Compute number of bytes in image file index. + inline size_t index_size() { + return sizeof(ImageHeader) + + table_length() * sizeof(u4) * 2 + locations_size() + strings_size(); + } + +public: + enum { + // Image file marker. + IMAGE_MAGIC = 0xCAFEDADA, + // Endian inverted Image file marker. + IMAGE_MAGIC_INVERT = 0xDADAFECA, + // Image file major version number. + MAJOR_VERSION = 1, + // Image file minor version number. + MINOR_VERSION = 0 + }; + + // Open an image file, reuse structure if file already open. + static ImageFileReader* open(const char* name, bool big_endian = Endian::is_big_endian()); + + // Close an image file if the file is not in use elsewhere. + static void close(ImageFileReader *reader); + + // Return an id for the specifed ImageFileReader. + static u8 readerToID(ImageFileReader *reader); + + // Validate the image id. + static bool idCheck(u8 id); + + // Return an id for the specifed ImageFileReader. + static ImageFileReader* idToReader(u8 id); + + // Open image file for read access. + bool open(); + + // Close image file. + void close(); + + // Read directly from the file. + bool read_at(u1* data, u8 size, u8 offset) const; + + inline Endian* endian() const { return _endian; } + + // Retrieve name of image file. + inline const char* name() const { + return _name; + } + + // Retrieve size of image file. + inline u8 file_size() const { + return _file_size; + } + + // Return first address of index data. + inline u1* get_index_address() const { + return _index_data; + } + + // Return first address of resource data. + inline u1* get_data_address() const { + return _index_data + _index_size; + } + + // Get the size of the index data. + size_t get_index_size() const { + return _index_size; + } + + inline u4 table_length() const { + return _header.table_length(_endian); + } + + inline u4 locations_size() const { + return _header.locations_size(_endian); + } + + inline u4 strings_size()const { + return _header.strings_size(_endian); + } + + inline u4* offsets_table() const { + return _offsets_table; + } + + // Increment use count. + inline void inc_use() { + _use++; + } + + // Decrement use count. + inline bool dec_use() { + return --_use == 0; + } + + // Return a string table accessor. + inline const ImageStrings get_strings() const { + return ImageStrings(_string_bytes, _header.strings_size(_endian)); + } + + // Return location attribute stream at offset. + inline u1* get_location_offset_data(u4 offset) const { + assert((u4)offset < _header.locations_size(_endian) && + "offset exceeds location attributes size"); + return offset != 0 ? _location_bytes + offset : NULL; + } + + // Return location attribute stream for location i. + inline u1* get_location_data(u4 index) const { + return get_location_offset_data(get_location_offset(index)); + } + + // Return the location offset for index. + inline u4 get_location_offset(u4 index) const { + assert((u4)index < _header.table_length(_endian) && + "index exceeds location count"); + return _endian->get(_offsets_table[index]); + } + + // Find the location attributes associated with the path. Returns true if + // the location is found, false otherwise. + bool find_location(const char* path, ImageLocation& location) const; + + // Find the location index and size associated with the path. + // Returns the location index and size if the location is found, + // ImageFileReader::NOT_FOUND otherwise. + u4 find_location_index(const char* path, u8 *size) const; + + // Assemble the location path. + void location_path(ImageLocation& location, char* path, size_t max) const; + + // Verify that a found location matches the supplied path. + bool verify_location(ImageLocation& location, const char* path) const; + + // Return the resource for the supplied location index. + void get_resource(u4 index, u1* uncompressed_data) const; + + // Return the resource for the supplied path. + void get_resource(ImageLocation& location, u1* uncompressed_data) const; + + // Return the ImageModuleData for this image + ImageModuleData * get_image_module_data(); + +}; +#endif // LIBJIMAGE_IMAGEFILE_HPP diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/inttypes.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/inttypes.hpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,43 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef LIBJIMAGE_INTTYPES_HPP +#define LIBJIMAGE_INTTYPES_HPP + +typedef unsigned char u1; +typedef char s1; +typedef unsigned short u2; +typedef short s2; +typedef unsigned int u4; +typedef int s4; +#ifdef LP64 +typedef unsigned long u8; +typedef long s8; +#else +typedef unsigned long long u8; +typedef long long s8; +#endif + +#endif // LIBJIMAGE_INTTYPES_HPP + diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/jimage.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/jimage.cpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,194 @@ +/* + * Copyright (c) 2014, 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include + +#include "jimage.hpp" + +#include "imageFile.hpp" + +#define BOOT_VERSION "9.0" + +/* + * JImageOpen - Given the supplied full path file name, open an image file. This + * function will also initialize tables and retrieve meta-data necessary to + * satisfy other functions in the API. If the image file has been previously + * open, a new open request will share memory and resources used by the previous + * open. A call to JImageOpen should be balanced by a call to JImageClose, to + * release memory and resources used. If the image file is not found or cannot + * be open, then NULL is returned and error will contain a reason for the + * failure; a positive value for a system error number, negative for a jimage + * specific error (see JImage Error Codes.) + * + * Ex. + * jint error; + * JImageFile* jimage = (*JImageOpen)(JAVA_HOME "lib/modules/bootmodules.jimage", &error); + * if (image == NULL) { + * tty->print_cr("JImage failed to open: %d", error); + * ... + * } + * ... + */ +extern "C" JImageFile* JIMAGE_Open(const char *name, jint* error) { + // TODO - return a meaningful error code + *error = 0; + ImageFileReader* jfile = ImageFileReader::open(name); + return (JImageFile*) jfile; +} + +/* + * JImageClose - Given the supplied open image file (see JImageOpen), release + * memory and resources used by the open file and close the file. If the image + * file is shared by other uses, release and close is deferred until the last use + * is also closed. + * + * Ex. + * (*JImageClose)(image); + */ +extern "C" void JIMAGE_Close(JImageFile* image) { + ImageFileReader::close((ImageFileReader*) image); +} + +/* + * JImagePackageToModule - Given an open image file (see JImageOpen) and the name + * of a package, return the name of module where the package resides. If the + * package does not exist in the image file, the function returns NULL. + * The resulting string does/should not have to be released. All strings are + * utf-8, zero byte terminated. + * + * Ex. + * const char* package = (*JImagePackageToModule)(image, "java/lang"); + * tty->print_cr(package); + * —> java.base + */ +extern "C" const char* JIMAGE_PackageToModule(JImageFile* image, const char* package_name) { + return ((ImageFileReader*) image)->get_image_module_data()->package_to_module(package_name); +} + +/* + * JImageFindResource - Given an open image file (see JImageOpen), a module + * name, a version string and the name of a class/resource, return location + * information describing the resource and its size. If no resource is found, the + * function returns JIMAGE_NOT_FOUND and the value of size is undefined. + * The version number should be "9.0" and is not used in locating the resource. + * The resulting location does/should not have to be released. + * All strings are utf-8, zero byte terminated. + * + * Ex. + * jlong size; + * JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size); + */ +extern "C" JImageLocationRef JIMAGE_FindResource(JImageFile* image, + const char* module_name, const char* version, const char* name, + jlong* size) { + if (strcmp(version, BOOT_VERSION) != 0) { + return (JImageLocationRef) 0; + } + + ImageLocation location; + char fullpath[IMAGE_MAX_PATH]; + + // Concatenate to get full path + strncpy(fullpath, "/", IMAGE_MAX_PATH - 1); + strncat(fullpath, module_name, IMAGE_MAX_PATH - 1); + strncat(fullpath, "/", IMAGE_MAX_PATH - 1); + strncat(fullpath, name, IMAGE_MAX_PATH - 1); + JImageLocationRef loc = + (JImageLocationRef) ((ImageFileReader*) image)->find_location_index(fullpath, (u8*) size); + return loc; +} + +/* + * JImageGetResource - Given an open image file (see JImageOpen), a resource’s + * location information (see JImageFindResource), a buffer of appropriate + * size and the size, retrieve the bytes associated with the + * resource. If the size is less than the resource size then the read is truncated. + * If the size is greater than the resource size then the remainder of the buffer + * is zero filled. The function will return the actual size of the resource. + * + * Ex. + * jlong size; + * JImageLocationRef* location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size); + * char* buffer = new char[size]; + * (*JImageGetResource)(image, location, buffer, size); + */ +extern "C" jlong JIMAGE_GetResource(JImageFile* image, JImageLocationRef location, + char* buffer, jlong size) { + ((ImageFileReader*) image)->get_resource((u4) location, (u1*) buffer); + return size; +} + +/* + * JImageResourceIterator - Given an open image file (see JImageOpen), a visitor + * function and a visitor argument, iterator through each of the image's resources. + * The visitor function is called with the image file, the module name, the + * package name, the base name, the extension and the visitor argument. The return + * value of the visitor function should be true, unless an early iteration exit is + * required. All strings are utf-8, zero byte terminated.file. + * + * Ex. + * bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, const char* name, const char* extension, void* arg) { + * if (strcmp(extension, “class”) == 0) { + * char path[JIMAGE_MAX_PATH]; + * Thread* THREAD = Thread::current(); + * jio_snprintf(path, JIMAGE_MAX_PATH - 1, "/%s/%s", package, name); + * ClassLoader::compile_the_world_in(path, (Handle)arg, THREAD); + * return !HAS_PENDING_EXCEPTION; + * } + * return true; + * } + * (*JImageResourceIterator)(image, ctw_visitor, loader); + */ +extern "C" void JIMAGE_ResourceIterator(JImageFile* image, + JImageResourceVisitor_t visitor, void* arg) { + ImageFileReader* imageFile = (ImageFileReader*) image; + u4 nEntries = imageFile->table_length(); + const ImageStrings strings = imageFile->get_strings(); + for (u4 i = 0; i < nEntries; i++) { + ImageLocation location(imageFile->get_location_data(i)); + + u4 moduleOffset = (u4) location.get_attribute(ImageLocation::ATTRIBUTE_MODULE); + if (moduleOffset == 0) { + continue; // skip non-modules + } + const char *module = strings.get(moduleOffset); + if (strcmp(module, "modules") == 0 + || strcmp(module, "packages") == 0) { + continue; // always skip + } + + u4 parentOffset = (u4) location.get_attribute(ImageLocation::ATTRIBUTE_PARENT); + const char *parent = strings.get(parentOffset); + u4 baseOffset = (u4) location.get_attribute(ImageLocation::ATTRIBUTE_BASE); + const char *base = strings.get(baseOffset); + u4 extOffset = (u4) location.get_attribute(ImageLocation::ATTRIBUTE_EXTENSION); + const char *extension = strings.get(extOffset); + + if (!(*visitor)(image, module, "9", parent, base, extension, arg)) { + break; + } + + } +} + diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/jimage.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/jimage.hpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,176 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include "jni.h" + +// Opaque reference to a JImage file. +class JImageFile; +// Opaque reference to an image file resource location. +typedef jlong JImageLocationRef; + +// Max path length limit independent of platform. Windows max path is 1024, +// other platforms use 4096. The JCK fails several tests when 1024 is used. +#define JIMAGE_MAX_PATH 4096 + +// JImage Error Codes + +// The image file is not prefixed with 0xCAFEDADA +#define JIMAGE_BAD_MAGIC (-1) +// The image file does not have a compatible (translatable) version +#define JIMAGE_BAD_VERSION (-2) +// The image file content is malformed +#define JIMAGE_CORRUPTED (-3) + +/* + * JImageOpen - Given the supplied full path file name, open an image file. This + * function will also initialize tables and retrieve meta-data necessary to + * satisfy other functions in the API. If the image file has been previously + * open, a new open request will share memory and resources used by the previous + * open. A call to JImageOpen should be balanced by a call to JImageClose, to + * release memory and resources used. If the image file is not found or cannot + * be open, then NULL is returned and error will contain a reason for the + * failure; a positive value for a system error number, negative for a jimage + * specific error (see JImage Error Codes.) + * + * Ex. + * jint error; + * JImageFile* jimage = (*JImageOpen)(JAVA_HOME "lib/modules/bootmodules.jimage", &error); + * if (image == NULL) { + * tty->print_cr("JImage failed to open: %d", error); + * ... + * } + * ... + */ + +extern "C" JImageFile* JIMAGE_Open(const char *name, jint* error); + +typedef JImageFile* (*JImageOpen_t)(const char *name, jint* error); + +/* + * JImageClose - Given the supplied open image file (see JImageOpen), release + * memory and resources used by the open file and close the file. If the image + * file is shared by other uses, release and close is deferred until the last use + * is also closed. + * + * Ex. + * (*JImageClose)(image); + */ + +extern "C" void JIMAGE_Close(JImageFile* jimage); + +typedef void (*JImageClose_t)(JImageFile* jimage); + + +/* + * JImagePackageToModule - Given an open image file (see JImageOpen) and the name + * of a package, return the name of module where the package resides. If the + * package does not exist in the image file, the function returns NULL. + * The resulting string does/should not have to be released. All strings are + * utf-8, zero byte terminated. + * + * Ex. + * const char* package = (*JImagePackageToModule)(image, "java/lang"); + * tty->print_cr(package); + * —> java.base + */ + +extern "C" const char * JIMAGE_PackageToModule(JImageFile* jimage, const char* package_name); + +typedef const char* (*JImagePackageToModule_t)(JImageFile* jimage, const char* package_name); + + +/* + * JImageFindResource - Given an open image file (see JImageOpen), a module + * name, a version string and the name of a class/resource, return location + * information describing the resource and its size. If no resource is found, the + * function returns JIMAGE_NOT_FOUND and the value of size is undefined. + * The version number should be "9.0" and is not used in locating the resource. + * The resulting location does/should not have to be released. + * All strings are utf-8, zero byte terminated. + * + * Ex. + * jlong size; + * JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size); + */ +extern "C" JImageLocationRef JIMAGE_FindResource(JImageFile* jimage, + const char* module_name, const char* version, const char* name, + jlong* size); + +typedef JImageLocationRef(*JImageFindResource_t)(JImageFile* jimage, + const char* module_name, const char* version, const char* name, + jlong* size); + + +/* + * JImageGetResource - Given an open image file (see JImageOpen), a resource’s + * location information (see JImageFindResource), a buffer of appropriate + * size and the size, retrieve the bytes associated with the + * resource. If the size is less than the resource size then the read is truncated. + * If the size is greater than the resource size then the remainder of the buffer + * is zero filled. The function will return the actual size of the resource. + * + * Ex. + * jlong size; + * JImageLocationRef location = (*JImageFindResource)(image, "java.base", "9.0", "java/lang/String.class", &size); + * char* buffer = new char[size]; + * (*JImageGetResource)(image, location, buffer, size); + */ +extern "C" jlong JIMAGE_GetResource(JImageFile* jimage, JImageLocationRef location, + char* buffer, jlong size); + +typedef jlong(*JImageGetResource_t)(JImageFile* jimage, JImageLocationRef location, + char* buffer, jlong size); + + +/* + * JImageResourceIterator - Given an open image file (see JImageOpen), a visitor + * function and a visitor argument, iterator through each of the image's resources. + * The visitor function is called with the image file, the module name, the + * package name, the base name, the extension and the visitor argument. The return + * value of the visitor function should be true, unless an early iteration exit is + * required. All strings are utf-8, zero byte terminated.file. + * + * Ex. + * bool ctw_visitor(JImageFile* jimage, const char* module_name, const char* version, const char* package, const char* name, const char* extension, void* arg) { + * if (strcmp(extension, “class”) == 0) { + * char path[JIMAGE_MAX_PATH]; + * Thread* THREAD = Thread::current(); + * jio_snprintf(path, JIMAGE_MAX_PATH - 1, "/%s/%s", package, name); + * ClassLoader::compile_the_world_in(path, (Handle)arg, THREAD); + * return !HAS_PENDING_EXCEPTION; + * } + * return true; + * } + * (*JImageResourceIterator)(image, ctw_visitor, loader); + */ + +typedef bool (*JImageResourceVisitor_t)(JImageFile* jimage, + const char* module_name, const char* version, const char* package, + const char* name, const char* extension, void* arg); + +extern "C" void JIMAGE_ResourceIterator(JImageFile* jimage, + JImageResourceVisitor_t visitor, void *arg); + +typedef void (*JImageResourceIterator_t)(JImageFile* jimage, + JImageResourceVisitor_t visitor, void* arg); diff -r 7869179af058 -r 38169ef6e325 src/java.base/share/native/libjimage/osSupport.hpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/share/native/libjimage/osSupport.hpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,109 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#ifndef LIBJIMAGE_OSSUPPORT_HPP +#define LIBJIMAGE_OSSUPPORT_HPP + +#ifdef WIN32 +#include +#else +#include +#endif + +class osSupport { +public: + /** + * Open a regular file read-only. + * Return the file descriptor. + */ + static jint openReadOnly(const char *path); + + /** + * Close a file descriptor. + */ + static jint close(jint fd); + + /** + * Return the size of a regular file. + */ + static jlong size(const char *path); + + /** + * Read nBytes at offset into a buffer. + */ + static jlong read(jint fd, char *buf, jlong nBytes, jlong offset); + + /** + * Map nBytes at offset into memory and return the address. + * The system chooses the address. + */ + static void* map_memory(jint fd, const char *filename, size_t file_offset, size_t bytes); + + /** + * Unmap nBytes of memory at address. + */ + static int unmap_memory(void* addr, size_t bytes); +}; + +/** + * A CriticalSection to protect a small section of code. + */ +class SimpleCriticalSection { + friend class SimpleCriticalSectionLock; +private: + void enter(); + void exit(); +public: + SimpleCriticalSection(); + //~SimpleCriticalSection(); // Cretes a dependency on Solaris on a C++ exit registration + +private: +#ifdef WIN32 + CRITICAL_SECTION critical_section; +#else + pthread_mutex_t mutex; +#endif // WIN32 +}; + +/** + * SimpleCriticalSectionLock instance. + * The constructor locks a SimpleCriticalSection and the + * destructor does the unlock. + */ +class SimpleCriticalSectionLock { +private: + SimpleCriticalSection *lock; +public: + + SimpleCriticalSectionLock(SimpleCriticalSection *cslock) { + this->lock = cslock; + lock->enter(); + } + + ~SimpleCriticalSectionLock() { + lock->exit(); + } +}; + +#endif // LIBJIMAGE_OSSUPPORT_HPP diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/classes/java/lang/ProcessEnvironment.java --- a/src/java.base/unix/classes/java/lang/ProcessEnvironment.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/classes/java/lang/ProcessEnvironment.java Fri Sep 18 09:18:17 2015 -0700 @@ -124,7 +124,7 @@ // A class hiding the byteArray-String duality of // text data on Unixoid operating systems. - private static abstract class ExternalData { + private abstract static class ExternalData { protected final String str; protected final byte[] bytes; diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java --- a/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -135,5 +135,5 @@ /** * Perform class load-time initializations. */ - private native static void init(); + private static native void init(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/classes/sun/net/NetHooks.java --- a/src/java.base/unix/classes/sun/net/NetHooks.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/classes/sun/net/NetHooks.java Fri Sep 18 09:18:17 2015 -0700 @@ -45,7 +45,7 @@ *

Concrete implementations of this class should define a zero-argument * constructor and implement the abstract methods specified below. */ - public static abstract class Provider { + public abstract static class Provider { /** * Initializes a new instance of this class. */ diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/classes/sun/net/PortConfig.java --- a/src/java.base/unix/classes/sun/net/PortConfig.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/classes/sun/net/PortConfig.java Fri Sep 18 09:18:17 2015 -0700 @@ -36,7 +36,7 @@ public final class PortConfig { private static int defaultUpper, defaultLower; - private final static int upper, lower; + private static final int upper, lower; private PortConfig() {} diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java --- a/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -43,7 +43,7 @@ extends AsynchronousServerSocketChannelImpl implements Port.PollableChannel { - private final static NativeDispatcher nd = new SocketDispatcher(); + private static final NativeDispatcher nd = new SocketDispatcher(); private final Port port; private final int fdVal; diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java --- a/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -42,7 +42,7 @@ class UnixAsynchronousSocketChannelImpl extends AsynchronousSocketChannelImpl implements Port.PollableChannel { - private final static NativeDispatcher nd = new SocketDispatcher(); + private static final NativeDispatcher nd = new SocketDispatcher(); private static enum OpType { CONNECT, READ, WRITE }; private static final boolean disableSynchronousRead; diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java --- a/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java Fri Sep 18 09:18:17 2015 -0700 @@ -242,7 +242,7 @@ private static final long L_PATH = L_PCHAR | lowMask(";/"); private static final long H_PATH = H_PCHAR | highMask(";/"); - private final static char[] hexDigits = { + private static final char[] hexDigits = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' }; diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/classes/sun/security/provider/NativePRNG.java --- a/src/java.base/unix/classes/sun/security/provider/NativePRNG.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/classes/sun/security/provider/NativePRNG.java Fri Sep 18 09:18:17 2015 -0700 @@ -331,10 +331,10 @@ // we buffer data we read from the "next" file for efficiency, // but we limit the lifetime to avoid using stale bits // lifetime in ms, currently 100 ms (0.1 s) - private final static long MAX_BUFFER_TIME = 100; + private static final long MAX_BUFFER_TIME = 100; // size of the "next" buffer - private final static int BUFFER_SIZE = 32; + private static final int BUFFER_SIZE = 32; // Holder for the seedFile. Used if we ever add seed material. File seedFile; diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/native/libjava/java_props_md.c --- a/src/java.base/unix/native/libjava/java_props_md.c Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/native/libjava/java_props_md.c Fri Sep 18 09:18:17 2015 -0700 @@ -91,46 +91,6 @@ return 0; } -/* This function sets an environment variable using envstring. - * The format of envstring is "name=value". - * If the name has already existed, it will append value to the name. - */ -static void -setPathEnvironment(char *envstring) -{ - char name[20], *value, *current; - - value = strchr(envstring, '='); /* locate name and value separator */ - - if (! value) - return; /* not a valid environment setting */ - - /* copy first part as environment name */ - strncpy(name, envstring, value - envstring); - name[value-envstring] = '\0'; - - value++; /* set value point to value of the envstring */ - - current = getenv(name); - if (current) { - if (! strstr(current, value)) { - /* value is not found in current environment, append it */ - char *temp = malloc(strlen(envstring) + strlen(current) + 2); - strcpy(temp, name); - strcat(temp, "="); - strcat(temp, current); - strcat(temp, ":"); - strcat(temp, value); - putenv(temp); - } - /* else the value has already been set, do nothing */ - } - else { - /* environment variable is not found */ - putenv(envstring); - } -} - #ifndef P_tmpdir #define P_tmpdir "/var/tmp" #endif @@ -628,16 +588,6 @@ sprops.path_separator = ":"; sprops.line_separator = "\n"; -#if !defined(_ALLBSD_SOURCE) - /* Append CDE message and resource search path to NLSPATH and - * XFILESEARCHPATH, in order to pick localized message for - * FileSelectionDialog window (Bug 4173641). - */ - setPathEnvironment("NLSPATH=/usr/dt/lib/nls/msg/%L/%N.cat"); - setPathEnvironment("XFILESEARCHPATH=/usr/dt/app-defaults/%L/Dt"); -#endif - - #ifdef MACOSX setProxyProperties(&sprops); #endif diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/native/libjimage/osSupport_unix.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/unix/native/libjimage/osSupport_unix.cpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,111 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + + +#include +#include +#include +#include +#include +#include + +#include "jni.h" +#include "osSupport.hpp" + +/** + * Open a regular file read-only. + * Return the file descriptor. + */ +jint osSupport::openReadOnly(const char *path) { + return ::open(path, 0); +} + +/** + * Close a file descriptor. + */ +jint osSupport::close(jint fd) { + return ::close(fd); +} + +/** + * Return the size of a regular file. + */ +jlong osSupport::size(const char *path) { + struct stat statbuf; + if (stat(path, &statbuf) < 0 || + (statbuf.st_mode & S_IFREG) != S_IFREG) { + return -1; + } + return (jsize) statbuf.st_size; +} + +/** + * Read nBytes at offset into a buffer. + */ +jlong osSupport::read(jint fd, char *buf, jlong nBytes, jlong offset) { + return ::pread(fd, buf, nBytes, offset); +} + +/** + * Map nBytes at offset into memory and return the address. + * The system chooses the address. + */ +void* osSupport::map_memory(int fd, const char *filename, size_t file_offset, size_t bytes) { + void* mapped_address = NULL; + mapped_address = (void*) mmap(NULL, + bytes, PROT_READ, MAP_SHARED, + fd, file_offset); + if (mapped_address == MAP_FAILED) { + return NULL; + } + return mapped_address; +} + +/** + * Unmap nBytes of memory at address. + */ +int osSupport::unmap_memory(void *addr, size_t bytes) { + return munmap((char *) addr, bytes) == 0; +} + +/** + * A CriticalSection to protect a small section of code. + */ +void SimpleCriticalSection::enter() { + pthread_mutex_lock(&mutex); +} + +void SimpleCriticalSection::exit() { + pthread_mutex_unlock(&mutex); + +} + +SimpleCriticalSection::SimpleCriticalSection() { + pthread_mutex_init(&mutex, NULL); +} + +//SimpleCriticalSection::~SimpleCriticalSection() { +// pthread_mutex_destroy(&mutex); +//} + diff -r 7869179af058 -r 38169ef6e325 src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c --- a/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Fri Sep 18 09:18:17 2015 -0700 @@ -955,17 +955,23 @@ (char *)&arg, sizeof(arg)) < 0) { JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", strerror(errno)); + close(fd); return; } if (setsockopt(fd, SOL_SOCKET, SO_RCVBUF, (char *)&arg, sizeof(arg)) < 0) { JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", strerror(errno)); + close(fd); return; } #endif /* __APPLE__ */ - setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char*) &t, sizeof(int)); + if (setsockopt(fd, SOL_SOCKET, SO_BROADCAST, (char*) &t, sizeof (int)) < 0) { + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", strerror(errno)); + close(fd); + return; + } #if defined(__linux__) arg = 0; @@ -986,8 +992,12 @@ */ if (domain == AF_INET6) { int ttl = 1; - setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *)&ttl, - sizeof(ttl)); + if (setsockopt(fd, IPPROTO_IPV6, IPV6_MULTICAST_HOPS, (char *) &ttl, + sizeof (ttl)) < 0) { + JNU_ThrowByName(env, JNU_JAVANETPKG "SocketException", strerror(errno)); + close(fd); + return; + } } #endif /* __linux__ */ diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java --- a/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java Fri Sep 18 09:18:17 2015 -0700 @@ -45,7 +45,7 @@ class DefaultDatagramSocketImplFactory { - private final static Class prefixImplClass; + private static final Class prefixImplClass; /* the windows version. */ private static float version; @@ -54,13 +54,13 @@ private static boolean preferIPv4Stack = false; /* If the version supports a dual stack TCP implementation */ - private final static boolean useDualStackImpl; + private static final boolean useDualStackImpl; /* sun.net.useExclusiveBind */ private static String exclBindProp; /* True if exclusive binding is on for Windows */ - private final static boolean exclusiveBind; + private static final boolean exclusiveBind; static { Class prefixImplClassLocal = null; diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java --- a/src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -212,5 +212,5 @@ /** * Perform class load-time initializations. */ - private native static void init(); + private static native void init(); } diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/classes/sun/net/PortConfig.java --- a/src/java.base/windows/classes/sun/net/PortConfig.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/windows/classes/sun/net/PortConfig.java Fri Sep 18 09:18:17 2015 -0700 @@ -36,7 +36,7 @@ public final class PortConfig { private static int defaultUpper, defaultLower; - private final static int upper, lower; + private static final int upper, lower; static { AccessController.doPrivileged( diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java --- a/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java Fri Sep 18 09:18:17 2015 -0700 @@ -87,7 +87,7 @@ return status.sequenceComplete; } - private native static void initFirst (Class clazz); + private static native void initFirst (Class clazz); private native long getCredentialsHandle (String user, String domain, String password); diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/classes/sun/nio/ch/WindowsSelectorImpl.java --- a/src/java.base/windows/classes/sun/nio/ch/WindowsSelectorImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/windows/classes/sun/nio/ch/WindowsSelectorImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -54,7 +54,7 @@ private final int INIT_CAP = 8; // Maximum number of sockets for select(). // Should be INIT_CAP times a power of 2 - private final static int MAX_SELECTABLE_FDS = 1024; + private static final int MAX_SELECTABLE_FDS = 1024; // The list of SelectableChannels serviced by this Selector. Every mod // MAX_SELECTABLE_FDS entry is bogus, to align this array with the poll @@ -85,7 +85,7 @@ private Object closeLock = new Object(); // Maps file descriptors to their indices in pollArray - private final static class FdMap extends HashMap { + private static final class FdMap extends HashMap { static final long serialVersionUID = 0L; private MapEntry get(int desc) { return get(new Integer(desc)); @@ -103,7 +103,7 @@ } // class for fdMap entries - private final static class MapEntry { + private static final class MapEntry { SelectionKeyImpl ski; long updateCount = 0; long clearedCount = 0; diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/classes/sun/nio/fs/WindowsConstants.java --- a/src/java.base/windows/classes/sun/nio/fs/WindowsConstants.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/windows/classes/sun/nio/fs/WindowsConstants.java Fri Sep 18 09:18:17 2015 -0700 @@ -119,11 +119,11 @@ public static final int FILE_NOTIFY_CHANGE_SECURITY = 0x00000100; // notify actions - public final static int FILE_ACTION_ADDED = 0x00000001; - public final static int FILE_ACTION_REMOVED = 0x00000002; - public final static int FILE_ACTION_MODIFIED = 0x00000003; - public final static int FILE_ACTION_RENAMED_OLD_NAME = 0x00000004; - public final static int FILE_ACTION_RENAMED_NEW_NAME = 0x00000005; + public static final int FILE_ACTION_ADDED = 0x00000001; + public static final int FILE_ACTION_REMOVED = 0x00000002; + public static final int FILE_ACTION_MODIFIED = 0x00000003; + public static final int FILE_ACTION_RENAMED_OLD_NAME = 0x00000004; + public static final int FILE_ACTION_RENAMED_NEW_NAME = 0x00000005; // copy flags public static final int COPY_FILE_FAIL_IF_EXISTS = 0x00000001; diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java --- a/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java Fri Sep 18 09:18:17 2015 -0700 @@ -48,7 +48,7 @@ class WindowsWatchService extends AbstractWatchService { - private final static int WAKEUP_COMPLETION_KEY = 0; + private static final int WAKEUP_COMPLETION_KEY = 0; // background thread to service I/O completion port private final Poller poller; @@ -242,7 +242,7 @@ * Background thread to service I/O completion port. */ private static class Poller extends AbstractPoller { - private final static Unsafe UNSAFE = Unsafe.getUnsafe(); + private static final Unsafe UNSAFE = Unsafe.getUnsafe(); /* * typedef struct _OVERLAPPED { diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java --- a/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -128,7 +128,7 @@ } supportedLocaleSet = Collections.unmodifiableSet(tmpSet); } - private final static Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]); + private static final Locale[] supportedLocale = supportedLocaleSet.toArray(new Locale[0]); public static DateFormatProvider getDateFormatProvider() { return new DateFormatProvider() { diff -r 7869179af058 -r 38169ef6e325 src/java.base/windows/native/libjimage/osSupport_windows.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/java.base/windows/native/libjimage/osSupport_windows.cpp Fri Sep 18 09:18:17 2015 -0700 @@ -0,0 +1,133 @@ +/* + * Copyright (c) 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 + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + * + */ + +#include +#include +#include +#include +#include +#include + +#include "jni.h" +#include "osSupport.hpp" + +/** + * Open a regular file read-only. + * Return the file descriptor. + */ +jint osSupport::openReadOnly(const char *path) { + return ::open(path, 0, 0); +} + +/** + * Close a file descriptor. + */ +jint osSupport::close(jint fd) { + return ::close(fd); +} + +/** + * Return the size of a regular file. + */ +jlong osSupport::size(const char *path) { + struct stat statbuf; + if (stat(path, &statbuf) < 0 || + (statbuf.st_mode & S_IFREG) != S_IFREG) { + return -1; + } + return (jlong) statbuf.st_size; +} + +/** + * Read nBytes at offset into a buffer. + */ +jlong osSupport::read(jint fd, char *buf, jlong nBytes, jlong offset) { + OVERLAPPED ov; + DWORD nread; + BOOL result; + + ZeroMemory(&ov, sizeof (ov)); + ov.Offset = (DWORD) offset; + ov.OffsetHigh = (DWORD) (offset >> 32); + + HANDLE h = (HANDLE)::_get_osfhandle(fd); + + result = ReadFile(h, (LPVOID) buf, (DWORD) nBytes, &nread, &ov); + + return result ? nread : 0; +} + +/** + * Map nBytes at offset into memory and return the address. + * The system chooses the address. + */ +void* osSupport::map_memory(jint fd, const char *file_name, size_t file_offset, size_t bytes) { + HANDLE hFile; + char* base = NULL; + + // Get a handle to the file + hFile = CreateFile(file_name, GENERIC_READ, FILE_SHARE_READ, NULL, + OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile != NULL) { + // Create a file mapping handle + HANDLE hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, + NULL /* file_name */); + if (hMap != NULL) { + // Map the file into the address space at the offset + base = (char*) MapViewOfFileEx(hMap, FILE_MAP_READ, 0, (DWORD) file_offset, + (DWORD) bytes, NULL); + CloseHandle(hMap); // The mapping is no longer needed + } + CloseHandle(hFile); // The file handle is no longer needed + } + return base; +} + +/** + * Unmap nBytes of memory at address. + */ +int osSupport::unmap_memory(void* addr, size_t bytes) { + BOOL result = UnmapViewOfFile(addr); + return result; +} + +/** + * A CriticalSection to protect a small section of code. + */ +void SimpleCriticalSection::enter() { + EnterCriticalSection(&critical_section); +} + +void SimpleCriticalSection::exit() { + LeaveCriticalSection(&critical_section); +} + +SimpleCriticalSection::SimpleCriticalSection() { + InitializeCriticalSection(&critical_section); +} + +//SimpleCriticalSection::~SimpleCriticalSection() { +// DeleteCriticalSection(&critical_section); +//} + diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java --- a/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPHelper.java Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,190 +0,0 @@ -/* - * Copyright (c) 2009, 2012, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jmx.remote.internal; - -import java.util.Properties; -import java.io.IOException; -import java.rmi.Remote; -import java.rmi.NoSuchObjectException; - -import java.security.AccessController; -import java.security.PrivilegedAction; - -/** - * A helper class for RMI-IIOP and CORBA APIs. - */ - -public final class IIOPHelper { - private IIOPHelper() { } - - // loads IIOPProxy implementation class if available - private static final String IMPL_CLASS = - "com.sun.jmx.remote.protocol.iiop.IIOPProxyImpl"; - private static final IIOPProxy proxy = - AccessController.doPrivileged(new PrivilegedAction() { - public IIOPProxy run() { - try { - Class c = Class.forName(IMPL_CLASS, true, - IIOPHelper.class.getClassLoader()); - return (IIOPProxy)c.newInstance(); - } catch (ClassNotFoundException cnf) { - return null; - } catch (InstantiationException e) { - throw new AssertionError(e); - } catch (IllegalAccessException e) { - throw new AssertionError(e); - } - }}); - - /** - * Returns true if RMI-IIOP and CORBA is available. - */ - public static boolean isAvailable() { - return proxy != null; - } - - private static void ensureAvailable() { - if (proxy == null) - throw new AssertionError("Should not here"); - } - - /** - * Returns true if the given object is a Stub. - */ - public static boolean isStub(Object obj) { - return (proxy == null) ? false : proxy.isStub(obj); - } - - /** - * Returns the Delegate to which the given Stub delegates. - */ - public static Object getDelegate(Object stub) { - ensureAvailable(); - return proxy.getDelegate(stub); - } - - /** - * Sets the Delegate for a given Stub. - */ - public static void setDelegate(Object stub, Object delegate) { - ensureAvailable(); - proxy.setDelegate(stub, delegate); - } - - /** - * Returns the ORB associated with the given stub - * - * @throws UnsupportedOperationException - * if the object does not support the operation that - * was invoked - */ - public static Object getOrb(Object stub) { - ensureAvailable(); - return proxy.getOrb(stub); - } - - /** - * Connects the Stub to the given ORB. - */ - public static void connect(Object stub, Object orb) - throws IOException - { - if (proxy == null) - throw new IOException("Connection to ORB failed, RMI/IIOP not available"); - proxy.connect(stub, orb); - } - - /** - * Returns true if the given object is an ORB. - */ - public static boolean isOrb(Object obj) { - return (proxy == null) ? false : proxy.isOrb(obj); - } - - /** - * Creates, and returns, a new ORB instance. - */ - public static Object createOrb(String[] args, Properties props) - throws IOException - { - if (proxy == null) - throw new IOException("ORB initialization failed, RMI/IIOP not available"); - return proxy.createOrb(args, props); - } - - /** - * Converts a string, produced by the object_to_string method, back - * to a CORBA object reference. - */ - public static Object stringToObject(Object orb, String str) { - ensureAvailable(); - return proxy.stringToObject(orb, str); - } - - /** - * Converts the given CORBA object reference to a string. - */ - public static String objectToString(Object orb, Object obj) { - ensureAvailable(); - return proxy.objectToString(orb, obj); - } - - /** - * Checks to ensure that an object of a remote or abstract interface - * type can be cast to a desired type. - */ - public static T narrow(Object narrowFrom, Class narrowTo) { - ensureAvailable(); - return proxy.narrow(narrowFrom, narrowTo); - } - - /** - * Makes a server object ready to receive remote calls - */ - public static void exportObject(Remote obj) throws IOException { - if (proxy == null) - throw new IOException("RMI object cannot be exported, RMI/IIOP not available"); - proxy.exportObject(obj); - } - - /** - * Deregisters a server object from the runtime. - */ - public static void unexportObject(Remote obj) throws IOException { - if (proxy == null) - throw new NoSuchObjectException("Object not exported"); - proxy.unexportObject(obj); - } - - /** - * Returns a stub for the given server object. - */ - public static Remote toStub(Remote obj) throws IOException { - if (proxy == null) - throw new NoSuchObjectException("Object not exported"); - return proxy.toStub(obj); - } -} diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java --- a/src/java.management/share/classes/com/sun/jmx/remote/internal/IIOPProxy.java Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,110 +0,0 @@ -/* - * Copyright (c) 2009, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jmx.remote.internal; - -import java.util.Properties; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; - -/** - * An interface to a subset of the RMI-IIOP and CORBA APIs to avoid a - * static dependencies on the types defined by these APIs. - */ - -public interface IIOPProxy { - - /** - * Returns true if the given object is a Stub. - */ - boolean isStub(Object obj); - - /** - * Returns the Delegate to which the given Stub delegates. - */ - Object getDelegate(Object stub); - - /** - * Sets the Delegate for a given Stub. - */ - void setDelegate(Object stub, Object delegate); - - /** - * Returns the ORB associated with the given stub - * - * @throws UnsupportedOperationException - * if the object does not support the operation that - * was invoked - */ - Object getOrb(Object stub); - - /** - * Connects the Stub to the given ORB. - */ - void connect(Object stub, Object orb) throws RemoteException; - - /** - * Returns true if the given object is an ORB. - */ - boolean isOrb(Object obj); - - /** - * Creates, and returns, a new ORB instance. - */ - Object createOrb(String[] args, Properties props); - - /** - * Converts a string, produced by the object_to_string method, back - * to a CORBA object reference. - */ - Object stringToObject(Object orb, String str); - - /** - * Converts the given CORBA object reference to a string. - */ - String objectToString(Object orb, Object obj); - - /** - * Checks to ensure that an object of a remote or abstract interface - * type can be cast to a desired type. - */ - T narrow(Object narrowFrom, Class narrowTo); - - /** - * Makes a server object ready to receive remote calls - */ - void exportObject(Remote obj) throws RemoteException; - - /** - * Deregisters a server object from the runtime. - */ - void unexportObject(Remote obj) throws NoSuchObjectException; - - /** - * Returns a stub for the given server object. - */ - Remote toStub(Remote obj) throws NoSuchObjectException; -} diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java --- a/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ClientProvider.java Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jmx.remote.protocol.iiop; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Map; - -import javax.management.remote.JMXConnectorProvider; -import javax.management.remote.JMXConnector; -import javax.management.remote.JMXServiceURL; -import javax.management.remote.rmi.RMIConnector; - -public class ClientProvider implements JMXConnectorProvider { - - public JMXConnector newJMXConnector(JMXServiceURL serviceURL, - Map environment) - throws IOException { - if (!serviceURL.getProtocol().equals("iiop")) { - throw new MalformedURLException("Protocol not iiop: " + - serviceURL.getProtocol()); - } - return new RMIConnector(serviceURL, environment); - } -} diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java --- a/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/IIOPProxyImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,157 +0,0 @@ -/* - * Copyright (c) 2009,2013, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jmx.remote.protocol.iiop; - -import org.omg.CORBA.ORB; -import org.omg.CORBA.portable.Delegate; -import javax.rmi.PortableRemoteObject; -import javax.rmi.CORBA.Stub; - -import java.util.Properties; -import java.rmi.Remote; -import java.rmi.RemoteException; -import java.rmi.NoSuchObjectException; - -import com.sun.jmx.remote.internal.IIOPProxy; -import java.io.SerializablePermission; -import java.security.AccessControlContext; -import java.security.AccessController; -import java.security.Permissions; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; -import java.security.ProtectionDomain; - -/** - * An implementation of IIOPProxy that simply delegates to the appropriate - * RMI-IIOP and CORBA APIs. - */ - -public class IIOPProxyImpl implements IIOPProxy { - // special ACC used to initialize the IIOP stub - // the only allowed privilege is SerializablePermission("enableSubclassImplementation") - private static final AccessControlContext STUB_ACC; - - static { - Permissions p = new Permissions(); - p.add(new SerializablePermission("enableSubclassImplementation")); - STUB_ACC = new AccessControlContext( - new ProtectionDomain[]{ - new ProtectionDomain(null, p) - } - ); - } - - public IIOPProxyImpl() { } - - @Override - public boolean isStub(Object obj) { - return (obj instanceof Stub); - } - - @Override - public Object getDelegate(Object stub) { - return ((Stub)stub)._get_delegate(); - } - - @Override - public void setDelegate(Object stub, Object delegate) { - ((Stub)stub)._set_delegate((Delegate)delegate); - } - - @Override - public Object getOrb(Object stub) { - try { - return ((Stub)stub)._orb(); - } catch (org.omg.CORBA.BAD_OPERATION x) { - throw new UnsupportedOperationException(x); - } - } - - @Override - public void connect(Object stub, Object orb) - throws RemoteException - { - ((Stub)stub).connect((ORB)orb); - } - - @Override - public boolean isOrb(Object obj) { - return (obj instanceof ORB); - } - - @Override - public Object createOrb(String[] args, Properties props) { - return ORB.init(args, props); - } - - @Override - public Object stringToObject(Object orb, String str) { - return ((ORB)orb).string_to_object(str); - } - - @Override - public String objectToString(Object orb, Object obj) { - return ((ORB)orb).object_to_string((org.omg.CORBA.Object)obj); - } - - @Override - @SuppressWarnings("unchecked") - public T narrow(Object narrowFrom, Class narrowTo) { - return (T)PortableRemoteObject.narrow(narrowFrom, narrowTo); - } - - @Override - public void exportObject(Remote obj) throws RemoteException { - PortableRemoteObject.exportObject(obj); - } - - @Override - public void unexportObject(Remote obj) throws NoSuchObjectException { - PortableRemoteObject.unexportObject(obj); - } - - @Override - public Remote toStub(final Remote obj) throws NoSuchObjectException { - if (System.getSecurityManager() == null) { - return PortableRemoteObject.toStub(obj); - } else { - try { - return AccessController.doPrivileged(new PrivilegedExceptionAction() { - - @Override - public Remote run() throws Exception { - return PortableRemoteObject.toStub(obj); - } - }, STUB_ACC); - } catch (PrivilegedActionException e) { - if (e.getException() instanceof NoSuchObjectException) { - throw (NoSuchObjectException)e.getException(); - } - throw new RuntimeException("Unexpected exception type", e.getException()); - } - } - } -} diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java --- a/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ProxyInputStream.java Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,241 +0,0 @@ -/* - * Copyright (c) 2003, 2008, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jmx.remote.protocol.iiop; - -import java.io.IOException; -import java.io.Serializable; -import java.math.BigDecimal; - -import org.omg.CORBA.Any; -import org.omg.CORBA.Context; -import org.omg.CORBA.NO_IMPLEMENT; -import org.omg.CORBA.ORB; -import org.omg.CORBA.TypeCode; -import org.omg.CORBA.portable.BoxedValueHelper; - -@SuppressWarnings({"deprecation", "rawtypes"}) -public class ProxyInputStream extends org.omg.CORBA_2_3.portable.InputStream { - public ProxyInputStream(org.omg.CORBA.portable.InputStream in) { - this.in = in; - } - - public boolean read_boolean() { - return in.read_boolean(); - } - - public char read_char() { - return in.read_char(); - } - - public char read_wchar() { - return in.read_wchar(); - } - - public byte read_octet() { - return in.read_octet(); - } - - public short read_short() { - return in.read_short(); - } - - public short read_ushort() { - return in.read_ushort(); - } - - public int read_long() { - return in.read_long(); - } - - public int read_ulong() { - return in.read_ulong(); - } - - public long read_longlong() { - return in.read_longlong(); - } - - public long read_ulonglong() { - return in.read_ulonglong(); - } - - public float read_float() { - return in.read_float(); - } - - public double read_double() { - return in.read_double(); - } - - public String read_string() { - return in.read_string(); - } - - public String read_wstring() { - return in.read_wstring(); - } - - public void read_boolean_array(boolean[] value, int offset, int length) { - in.read_boolean_array(value, offset, length); - } - - public void read_char_array(char[] value, int offset, int length) { - in.read_char_array(value, offset, length); - } - - public void read_wchar_array(char[] value, int offset, int length) { - in.read_wchar_array(value, offset, length); - } - - public void read_octet_array(byte[] value, int offset, int length) { - in.read_octet_array(value, offset, length); - } - - public void read_short_array(short[] value, int offset, int length) { - in.read_short_array(value, offset, length); - } - - public void read_ushort_array(short[] value, int offset, int length) { - in.read_ushort_array(value, offset, length); - } - - public void read_long_array(int[] value, int offset, int length) { - in.read_long_array(value, offset, length); - } - - public void read_ulong_array(int[] value, int offset, int length) { - in.read_ulong_array(value, offset, length); - } - - public void read_longlong_array(long[] value, int offset, int length) { - in.read_longlong_array(value, offset, length); - } - - public void read_ulonglong_array(long[] value, int offset, int length) { - in.read_ulonglong_array(value, offset, length); - } - - public void read_float_array(float[] value, int offset, int length) { - in.read_float_array(value, offset, length); - } - - public void read_double_array(double[] value, int offset, int length) { - in.read_double_array(value, offset, length); - } - - public org.omg.CORBA.Object read_Object() { - return in.read_Object(); - } - - public TypeCode read_TypeCode() { - return in.read_TypeCode(); - } - - public Any read_any() { - return in.read_any(); - } - - /** - * @deprecated - */ - @Override - @Deprecated - public org.omg.CORBA.Principal read_Principal() { - return in.read_Principal(); - } - - @Override - public int read() throws IOException { - return in.read(); - } - - @Override - public BigDecimal read_fixed() { - return in.read_fixed(); - } - - @Override - public Context read_Context() { - return in.read_Context(); - } - - @Override - public org.omg.CORBA.Object read_Object(java.lang.Class clz) { - return in.read_Object(clz); - } - - @Override - public ORB orb() { - return in.orb(); - } - - @Override - public Serializable read_value() { - return narrow().read_value(); - } - - @Override - public Serializable read_value(Class clz) { - return narrow().read_value(clz); - } - - @Override - public Serializable read_value(BoxedValueHelper factory) { - return narrow().read_value(factory); - } - - @Override - public Serializable read_value(String rep_id) { - return narrow().read_value(rep_id); - } - - @Override - public Serializable read_value(Serializable value) { - return narrow().read_value(value); - } - - @Override - public Object read_abstract_interface() { - return narrow().read_abstract_interface(); - } - - @Override - public Object read_abstract_interface(Class clz) { - return narrow().read_abstract_interface(clz); - } - - protected org.omg.CORBA_2_3.portable.InputStream narrow() { - if (in instanceof org.omg.CORBA_2_3.portable.InputStream) - return (org.omg.CORBA_2_3.portable.InputStream) in; - throw new NO_IMPLEMENT(); - } - - public org.omg.CORBA.portable.InputStream getProxiedInputStream() { - return in; - } - - protected final org.omg.CORBA.portable.InputStream in; -} diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java --- a/src/java.management/share/classes/com/sun/jmx/remote/protocol/iiop/ServerProvider.java Tue Sep 15 15:31:34 2015 +0400 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2003, 2004, 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 - * under the terms of the GNU General Public License version 2 only, as - * published by the Free Software Foundation. Oracle designates this - * particular file as subject to the "Classpath" exception as provided - * by Oracle in the LICENSE file that accompanied this code. - * - * This code is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License - * version 2 for more details (a copy is included in the LICENSE file that - * accompanied this code). - * - * You should have received a copy of the GNU General Public License version - * 2 along with this work; if not, write to the Free Software Foundation, - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. - * - * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA - * or visit www.oracle.com if you need additional information or have any - * questions. - */ - -package com.sun.jmx.remote.protocol.iiop; - -import java.io.IOException; -import java.net.MalformedURLException; -import java.util.Map; - -import javax.management.MBeanServer; -import javax.management.remote.JMXConnectorServer; -import javax.management.remote.JMXConnectorServerProvider; -import javax.management.remote.JMXServiceURL; -import javax.management.remote.rmi.RMIConnectorServer; - -public class ServerProvider implements JMXConnectorServerProvider { - - public JMXConnectorServer newJMXConnectorServer(JMXServiceURL serviceURL, - Map environment, - MBeanServer mbeanServer) - throws IOException { - if (!serviceURL.getProtocol().equals("iiop")) { - throw new MalformedURLException("Protocol not iiop: " + - serviceURL.getProtocol()); - } - return new RMIConnectorServer(serviceURL, environment, mbeanServer); - } - -} diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java --- a/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorFactory.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2014, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -140,9 +140,7 @@ * *

Every implementation must support the RMI connector protocol with * the default RMI transport, specified with string rmi. - * An implementation may optionally support the RMI connector protocol - * with the RMI/IIOP transport, specified with the string - * iiop.

+ *

* *

Once a provider is found, the result of the * newJMXConnector method is the result of calling {@link diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java --- a/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/JMXConnectorServerFactory.java Fri Sep 18 09:18:17 2015 -0700 @@ -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 @@ -131,9 +131,7 @@ * *

Every implementation must support the RMI connector protocol with * the default RMI transport, specified with string rmi. - * An implementation may optionally support the RMI connector protocol - * with the RMI/IIOP transport, specified with the string - * iiop.

+ *

* *

Once a provider is found, the result of the * newJMXConnectorServer method is the result of calling diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java --- a/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/rmi/NoCallStackClassLoader.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2013, 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 @@ -31,12 +31,11 @@

A class loader that only knows how to define a limited number of classes, and load a limited number of other classes through delegation to another loader. It is used to get around a problem - with Serialization, in particular as used by RMI (including - RMI/IIOP). The JMX Remote API defines exactly what class loader - must be used to deserialize arguments on the server, and return - values on the client. We communicate this class loader to RMI by - setting it as the context class loader. RMI uses the context - class loader to load classes as it deserializes, which is what we + with Serialization, in particular as used by RMI. The JMX Remote API + defines exactly what class loader must be used to deserialize arguments on + the server, and return values on the client. We communicate this class + loader to RMI by setting it as the context class loader. RMI uses the + context class loader to load classes as it deserializes, which is what we want. However, before consulting the context class loader, it looks up the call stack for a class with a non-null class loader, and uses that if it finds one. So, in the standalone version of diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java --- a/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectionImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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 @@ -76,11 +76,10 @@ /** * Constructs a new {@link RMIConnection}. This connection can be - * used with either the JRMP or IIOP transport. This object does + * used with the JRMP transport. This object does * not export itself: it is the responsibility of the caller to * export it appropriately (see {@link - * RMIJRMPServerImpl#makeClient(String,Subject)} and {@link - * RMIIIOPServerImpl#makeClient(String,Subject)}. + * RMIJRMPServerImpl#makeClient(String,Subject)}). * * @param rmiServer The RMIServerImpl object for which this * connection is created. The behavior is unspecified if this diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java --- a/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/rmi/RMIConnector.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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,25 +30,21 @@ import com.sun.jmx.remote.internal.ClientListenerInfo; import com.sun.jmx.remote.internal.ClientNotifForwarder; import com.sun.jmx.remote.internal.ProxyRef; -import com.sun.jmx.remote.internal.IIOPHelper; import com.sun.jmx.remote.util.ClassLogger; import com.sun.jmx.remote.util.EnvHelp; import java.io.ByteArrayInputStream; import java.io.IOException; import java.io.InputStream; import java.io.InvalidObjectException; -import java.io.NotSerializableException; import java.io.ObjectInputStream; import java.io.ObjectStreamClass; import java.io.Serializable; -import java.io.WriteAbortedException; import java.lang.ref.WeakReference; import java.lang.reflect.Constructor; import java.lang.reflect.InvocationHandler; import java.lang.reflect.InvocationTargetException; import java.lang.reflect.Proxy; import java.net.MalformedURLException; -import java.rmi.MarshalException; import java.rmi.MarshalledObject; import java.rmi.NoSuchObjectException; import java.rmi.Remote; @@ -61,13 +57,12 @@ import java.security.AccessController; import java.security.PrivilegedAction; import java.security.PrivilegedExceptionAction; -import java.security.PrivilegedActionException; import java.security.ProtectionDomain; import java.util.Arrays; import java.util.Collections; import java.util.HashMap; +import java.util.Hashtable; import java.util.Map; -import java.util.Properties; import java.util.Set; import java.util.WeakHashMap; import javax.management.Attribute; @@ -146,22 +141,20 @@ * the RMI connector server with the given address.

* *

The address can refer directly to the connector server, - * using one of the following syntaxes:

+ * using the following syntax:

* *
      * service:jmx:rmi://[host[:port]]/stub/encoded-stub
-     * service:jmx:iiop://[host[:port]]/ior/encoded-IOR
      * 
* *

(Here, the square brackets {@code []} are not part of the * address but indicate that the host and port are optional.)

* *

The address can instead indicate where to find an RMI stub - * through JNDI, using one of the following syntaxes:

+ * through JNDI, using the following syntax:

* *
      * service:jmx:rmi://[host[:port]]/jndi/jndi-name
-     * service:jmx:iiop://[host[:port]]/jndi/jndi-name
      * 
* *

An implementation may also recognize additional address @@ -242,8 +235,7 @@ /** * @throws IOException if the connection could not be made because of a - * communication problem, or in the case of the {@code iiop} protocol, - * that RMI/IIOP is not supported + * communication problem */ public void connect() throws IOException { connect(null); @@ -251,8 +243,7 @@ /** * @throws IOException if the connection could not be made because of a - * communication problem, or in the case of the {@code iiop} protocol, - * that RMI/IIOP is not supported + * communication problem */ public synchronized void connect(Map environment) throws IOException { @@ -294,9 +285,7 @@ if (checkStub) checkStub(stub, rmiServerImplStubClass); - // Connect IIOP Stub if needed. if (tracing) logger.trace("connect",idstr + " connecting stub..."); - stub = connectStub(stub,usemap); idstr = (tracing?"["+this.toString()+"]":null); // Calling newClient on the RMIServer stub. @@ -307,18 +296,6 @@ try { connection = getConnection(stub, credentials, checkStub); } catch (java.rmi.RemoteException re) { - if (jmxServiceURL != null) { - final String pro = jmxServiceURL.getProtocol(); - final String path = jmxServiceURL.getURLPath(); - - if ("rmi".equals(pro) && - path.startsWith("/jndi/iiop:")) { - MalformedURLException mfe = new MalformedURLException( - "Protocol is rmi but JNDI scheme is iiop: " + jmxServiceURL); - mfe.initCause(re); - throw mfe; - } - } throw re; } @@ -1413,13 +1390,6 @@ if (ioe instanceof UnmarshalException) { throw ioe; // the fix of 6937053 made ClientNotifForwarder.fetchNotifs // fetch one by one with UnmarshalException - } else if (ioe instanceof MarshalException) { - // IIOP will throw MarshalException wrapping a NotSerializableException - // when a server fails to serialize a response. - MarshalException me = (MarshalException)ioe; - if (me.detail instanceof NotSerializableException) { - throw (NotSerializableException)me.detail; - } } // Not serialization problem, return. @@ -1654,9 +1624,6 @@ throw new IOException("Failed to get a RMI stub: "+ne); } - // Connect IIOP Stub if needed. - stub = connectStub(stub,env); - // Calling newClient on the RMIServer stub. Object credentials = env.get(CREDENTIALS); connection = stub.newClient(credentials); @@ -1694,103 +1661,6 @@ // Private stuff - Serialization //-------------------------------------------------------------------- /** - *

In order to be usable, an IIOP stub must be connected to an ORB. - * The stub is automatically connected to the ORB if: - *

    - *
  • It was returned by the COS naming
  • - *
  • Its server counterpart has been registered in COS naming - * through JNDI.
  • - *
- * Otherwise, it is not connected. A stub which is deserialized - * from Jini is not connected. A stub which is obtained from a - * non registered RMIIIOPServerImpl is not a connected.
- * A stub which is not connected can't be serialized, and thus - * can't be registered in Jini. A stub which is not connected can't - * be used to invoke methods on the server. - *

- * In order to palliate this, this method will connect the - * given stub if it is not yet connected. If the given - * RMIServer is not an instance of - * {@link javax.rmi.CORBA.Stub javax.rmi.CORBA.Stub}, then the - * method do nothing and simply returns that stub. Otherwise, - * this method will attempt to connect the stub to an ORB as - * follows: - *

    - *
  • This method looks in the provided environment for - * the "java.naming.corba.orb" property. If it is found, the - * referenced object (an {@link org.omg.CORBA.ORB ORB}) is used to - * connect the stub. Otherwise, a new org.omg.CORBA.ORB is created - * by calling {@link - * org.omg.CORBA.ORB#init(String[], Properties) - * org.omg.CORBA.ORB.init((String[])null,(Properties)null)}
  • - *
  • The new created ORB is kept in a static - * {@link WeakReference} and can be reused for connecting other - * stubs. However, no reference is ever kept on the ORB provided - * in the environment map, if any.
  • - *
- * @param rmiServer A RMI Server Stub. - * @param environment An environment map, possibly containing an ORB. - * @return the given stub. - * @exception IllegalArgumentException if the - * {@code java.naming.corba.orb} property is specified and - * does not point to an {@link org.omg.CORBA.ORB ORB}. - * @exception IOException if the connection to the ORB failed. - **/ - static RMIServer connectStub(RMIServer rmiServer, - Map environment) - throws IOException { - if (IIOPHelper.isStub(rmiServer)) { - try { - IIOPHelper.getOrb(rmiServer); - } catch (UnsupportedOperationException x) { - // BAD_OPERATION - IIOPHelper.connect(rmiServer, resolveOrb(environment)); - } - } - return rmiServer; - } - - /** - * Get the ORB specified by environment, or create a - * new one. - *

This method looks in the provided environment for - * the "java.naming.corba.orb" property. If it is found, the - * referenced object (an {@link org.omg.CORBA.ORB ORB}) is - * returned. Otherwise, a new org.omg.CORBA.ORB is created - * by calling {@link - * org.omg.CORBA.ORB#init(String[], java.util.Properties) - * org.omg.CORBA.ORB.init((String[])null,(Properties)null)} - *

The new created ORB is kept in a static - * {@link WeakReference} and can be reused for connecting other - * stubs. However, no reference is ever kept on the ORB provided - * in the environment map, if any. - * @param environment An environment map, possibly containing an ORB. - * @return An ORB. - * @exception IllegalArgumentException if the - * {@code java.naming.corba.orb} property is specified and - * does not point to an {@link org.omg.CORBA.ORB ORB}. - * @exception IOException if the ORB initialization failed. - **/ - static Object resolveOrb(Map environment) - throws IOException { - if (environment != null) { - final Object orb = environment.get(EnvHelp.DEFAULT_ORB); - if (orb != null && !(IIOPHelper.isOrb(orb))) - throw new IllegalArgumentException(EnvHelp.DEFAULT_ORB + - " must be an instance of org.omg.CORBA.ORB."); - if (orb != null) return orb; - } - final Object orb = - (RMIConnector.orb==null)?null:RMIConnector.orb.get(); - if (orb != null) return orb; - - final Object newOrb = - IIOPHelper.createOrb((String[])null, (Properties)null); - RMIConnector.orb = new WeakReference(newOrb); - return newOrb; - } - - /** * Read RMIConnector fields from an {@link java.io.ObjectInputStream * ObjectInputStream}. * Calls {@code s.defaultReadObject()} and then initializes @@ -1846,7 +1716,6 @@ throws IOException { if (rmiServer == null && jmxServiceURL == null) throw new InvalidObjectException("rmiServer and jmxServiceURL both null."); - connectStub(this.rmiServer,env); s.defaultWriteObject(); } @@ -1911,24 +1780,15 @@ private RMIServer findRMIServer(JMXServiceURL directoryURL, Map environment) throws NamingException, IOException { - final boolean isIiop = RMIConnectorServer.isIiopURL(directoryURL,true); - if (isIiop) { - // Make sure java.naming.corba.orb is in the Map. - environment.put(EnvHelp.DEFAULT_ORB,resolveOrb(environment)); - } String path = directoryURL.getURLPath(); int end = path.indexOf(';'); if (end < 0) end = path.length(); if (path.startsWith("/jndi/")) - return findRMIServerJNDI(path.substring(6,end), environment, isIiop); + return findRMIServerJNDI(path.substring(6,end), environment); else if (path.startsWith("/stub/")) - return findRMIServerJRMP(path.substring(6,end), environment, isIiop); - else if (path.startsWith("/ior/")) { - if (!IIOPHelper.isAvailable()) - throw new IOException("iiop protocol not available"); - return findRMIServerIIOP(path.substring(5,end), environment, isIiop); - } else { + return findRMIServerJRMP(path.substring(6,end), environment); + else { final String msg = "URL path must begin with /jndi/ or /stub/ " + "or /ior/: " + path; throw new MalformedURLException(msg); @@ -1940,16 +1800,13 @@ * @param jndiURL A JNDI URL indicating the location of the Stub * (see {@link javax.management.remote.rmi}), e.g.: *
  • {@code rmi://registry-host:port/rmi-stub-name}
  • - *
  • or {@code iiop://cosnaming-host:port/iiop-stub-name}
  • *
  • or {@code ldap://ldap-host:port/java-container-dn}
  • *
* @param env the environment Map passed to the connector. - * @param isIiop true if the stub is expected to be an IIOP stub. * @return The retrieved RMIServer stub. * @exception NamingException if the stub couldn't be found. **/ - private RMIServer findRMIServerJNDI(String jndiURL, Map env, - boolean isIiop) + private RMIServer findRMIServerJNDI(String jndiURL, Map env) throws NamingException { InitialContext ctx = new InitialContext(EnvHelp.mapToHashtable(env)); @@ -1957,10 +1814,7 @@ Object objref = ctx.lookup(jndiURL); ctx.close(); - if (isIiop) - return narrowIIOPServer(objref); - else - return narrowJRMPServer(objref); + return narrowJRMPServer(objref); } private static RMIServer narrowJRMPServer(Object objref) { @@ -1968,28 +1822,8 @@ return (RMIServer) objref; } - private static RMIServer narrowIIOPServer(Object objref) { - try { - return IIOPHelper.narrow(objref, RMIServer.class); - } catch (ClassCastException e) { - if (logger.traceOn()) - logger.trace("narrowIIOPServer","Failed to narrow objref=" + - objref + ": " + e); - if (logger.debugOn()) logger.debug("narrowIIOPServer",e); - return null; - } - } - - private RMIServer findRMIServerIIOP(String ior, Map env, boolean isIiop) { - // could forbid "rmi:" URL here -- but do we need to? - final Object orb = env.get(EnvHelp.DEFAULT_ORB); - final Object stub = IIOPHelper.stringToObject(orb, ior); - return IIOPHelper.narrow(stub, RMIServer.class); - } - - private RMIServer findRMIServerJRMP(String base64, Map env, boolean isIiop) + private RMIServer findRMIServerJRMP(String base64, Map env) throws IOException { - // could forbid "iiop:" URL here -- but do we need to? final byte[] serialized; try { serialized = base64ToByteArray(base64); @@ -2203,228 +2037,6 @@ return proxyStub; } - /* - The following code performs a similar trick for RMI/IIOP to the - one described above for RMI/JRMP. Unlike JRMP, though, we - can't easily insert an object between the RMIConnection stub - and the RMI/IIOP deserialization code, as explained below. - - A method in an RMI/IIOP stub does the following. It makes an - org.omg.CORBA_2_3.portable.OutputStream for each request, and - writes the parameters to it. Then it calls - _invoke(OutputStream) which it inherits from CORBA's - ObjectImpl. That returns an - org.omg.CORBA_2_3.portable.InputStream. The return value is - read from this InputStream. So the stack during - deserialization looks like this: - - MBeanServerConnection.getAttribute (or whatever) - -> _RMIConnection_Stub.getAttribute - -> Util.readAny (a CORBA method) - -> InputStream.read_any - -> internal CORBA stuff - - What we would have *liked* to have done would be the same thing - as for RMI/JRMP. We create a "ProxyDelegate" that is an - org.omg.CORBA.portable.Delegate that simply forwards every - operation to the real original Delegate from the RMIConnection - stub, except that the InputStream returned by _invoke is - wrapped by a "ProxyInputStream" that is loaded by our - NoCallStackClassLoader. - - Unfortunately, this doesn't work, at least with Sun's J2SE - 1.4.2, because the CORBA code is not designed to allow you to - change Delegates arbitrarily. You get a ClassCastException - from code that expects the Delegate to implement an internal - interface. - - So instead we do the following. We create a subclass of the - stub that overrides the _invoke method so as to wrap the - returned InputStream in a ProxyInputStream. We create a - subclass of ProxyInputStream using the NoCallStackClassLoader - and override its read_any and read_value(Class) methods. - (These are the only methods called during deserialization of - MBeanServerConnection return values.) We extract the Delegate - from the original stub and insert it into our subclass stub, - and away we go. The state of a stub consists solely of its - Delegate. - - We also need to catch ApplicationException, which will encode - any exceptions declared in the throws clause of the called - method. Its InputStream needs to be wrapped in a - ProxyInputSteam too. - - We override _releaseReply in the stub subclass so that it - replaces a ProxyInputStream argument with the original - InputStream. This avoids problems if the implementation of - _releaseReply ends up casting this InputStream to an - implementation-specific interface (which in Sun's J2SE 5 it - does). - - It is not strictly necessary for the stub subclass to be loaded - by a NoCallStackClassLoader, since the call-stack search stops - at the ProxyInputStream subclass. However, it is convenient - for two reasons. One is that it means that the - ProxyInputStream subclass can be accessed directly, without - using reflection. The other is that it avoids build problems, - since usually stubs are created after other classes are - compiled, so we can't access them from this class without, - again, using reflection. - - The strings below encode the following two Java classes, - compiled using javac -g:none. - - package com.sun.jmx.remote.protocol.iiop; - - import org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub; - - import org.omg.CORBA.portable.ApplicationException; - import org.omg.CORBA.portable.InputStream; - import org.omg.CORBA.portable.OutputStream; - import org.omg.CORBA.portable.RemarshalException; - - public class ProxyStub extends _RMIConnection_Stub { - public InputStream _invoke(OutputStream out) - throws ApplicationException, RemarshalException { - try { - return new PInputStream(super._invoke(out)); - } catch (ApplicationException e) { - InputStream pis = new PInputStream(e.getInputStream()); - throw new ApplicationException(e.getId(), pis); - } - } - - public void _releaseReply(InputStream in) { - if (in != null) - in = ((PInputStream)in).getProxiedInputStream(); - super._releaseReply(in); - } - } - - package com.sun.jmx.remote.protocol.iiop; - - public class PInputStream extends ProxyInputStream { - public PInputStream(org.omg.CORBA.portable.InputStream in) { - super(in); - } - - public org.omg.CORBA.Any read_any() { - return in.read_any(); - } - - public java.io.Serializable read_value(Class clz) { - return narrow().read_value(clz); - } - } - - - */ - private static final String iiopConnectionStubClassName = - "org.omg.stub.javax.management.remote.rmi._RMIConnection_Stub"; - private static final String proxyStubClassName = - "com.sun.jmx.remote.protocol.iiop.ProxyStub"; - private static final String ProxyInputStreamClassName = - "com.sun.jmx.remote.protocol.iiop.ProxyInputStream"; - private static final String pInputStreamClassName = - "com.sun.jmx.remote.protocol.iiop.PInputStream"; - private static final Class proxyStubClass; - static { - final String proxyStubByteCodeString = - "\312\376\272\276\0\0\0\63\0+\12\0\14\0\30\7\0\31\12\0\14\0\32\12"+ - "\0\2\0\33\7\0\34\12\0\5\0\35\12\0\5\0\36\12\0\5\0\37\12\0\2\0 "+ - "\12\0\14\0!\7\0\"\7\0#\1\0\6\1\0\3()V\1\0\4Code\1\0\7_in"+ - "voke\1\0K(Lorg/omg/CORBA/portable/OutputStream;)Lorg/omg/CORBA"+ - "/portable/InputStream;\1\0\15StackMapTable\7\0\34\1\0\12Except"+ - "ions\7\0$\1\0\15_releaseReply\1\0'(Lorg/omg/CORBA/portable/Inp"+ - "utStream;)V\14\0\15\0\16\1\0-com/sun/jmx/remote/protocol/iiop/"+ - "PInputStream\14\0\20\0\21\14\0\15\0\27\1\0+org/omg/CORBA/porta"+ - "ble/ApplicationException\14\0%\0&\14\0'\0(\14\0\15\0)\14\0*\0&"+ - "\14\0\26\0\27\1\0*com/sun/jmx/remote/protocol/iiop/ProxyStub\1"+ - "\0\1\0'("+ - "Lorg/omg/CORBA/portable/InputStream;)V\1\0\4Code\1\0\10read_an"+ - "y\1\0\25()Lorg/omg/CORBA/Any;\1\0\12read_value\1\0)(Ljava/lang"+ - "/Class;)Ljava/io/Serializable;\14\0\10\0\11\14\0\30\0\31\7\0\32"+ - "\14\0\13\0\14\14\0\33\0\34\7\0\35\14\0\15\0\16\1\0-com/sun/jmx"+ - "/remote/protocol/iiop/PInputStream\1\0\61com/sun/jmx/remote/pr"+ - "otocol/iiop/ProxyInputStream\1\0\2in\1\0$Lorg/omg/CORBA/portab"+ - "le/InputStream;\1\0\"org/omg/CORBA/portable/InputStream\1\0\6n"+ - "arrow\1\0*()Lorg/omg/CORBA_2_3/portable/InputStream;\1\0&org/o"+ - "mg/CORBA_2_3/portable/InputStream\0!\0\6\0\7\0\0\0\0\0\3\0\1\0"+ - "\10\0\11\0\1\0\12\0\0\0\22\0\2\0\2\0\0\0\6*+\267\0\1\261\0\0\0"+ - "\0\0\1\0\13\0\14\0\1\0\12\0\0\0\24\0\1\0\1\0\0\0\10*\264\0\2\266"+ - "\0\3\260\0\0\0\0\0\1\0\15\0\16\0\1\0\12\0\0\0\25\0\2\0\2\0\0\0"+ - "\11*\266\0\4+\266\0\5\260\0\0\0\0\0\0"; - final byte[] proxyStubByteCode = - NoCallStackClassLoader.stringToBytes(proxyStubByteCodeString); - final byte[] pInputStreamByteCode = - NoCallStackClassLoader.stringToBytes(pInputStreamByteCodeString); - final String[] classNames={proxyStubClassName, pInputStreamClassName}; - final byte[][] byteCodes = {proxyStubByteCode, pInputStreamByteCode}; - final String[] otherClassNames = { - iiopConnectionStubClassName, - ProxyInputStreamClassName, - }; - if (IIOPHelper.isAvailable()) { - PrivilegedExceptionAction> action = - new PrivilegedExceptionAction>() { - public Class run() throws Exception { - Class thisClass = RMIConnector.class; - ClassLoader thisLoader = thisClass.getClassLoader(); - ProtectionDomain thisProtectionDomain = - thisClass.getProtectionDomain(); - ClassLoader cl = - new NoCallStackClassLoader(classNames, - byteCodes, - otherClassNames, - thisLoader, - thisProtectionDomain); - return cl.loadClass(proxyStubClassName); - } - }; - Class stubClass; - try { - stubClass = AccessController.doPrivileged(action); - } catch (Exception e) { - logger.error("", - "Unexpected exception making shadow IIOP stub class: "+e); - logger.debug("",e); - stubClass = null; - } - proxyStubClass = stubClass; - } else { - proxyStubClass = null; - } - } - - private static RMIConnection shadowIiopStub(Object stub) - throws InstantiationException, IllegalAccessException { - Object proxyStub = null; - try { - proxyStub = AccessController.doPrivileged(new PrivilegedExceptionAction() { - public Object run() throws Exception { - return proxyStubClass.newInstance(); - } - }); - } catch (PrivilegedActionException e) { - throw new InternalError(); - } - IIOPHelper.setDelegate(proxyStub, IIOPHelper.getDelegate(stub)); - return (RMIConnection) proxyStub; - } private static RMIConnection getConnection(RMIServer server, Object credentials, boolean checkStub) @@ -2434,8 +2046,6 @@ try { if (c.getClass() == rmiConnectionImplStubClass) return shadowJrmpStub((RemoteObject) c); - if (c.getClass().getName().equals(iiopConnectionStubClassName)) - return shadowIiopStub(c); logger.trace("getConnection", "Did not wrap " + c.getClass() + " to foil " + "stack search for classes: class loading semantics " + diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/rmi/RMIConnectorServer.java --- a/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectorServer.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/rmi/RMIConnectorServer.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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,6 @@ import com.sun.jmx.remote.security.MBeanServerFileAccessController; -import com.sun.jmx.remote.internal.IIOPHelper; import com.sun.jmx.remote.util.ClassLogger; import com.sun.jmx.remote.util.EnvHelp; @@ -117,8 +116,8 @@ * * @exception MalformedURLException if url does not * conform to the syntax for an RMI connector, or if its protocol - * is not recognized by this implementation. Only "rmi" and "iiop" - * are valid when this constructor is used. + * is not recognized by this implementation. Only "rmi" is valid when + * this constructor is used. * * @exception IOException if the connector server cannot be created * for some reason or if it is inevitable that its {@link #start() @@ -151,8 +150,8 @@ * * @exception MalformedURLException if url does not * conform to the syntax for an RMI connector, or if its protocol - * is not recognized by this implementation. Only "rmi" and "iiop" - * are valid when this constructor is used. + * is not recognized by this implementation. Only "rmi" is valid + * when this constructor is used. * * @exception IOException if the connector server cannot be created * for some reason or if it is inevitable that its {@link #start() @@ -179,7 +178,7 @@ * consistent with the protocol type specified in url. * If this parameter is non null, the protocol type specified by * url is not constrained, and is assumed to be valid. - * Otherwise, only "rmi" and "iiop" will be recognized. + * Otherwise, only "rmi" will be recognized. * * @param mbeanServer the MBean server to which the new connector * server is attached, or null if it will be attached by being @@ -189,8 +188,8 @@ * * @exception MalformedURLException if url does not * conform to the syntax for an RMI connector, or if its protocol - * is not recognized by this implementation. Only "rmi" and "iiop" - * are recognized when rmiServerImpl is null. + * is not recognized by this implementation. Only "rmi" is recognized + * when rmiServerImpl is null. * * @exception IOException if the connector server cannot be created * for some reason or if it is inevitable that its {@link #start() @@ -208,7 +207,7 @@ IllegalArgumentException("Null JMXServiceURL"); if (rmiServerImpl == null) { final String prt = url.getProtocol(); - if (prt == null || !(prt.equals("rmi") || prt.equals("iiop"))) { + if (prt == null || !(prt.equals("rmi"))) { final String msg = "Invalid protocol type: " + prt; throw new MalformedURLException(msg); } @@ -298,11 +297,6 @@ *
  • If an RMIServerImpl was supplied to the * constructor, it is used. * - *
  • Otherwise, if the protocol part of the - * JMXServiceURL supplied to the constructor was - * iiop, an object of type {@link RMIIIOPServerImpl} - * is created. - * *
  • Otherwise, if the JMXServiceURL * was null, or its protocol part was rmi, an object * of type {@link RMIJRMPServerImpl} is created. @@ -324,21 +318,19 @@ * will not be bound to a directory. Instead, a reference to it * will be encoded in the URL path of the RMIConnectorServer * address (returned by {@link #getAddress()}). The encodings for - * rmi and iiop are described in the - * package documentation for {@link - * javax.management.remote.rmi}.

    + * rmi are described in the package documentation for + * {@link javax.management.remote.rmi}.

    * *

    The behavior when the URL path is neither empty nor a JNDI - * directory URL, or when the protocol is neither rmi - * nor iiop, is implementation defined, and may - * include throwing {@link MalformedURLException} when the - * connector server is created or when it is started.

    + * directory URL, or when the protocol is not rmi, + * is implementation defined, and may include throwing + * {@link MalformedURLException} when the connector server is created + * or when it is started.

    * * @exception IllegalStateException if the connector server has * not been attached to an MBean server. * @exception IOException if the connector server cannot be - * started, or in the case of the {@code iiop} protocol, that - * RMI/IIOP is not supported. + * started. */ public synchronized void start() throws IOException { final boolean tracing = logger.traceOn(); @@ -649,16 +641,13 @@ * Creates a new RMIServerImpl. **/ RMIServerImpl newServer() throws IOException { - final boolean iiop = isIiopURL(address,true); final int port; if (address == null) port = 0; else port = address.getPort(); - if (iiop) - return newIIOPServer(attributes); - else - return newJRMPServer(attributes, port); + + return newJRMPServer(attributes, port); } /** @@ -675,10 +664,7 @@ final int port; if (address == null) { - if (IIOPHelper.isStub(rmiServer)) - protocol = "iiop"; - else - protocol = "rmi"; + protocol = "rmi"; host = null; // will default to local host name port = 0; } else { @@ -692,31 +678,12 @@ address = new JMXServiceURL(protocol, host, port, urlPath); } - static boolean isIiopURL(JMXServiceURL directoryURL, boolean strict) - throws MalformedURLException { - String protocol = directoryURL.getProtocol(); - if (protocol.equals("rmi")) - return false; - else if (protocol.equals("iiop")) - return true; - else if (strict) { - - throw new MalformedURLException("URL must have protocol " + - "\"rmi\" or \"iiop\": \"" + - protocol + "\""); - } - return false; - } - /** * Returns the IOR of the given rmiServer. **/ static String encodeStub( RMIServer rmiServer, Map env) throws IOException { - if (IIOPHelper.isStub(rmiServer)) - return "/ior/" + encodeIIOPStub(rmiServer, env); - else - return "/stub/" + encodeJRMPStub(rmiServer, env); + return "/stub/" + encodeJRMPStub(rmiServer, env); } static String encodeJRMPStub( @@ -730,17 +697,6 @@ return byteArrayToBase64(bytes); } - static String encodeIIOPStub( - RMIServer rmiServer, Map env) - throws IOException { - try { - Object orb = IIOPHelper.getOrb(rmiServer); - return IIOPHelper.objectToString(orb, rmiServer); - } catch (RuntimeException x) { - throw newIOException(x.getMessage(), x); - } - } - /** * Object that we will bind to the registry. * This object is a stub connected to our RMIServerImpl. @@ -748,8 +704,7 @@ private static RMIServer objectToBind( RMIServerImpl rmiServer, Map env) throws IOException { - return RMIConnector. - connectStub((RMIServer)rmiServer.toStub(),env); + return (RMIServer)rmiServer.toStub(); } private static RMIServerImpl newJRMPServer(Map env, int port) @@ -761,11 +716,6 @@ return new RMIJRMPServerImpl(port, csf, ssf, env); } - private static RMIServerImpl newIIOPServer(Map env) - throws IOException { - return new RMIIIOPServerImpl(env); - } - private static String byteArrayToBase64(byte[] a) { int aLen = a.length; int numFullGroups = aLen/3; diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java --- a/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/rmi/RMIIIOPServerImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2003, 2007, 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 @@ -27,16 +27,9 @@ import java.io.IOException; import java.rmi.Remote; -import java.security.AccessControlContext; -import java.security.AccessController; -import java.security.PrivilegedActionException; -import java.security.PrivilegedExceptionAction; import java.util.Map; -import java.util.Collections; import javax.security.auth.Subject; -import com.sun.jmx.remote.internal.IIOPHelper; - /** *

    An {@link RMIServerImpl} that is exported through IIOP and that * creates client connections as RMI objects exported through IIOP. @@ -45,120 +38,59 @@ * @see RMIServerImpl * * @since 1.5 + * @deprecated This transport is no longer supported. */ +@Deprecated public class RMIIIOPServerImpl extends RMIServerImpl { /** - *

    Creates a new {@link RMIServerImpl}.

    + * Throws {@linkplain UnsupportedOperationException} * * @param env the environment containing attributes for the new * RMIServerImpl. Can be null, which is equivalent * to an empty Map. * - * @exception IOException if the RMI object cannot be created. + * @throws IOException if the RMI object cannot be created. */ public RMIIIOPServerImpl(Map env) throws IOException { super(env); - this.env = (env == null) ? Collections.emptyMap() : env; - - callerACC = AccessController.getContext(); + throw new UnsupportedOperationException(); } + @Override protected void export() throws IOException { - IIOPHelper.exportObject(this); + throw new UnsupportedOperationException("Method not supported. JMX RMI-IIOP is deprecated"); } + @Override protected String getProtocol() { return "iiop"; } - /** - *

    Returns an IIOP stub.

    - * The stub might not yet be connected to the ORB. The stub will - * be serializable only if it is connected to the ORB. - * @return an IIOP stub. - * @exception IOException if the stub cannot be created - e.g the - * RMIIIOPServerImpl has not been exported yet. - **/ + @Override public Remote toStub() throws IOException { - // javax.rmi.CORBA.Stub stub = - // (javax.rmi.CORBA.Stub) PortableRemoteObject.toStub(this); - final Remote stub = IIOPHelper.toStub(this); - // java.lang.System.out.println("NON CONNECTED STUB " + stub); - // org.omg.CORBA.ORB orb = - // org.omg.CORBA.ORB.init((String[])null, (Properties)null); - // stub.connect(orb); - // java.lang.System.out.println("CONNECTED STUB " + stub); - return stub; + throw new UnsupportedOperationException(); } - /** - *

    Creates a new client connection as an RMI object exported - * through IIOP. - * - * @param connectionId the ID of the new connection. Every - * connection opened by this connector server will have a - * different ID. The behavior is unspecified if this parameter is - * null. - * - * @param subject the authenticated subject. Can be null. - * - * @return the newly-created RMIConnection. - * - * @exception IOException if the new client object cannot be - * created or exported. - */ + @Override protected RMIConnection makeClient(String connectionId, Subject subject) throws IOException { - - if (connectionId == null) - throw new NullPointerException("Null connectionId"); - - RMIConnection client = - new RMIConnectionImpl(this, connectionId, getDefaultClassLoader(), - subject, env); - IIOPHelper.exportObject(client); - return client; + throw new UnsupportedOperationException(); } + @Override protected void closeClient(RMIConnection client) throws IOException { - IIOPHelper.unexportObject(client); + throw new UnsupportedOperationException(); } - /** - *

    Called by {@link #close()} to close the connector server by - * unexporting this object. After returning from this method, the - * connector server must not accept any new connections.

    - * - * @exception IOException if the attempt to close the connector - * server failed. - */ + @Override protected void closeServer() throws IOException { - IIOPHelper.unexportObject(this); + throw new UnsupportedOperationException(); } @Override RMIConnection doNewClient(final Object credentials) throws IOException { - if (callerACC == null) { - throw new SecurityException("AccessControlContext cannot be null"); - } - try { - return AccessController.doPrivileged( - new PrivilegedExceptionAction() { - public RMIConnection run() throws IOException { - return superDoNewClient(credentials); - } - }, callerACC); - } catch (PrivilegedActionException pae) { - throw (IOException) pae.getCause(); - } + throw new UnsupportedOperationException(); } - - RMIConnection superDoNewClient(Object credentials) throws IOException { - return super.doNewClient(credentials); - } - - private final Map env; - private final AccessControlContext callerACC; } diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java --- a/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/rmi/RMIServerImpl.java Fri Sep 18 09:18:17 2015 -0700 @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 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,8 +61,7 @@ * or by instantiating {@link RMIConnector}.

    * *

    This is an abstract class. Concrete subclasses define the - * details of the client connection objects, such as whether they use - * JRMP or IIOP.

    + * details of the client connection objects.

    * * @since 1.5 */ @@ -307,7 +306,7 @@ /** *

    Returns the protocol string for this object. The string is - * rmi for RMI/JRMP and iiop for RMI/IIOP. + * rmi for RMI/JRMP. * * @return the protocol string for this object. */ diff -r 7869179af058 -r 38169ef6e325 src/java.management/share/classes/javax/management/remote/rmi/package.html --- a/src/java.management/share/classes/javax/management/remote/rmi/package.html Tue Sep 15 15:31:34 2015 +0400 +++ b/src/java.management/share/classes/javax/management/remote/rmi/package.html Fri Sep 18 09:18:17 2015 -0700 @@ -2,7 +2,7 @@ RMI connector