--- a/.hgtags Tue Sep 15 15:49:30 2015 +0200
+++ b/.hgtags Thu Sep 17 09:19:40 2015 -0700
@@ -323,3 +323,4 @@
c8753d0be1778944dc512ec86a459941ea1ad2c3 jdk9-b78
3966bd3b8167419aa05c6718a4af1cf54b1e3c58 jdk9-b79
3c9f5bd909ae7187f24622ee4b69f8a5756a9271 jdk9-b80
+2050b3a0aadcb0e024bf798197421d58e54ec8bf jdk9-b81
--- a/.hgtags-top-repo Tue Sep 15 15:49:30 2015 +0200
+++ b/.hgtags-top-repo Thu Sep 17 09:19:40 2015 -0700
@@ -323,3 +323,4 @@
8c40d4143ee13bdf8170c68cc384c36ab1e9fadb jdk9-b78
ba08a9f79b9849716bae1f39f71333d47f604012 jdk9-b79
f7c5ae2933c0b8510a420d1713a955e4ffc7ad0b jdk9-b80
+b8afcf91331d78626a583ec1b63164468d6f4181 jdk9-b81
--- a/common/autoconf/generated-configure.sh Tue Sep 15 15:49:30 2015 +0200
+++ b/common/autoconf/generated-configure.sh Thu Sep 17 09:19:40 2015 -0700
@@ -4364,7 +4364,7 @@
#CUSTOM_AUTOCONF_INCLUDE
# Do not change or remove the following line, it is needed for consistency checks:
-DATE_WHEN_GENERATED=1435822080
+DATE_WHEN_GENERATED=1441958217
###############################################################################
#
@@ -38307,6 +38307,48 @@
fi
fi
+ if test "x$OPENJDK_BUILD_OS" = xsolaris; then
+ # objcopy prior to 2.21.1 on solaris is broken and is not usable.
+ # Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
+ # - version number is last blank separate word on first line
+ # - version number formats that have been seen:
+ # - <major>.<minor>
+ # - <major>.<minor>.<micro>
+ OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
+ # The outer [ ] is to prevent m4 from eating the [] in the sed expression.
+ OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
+ -e 's/.* //' \
+ -e '/^[01]\./b bad' \
+ -e '/^2\./{' \
+ -e ' s/^2\.//' \
+ -e ' /^[0-9]$/b bad' \
+ -e ' /^[0-9]\./b bad' \
+ -e ' /^1[0-9]$/b bad' \
+ -e ' /^1[0-9]\./b bad' \
+ -e ' /^20\./b bad' \
+ -e ' /^21\.0$/b bad' \
+ -e ' /^21\.0\./b bad' \
+ -e '}' \
+ -e ':good' \
+ -e 's/.*/VALID_VERSION/p' \
+ -e 'q' \
+ -e ':bad' \
+ -e 's/.*/BAD_VERSION/p' \
+ -e 'q'`
+ if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
+ OBJCOPY=
+ { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&5
+$as_echo "$as_me: WARNING: Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated." >&2;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: objcopy reports version $OBJCOPY_VERSION" >&5
+$as_echo "$as_me: objcopy reports version $OBJCOPY_VERSION" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&5
+$as_echo "$as_me: Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&5
+$as_echo "$as_me: Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version" >&6;}
+ { $as_echo "$as_me:${as_lineno-$LINENO}: Note: Solaris 11 Update 1 contains the correct version" >&5
+$as_echo "$as_me: Note: Solaris 11 Update 1 contains the correct version" >&6;}
+ fi
+ fi
fi
fi
--- a/common/autoconf/spec.gmk.in Tue Sep 15 15:49:30 2015 +0200
+++ b/common/autoconf/spec.gmk.in Thu Sep 17 09:19:40 2015 -0700
@@ -30,25 +30,6 @@
# (called @OPENJDK_BUILD_AUTOCONF_NAME@ by autoconf)
# using 'configure @CONFIGURE_COMMAND_LINE@'
-# When calling macros, the spaces between arguments are
-# often semantically important! Sometimes we need to subst
-# spaces and commas, therefore we need the following macros.
-X:=
-SPACE:=$(X) $(X)
-COMMA:=,
-DOLLAR:=$$
-HASH:=\#
-LEFT_PAREN:=(
-RIGHT_PAREN:=)
-SQUOTE:='
-#'
-DQUOTE:="
-#"
-define NEWLINE
-
-
-endef
-
# The command line given to configure.
CONFIGURE_COMMAND_LINE:=@CONFIGURE_COMMAND_LINE@
--- a/common/autoconf/toolchain.m4 Tue Sep 15 15:49:30 2015 +0200
+++ b/common/autoconf/toolchain.m4 Thu Sep 17 09:19:40 2015 -0700
@@ -586,6 +586,43 @@
# Only call fixup if objcopy was found.
if test -n "$OBJCOPY"; then
BASIC_FIXUP_EXECUTABLE(OBJCOPY)
+ if test "x$OPENJDK_BUILD_OS" = xsolaris; then
+ # objcopy prior to 2.21.1 on solaris is broken and is not usable.
+ # Rewrite objcopy version output to VALID_VERSION or BAD_VERSION.
+ # - version number is last blank separate word on first line
+ # - version number formats that have been seen:
+ # - <major>.<minor>
+ # - <major>.<minor>.<micro>
+ OBJCOPY_VERSION=`$OBJCOPY --version | $HEAD -n 1`
+ # The outer [ ] is to prevent m4 from eating the [] in the sed expression.
+ [ OBJCOPY_VERSION_CHECK=`$ECHO $OBJCOPY_VERSION | $SED -n \
+ -e 's/.* //' \
+ -e '/^[01]\./b bad' \
+ -e '/^2\./{' \
+ -e ' s/^2\.//' \
+ -e ' /^[0-9]$/b bad' \
+ -e ' /^[0-9]\./b bad' \
+ -e ' /^1[0-9]$/b bad' \
+ -e ' /^1[0-9]\./b bad' \
+ -e ' /^20\./b bad' \
+ -e ' /^21\.0$/b bad' \
+ -e ' /^21\.0\./b bad' \
+ -e '}' \
+ -e ':good' \
+ -e 's/.*/VALID_VERSION/p' \
+ -e 'q' \
+ -e ':bad' \
+ -e 's/.*/BAD_VERSION/p' \
+ -e 'q'` ]
+ if test "x$OBJCOPY_VERSION_CHECK" = xBAD_VERSION; then
+ OBJCOPY=
+ AC_MSG_WARN([Ignoring found objcopy since it is broken (prior to 2.21.1). No debug symbols will be generated.])
+ AC_MSG_NOTICE([objcopy reports version $OBJCOPY_VERSION])
+ AC_MSG_NOTICE([Note: patch 149063-01 or newer contains the correct Solaris 10 SPARC version])
+ AC_MSG_NOTICE([Note: patch 149064-01 or newer contains the correct Solaris 10 X86 version])
+ AC_MSG_NOTICE([Note: Solaris 11 Update 1 contains the correct version])
+ fi
+ fi
fi
fi
--- a/corba/.hgtags Tue Sep 15 15:49:30 2015 +0200
+++ b/corba/.hgtags Thu Sep 17 09:19:40 2015 -0700
@@ -323,3 +323,4 @@
182bb7accc5253bcfefd8edc1d4997ec8f9f8694 jdk9-b78
4ab250b8fac66ef8cd15ee78c40f0c651c96e16a jdk9-b79
821a0373ef2d1642a9824facb938b901ad010413 jdk9-b80
+45c35b7f5b40d5af0085e4a7b3a4d6e3e0347c35 jdk9-b81
--- a/hotspot/.hgtags Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/.hgtags Thu Sep 17 09:19:40 2015 -0700
@@ -483,3 +483,4 @@
20dc06b04fe5ec373879414d60ef82ac70faef98 jdk9-b78
e9e63d93bbfe2c6c23447e2c1f5cc71c98671cba jdk9-b79
8e8377739c06b99b9011c003c77e0bef84c91e09 jdk9-b80
+4142c190cd5ca4fb70ec367b4f97ef936272d8ef jdk9-b81
--- a/hotspot/src/share/vm/code/codeCache.cpp Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/src/share/vm/code/codeCache.cpp Thu Sep 17 09:19:40 2015 -0700
@@ -745,13 +745,12 @@
void CodeCache::gc_epilogue() {
assert_locked_or_safepoint(CodeCache_lock);
- NMethodIterator iter;
- while(iter.next()) {
- nmethod* nm = iter.method();
- if (!nm->is_zombie()) {
- if (needs_cache_clean()) {
- // Clean ICs of unloaded nmethods as well because they may reference other
- // unloaded nmethods that may be flushed earlier in the sweeper cycle.
+ NOT_DEBUG(if (needs_cache_clean())) {
+ NMethodIterator iter;
+ while(iter.next_alive()) {
+ nmethod* nm = iter.method();
+ assert(!nm->is_unloaded(), "Tautology");
+ DEBUG_ONLY(if (needs_cache_clean())) {
nm->cleanup_inline_caches();
}
DEBUG_ONLY(nm->verify());
--- a/hotspot/src/share/vm/code/compiledIC.cpp Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/src/share/vm/code/compiledIC.cpp Thu Sep 17 09:19:40 2015 -0700
@@ -287,6 +287,7 @@
assert( is_c1_method ||
!is_monomorphic ||
is_optimized() ||
+ !caller->is_alive() ||
(cached_metadata() != NULL && cached_metadata()->is_klass()), "sanity check");
#endif // ASSERT
return is_monomorphic;
@@ -321,7 +322,7 @@
}
-void CompiledIC::set_to_clean() {
+void CompiledIC::set_to_clean(bool in_use) {
assert(SafepointSynchronize::is_at_safepoint() || CompiledIC_lock->is_locked() , "MT-unsafe call");
if (TraceInlineCacheClearing || TraceICs) {
tty->print_cr("IC@" INTPTR_FORMAT ": set to clean", p2i(instruction_address()));
@@ -337,7 +338,7 @@
// A zombie transition will always be safe, since the metadata has already been set to NULL, so
// we only need to patch the destination
- bool safe_transition = is_optimized() || SafepointSynchronize::is_at_safepoint();
+ bool safe_transition = !in_use || is_optimized() || SafepointSynchronize::is_at_safepoint();
if (safe_transition) {
// Kill any leftover stub we might have too
--- a/hotspot/src/share/vm/code/compiledIC.hpp Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/src/share/vm/code/compiledIC.hpp Thu Sep 17 09:19:40 2015 -0700
@@ -214,7 +214,7 @@
//
// They all takes a TRAP argument, since they can cause a GC if the inline-cache buffer is full.
//
- void set_to_clean();
+ void set_to_clean(bool in_use = true);
void set_to_monomorphic(CompiledICInfo& info);
void clear_ic_stub();
--- a/hotspot/src/share/vm/code/nmethod.cpp Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/src/share/vm/code/nmethod.cpp Thu Sep 17 09:19:40 2015 -0700
@@ -1050,7 +1050,7 @@
if( cb != NULL && cb->is_nmethod() ) {
nmethod* nm = (nmethod*)cb;
// Clean inline caches pointing to zombie, non-entrant and unloaded methods
- if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean();
+ if (!nm->is_in_use() || (nm->method()->code() != nm)) ic->set_to_clean(is_alive());
}
break;
}
@@ -1150,7 +1150,7 @@
// Tell if a non-entrant method can be converted to a zombie (i.e.,
// there are no activations on the stack, not in use by the VM,
// and not in use by the ServiceThread)
-bool nmethod::can_not_entrant_be_converted() {
+bool nmethod::can_convert_to_zombie() {
assert(is_not_entrant(), "must be a non-entrant method");
// Since the nmethod sweeper only does partial sweep the sweeper's traversal
--- a/hotspot/src/share/vm/code/nmethod.hpp Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/src/share/vm/code/nmethod.hpp Thu Sep 17 09:19:40 2015 -0700
@@ -577,7 +577,7 @@
// See comment at definition of _last_seen_on_stack
void mark_as_seen_on_stack();
- bool can_not_entrant_be_converted();
+ bool can_convert_to_zombie();
// Evolution support. We make old (discarded) compiled methods point to new Method*s.
void set_method(Method* method) { _method = method; }
--- a/hotspot/src/share/vm/opto/loopopts.cpp Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/src/share/vm/opto/loopopts.cpp Thu Sep 17 09:19:40 2015 -0700
@@ -673,8 +673,7 @@
Node* PhaseIdealLoop::try_move_store_before_loop(Node* n, Node *n_ctrl) {
// Store has to be first in the loop body
IdealLoopTree *n_loop = get_loop(n_ctrl);
- if (n->is_Store() && n_loop != _ltree_root && n_loop->is_loop()) {
- assert(n->in(0), "store should have control set");
+ if (n->is_Store() && n_loop != _ltree_root && n_loop->is_loop() && n->in(0) != NULL) {
Node* address = n->in(MemNode::Address);
Node* value = n->in(MemNode::ValueIn);
Node* mem = n->in(MemNode::Memory);
@@ -748,8 +747,7 @@
// Try moving a store out of a loop, right after the loop
void PhaseIdealLoop::try_move_store_after_loop(Node* n) {
- if (n->is_Store()) {
- assert(n->in(0), "store should have control set");
+ if (n->is_Store() && n->in(0) != NULL) {
Node *n_ctrl = get_ctrl(n);
IdealLoopTree *n_loop = get_loop(n_ctrl);
// Store must be in a loop
--- a/hotspot/src/share/vm/opto/stringopts.cpp Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/src/share/vm/opto/stringopts.cpp Thu Sep 17 09:19:40 2015 -0700
@@ -1576,51 +1576,58 @@
Node* result;
if (!kit.stopped()) {
+ Node* char_array = NULL;
+ if (sc->num_arguments() == 1 &&
+ (sc->mode(0) == StringConcat::StringMode ||
+ sc->mode(0) == StringConcat::StringNullCheckMode)) {
+ // Handle the case when there is only a single String argument.
+ // In this case, we can just pull the value from the String itself.
+ char_array = kit.load_String_value(kit.control(), sc->argument(0));
+ } else {
+ // length now contains the number of characters needed for the
+ // char[] so create a new AllocateArray for the char[]
+ {
+ PreserveReexecuteState preexecs(&kit);
+ // The original jvms is for an allocation of either a String or
+ // StringBuffer so no stack adjustment is necessary for proper
+ // reexecution. If we deoptimize in the slow path the bytecode
+ // will be reexecuted and the char[] allocation will be thrown away.
+ kit.jvms()->set_should_reexecute(true);
+ char_array = kit.new_array(__ makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_CHAR))),
+ length, 1);
+ }
- // length now contains the number of characters needed for the
- // char[] so create a new AllocateArray for the char[]
- Node* char_array = NULL;
- {
- PreserveReexecuteState preexecs(&kit);
- // The original jvms is for an allocation of either a String or
- // StringBuffer so no stack adjustment is necessary for proper
- // reexecution. If we deoptimize in the slow path the bytecode
- // will be reexecuted and the char[] allocation will be thrown away.
- kit.jvms()->set_should_reexecute(true);
- char_array = kit.new_array(__ makecon(TypeKlassPtr::make(ciTypeArrayKlass::make(T_CHAR))),
- length, 1);
- }
-
- // Mark the allocation so that zeroing is skipped since the code
- // below will overwrite the entire array
- AllocateArrayNode* char_alloc = AllocateArrayNode::Ideal_array_allocation(char_array, _gvn);
- char_alloc->maybe_set_complete(_gvn);
+ // Mark the allocation so that zeroing is skipped since the code
+ // below will overwrite the entire array
+ AllocateArrayNode* char_alloc = AllocateArrayNode::Ideal_array_allocation(char_array, _gvn);
+ char_alloc->maybe_set_complete(_gvn);
- // Now copy the string representations into the final char[]
- Node* start = __ intcon(0);
- for (int argi = 0; argi < sc->num_arguments(); argi++) {
- Node* arg = sc->argument(argi);
- switch (sc->mode(argi)) {
- case StringConcat::IntMode: {
- Node* end = __ AddI(start, string_sizes->in(argi));
- // getChars words backwards so pass the ending point as well as the start
- int_getChars(kit, arg, char_array, start, end);
- start = end;
- break;
+ // Now copy the string representations into the final char[]
+ Node* start = __ intcon(0);
+ for (int argi = 0; argi < sc->num_arguments(); argi++) {
+ Node* arg = sc->argument(argi);
+ switch (sc->mode(argi)) {
+ case StringConcat::IntMode: {
+ Node* end = __ AddI(start, string_sizes->in(argi));
+ // getChars words backwards so pass the ending point as well as the start
+ int_getChars(kit, arg, char_array, start, end);
+ start = end;
+ break;
+ }
+ case StringConcat::StringNullCheckMode:
+ case StringConcat::StringMode: {
+ start = copy_string(kit, arg, char_array, start);
+ break;
+ }
+ case StringConcat::CharMode: {
+ __ store_to_memory(kit.control(), kit.array_element_address(char_array, start, T_CHAR),
+ arg, T_CHAR, char_adr_idx, MemNode::unordered);
+ start = __ AddI(start, __ intcon(1));
+ break;
+ }
+ default:
+ ShouldNotReachHere();
}
- case StringConcat::StringNullCheckMode:
- case StringConcat::StringMode: {
- start = copy_string(kit, arg, char_array, start);
- break;
- }
- case StringConcat::CharMode: {
- __ store_to_memory(kit.control(), kit.array_element_address(char_array, start, T_CHAR),
- arg, T_CHAR, char_adr_idx, MemNode::unordered);
- start = __ AddI(start, __ intcon(1));
- break;
- }
- default:
- ShouldNotReachHere();
}
}
--- a/hotspot/src/share/vm/runtime/sweeper.cpp Tue Sep 15 15:49:30 2015 +0200
+++ b/hotspot/src/share/vm/runtime/sweeper.cpp Thu Sep 17 09:19:40 2015 -0700
@@ -611,7 +611,7 @@
} else if (nm->is_not_entrant()) {
// If there are no current activations of this method on the
// stack we can safely convert it to a zombie method
- if (nm->can_not_entrant_be_converted()) {
+ if (nm->can_convert_to_zombie()) {
// Clear ICStubs to prevent back patching stubs of zombie or unloaded
// nmethods during the next safepoint (see ICStub::finalize).
{
@@ -645,6 +645,12 @@
assert(result == None, "sanity");
result = Flushed;
} else {
+ {
+ // Clean ICs of unloaded nmethods as well because they may reference other
+ // unloaded nmethods that may be flushed earlier in the sweeper cycle.
+ MutexLocker cl(CompiledIC_lock);
+ nm->cleanup_inline_caches();
+ }
// Code cache state change is tracked in make_zombie()
nm->make_zombie();
SWEEP(nm);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/hotspot/test/compiler/TestMoveStoresOutOfLoopsStoreNoCtrl.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,49 @@
+/*
+ * 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.
+ */
+
+/*
+ * @test
+ * @bug 8134288
+ * @summary Store nodes may not have a control if used to update profiling
+ * @run main/othervm -XX:-ProfileInterpreter -XX:-TieredCompilation -XX:-BackgroundCompilation TestMoveStoresOutOfLoopsStoreNoCtrl
+ *
+ */
+
+public class TestMoveStoresOutOfLoopsStoreNoCtrl {
+
+ static void test(boolean flag) {
+ for (int i = 0; i < 20000; i++) {
+ if (flag) {
+ int j = 0;
+ do {
+ j++;
+ } while(j < 10);
+ }
+ }
+ }
+
+ static public void main(String[] args) {
+ test(false);
+ }
+
+}
--- a/jaxp/.hgtags Tue Sep 15 15:49:30 2015 +0200
+++ b/jaxp/.hgtags Thu Sep 17 09:19:40 2015 -0700
@@ -323,3 +323,4 @@
5b1899c9822db4a80a29cac82af492afea9f8f41 jdk9-b78
cf809edc840ff7546677d38b13ebd8b3cae2bbda jdk9-b79
f464f9b2fb1178f6a957e5730b4b5252c6149ed9 jdk9-b80
+6a418934997fc4b56664b88f8417e2f0fe658091 jdk9-b81
--- a/jaxws/.hgtags Tue Sep 15 15:49:30 2015 +0200
+++ b/jaxws/.hgtags Thu Sep 17 09:19:40 2015 -0700
@@ -326,3 +326,4 @@
ac1748bab0743137574be3451307b6a6361719eb jdk9-b78
42ae657e0e104fa7877996b8095f2e3ab1596118 jdk9-b79
e9940bf1c8ddaa6f1f5f1813846b080f0ccaf50b jdk9-b80
+139338618c77d793ab8b550f06819ddb8381316f jdk9-b81
--- a/jdk/.hgtags Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/.hgtags Thu Sep 17 09:19:40 2015 -0700
@@ -323,3 +323,4 @@
0940ce86c614458f5bdd72278b190abbf36b7b45 jdk9-b78
d99c2ffdd0f15753e69126583688f2f075a0a5e8 jdk9-b79
4947810137ae53abba3028cc366af953d90fa81a jdk9-b80
+fdc13a2d32867ca3c57b7fa2620c6b59c83168cb jdk9-b81
--- a/jdk/make/Tools.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/make/Tools.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -159,28 +159,6 @@
##########################################################################################
-# Tools needed on solaris because OBJCOPY is broken.
-
-ifeq ($(OPENJDK_TARGET_OS), solaris)
- $(eval $(call SetupNativeCompilation,ADD_GNU_DEBUGLINK, \
- SRC := $(JDK_TOPDIR)/make/src/native/add_gnu_debuglink, \
- TOOLCHAIN := TOOLCHAIN_BUILD, \
- LDFLAGS := -lelf, \
- OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/add_gnu_debuglink, \
- OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
- PROGRAM := add_gnu_debuglink))
-
- $(eval $(call SetupNativeCompilation,FIX_EMPTY_SEC_HDR_FLAGS, \
- SRC := $(JDK_TOPDIR)/make/src/native/fix_empty_sec_hdr_flags, \
- TOOLCHAIN := TOOLCHAIN_BUILD, \
- LDFLAGS := -lelf, \
- OBJECT_DIR := $(BUILDTOOLS_OUTPUTDIR)/objs/fix_empty_sec_hdr_flags, \
- OUTPUT_DIR := $(BUILDTOOLS_OUTPUTDIR)/bin, \
- PROGRAM := fix_empty_sec_hdr_flags))
-
- BUILD_TOOLS_JDK += $(ADD_GNU_DEBUGLINK) $(FIX_EMPTY_SEC_HDR_FLAGS)
-endif
-
$(BUILD_TOOLS_JDK): $(BUILD_INTERIM_JIMAGE) $(COPY_JIMAGE_SERVICE_PROVIDER)
java-tools: $(BUILD_TOOLS_JDK)
--- a/jdk/make/launcher/LauncherCommon.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/make/launcher/LauncherCommon.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -28,9 +28,6 @@
# Prepare the find cache.
$(eval $(call FillCacheFind, $(JDK_TOPDIR)/src/java.base/share/native/launcher))
-# Build tools
-include Tools.gmk
-
# When building a legacy overlay image (on solaris 64 bit), the launchers
# need to be built with a different rpath and a different output dir.
ifeq ($(OVERLAY_IMAGES), true)
--- a/jdk/make/lib/LibCommon.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/make/lib/LibCommon.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -27,9 +27,6 @@
include MakeBase.gmk
include NativeCompilation.gmk
-# Build tools
-include Tools.gmk
-
GLOBAL_VERSION_INFO_RESOURCE := $(JDK_TOPDIR)/src/java.base/windows/native/common/version.rc
# Absolute paths to lib files on windows for use in LDFLAGS. Should figure out a more
--- a/jdk/make/src/classes/build/tools/cldrconverter/ResourceBundleGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/make/src/classes/build/tools/cldrconverter/ResourceBundleGenerator.java Thu Sep 17 09:19:40 2015 -0700
@@ -266,22 +266,47 @@
out.println((CLDRConverter.isBaseModule ? "package sun.util.cldr;\n\n" :
"package sun.util.resources.cldr.provider;\n\n")
+ "import java.util.HashMap;\n"
+ + "import java.util.Locale;\n"
+ "import java.util.Map;\n"
- + "import java.util.ListResourceBundle;\n"
+ "import sun.util.locale.provider.LocaleProviderAdapter;\n"
+ "import sun.util.locale.provider.LocaleDataMetaInfo;\n");
- out.printf("public class %s extends ListResourceBundle implements LocaleDataMetaInfo {\n", className);
- out.println(" @Override\n" +
- " protected final Object[][] getContents() {\n" +
- " final Object[][] data = new Object[][] {");
+ out.printf("public class %s implements LocaleDataMetaInfo {\n", className);
+ out.println(" private static final Map<String, String> resourceNameToLocales = new HashMap<>();\n" +
+ (CLDRConverter.isBaseModule ?
+ " private static final Map<Locale, String[]> parentLocalesMap = new HashMap<>();\n\n" : "\n") +
+ " static {\n");
+
for (String key : metaInfo.keySet()) {
- out.printf(" { \"%s\",\n", key);
- out.printf(" \"%s\" },\n",
+ if (key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)) {
+ String parentTag = key.substring(CLDRConverter.PARENT_LOCALE_PREFIX.length());
+ if ("root".equals(parentTag)) {
+ out.printf(" parentLocalesMap.put(Locale.ROOT,\n");
+ } else {
+ out.printf(" parentLocalesMap.put(Locale.forLanguageTag(\"%s\"),\n",
+ parentTag);
+ }
+ String[] childlen = toLocaleList(metaInfo.get(key), true).split(" ");
+ out.printf(" new String[] {\n" +
+ " ");
+ int count = 0;
+ for (int i = 0; i < childlen.length; i++) {
+ String child = childlen[i];
+ out.printf("\"%s\", ", child);
+ count += child.length() + 4;
+ if (i != childlen.length - 1 && count > 64) {
+ out.printf("\n ");
+ count = 0;
+ }
+ }
+ out.printf("\n });\n");
+ } else {
+ out.printf(" resourceNameToLocales.put(\"%s\",\n", key);
+ out.printf(" \"%s\");\n",
toLocaleList(key.equals("FormatData") ? metaInfo.get("AvailableLocales") :
- metaInfo.get(key),
- key.startsWith(CLDRConverter.PARENT_LOCALE_PREFIX)));
+ metaInfo.get(key), false));
+ }
}
- out.println(" };\n return data;\n }\n\n");
+ out.println(" }\n\n");
out.println(" @Override\n" +
" public LocaleProviderAdapter.Type getType() {\n" +
@@ -290,19 +315,13 @@
out.println(" @Override\n" +
" public String availableLanguageTags(String category) {\n" +
- " return getString(category);\n" +
- " };\n\n");
+ " return resourceNameToLocales.getOrDefault(category, \"\");\n" +
+ " }\n\n");
if (CLDRConverter.isBaseModule) {
- out.printf(" public Map<String, String> parentLocales() {\n" +
- " Map<String, String> ret = new HashMap<>();\n" +
- " keySet().stream()\n" +
- " .filter(key -> key.startsWith(\"%s\"))\n" +
- " .forEach(key -> ret.put(key.substring(%d), getString(key)));\n" +
- " return ret.isEmpty() ? null : ret;\n" +
- " };\n}",
- CLDRConverter.PARENT_LOCALE_PREFIX,
- CLDRConverter.PARENT_LOCALE_PREFIX.length());
+ out.printf(" public Map<Locale, String[]> parentLocales() {\n" +
+ " return parentLocalesMap;\n" +
+ " }\n}");
} else {
out.println("}");
}
--- a/jdk/make/src/native/add_gnu_debuglink/add_gnu_debuglink.c Tue Sep 15 15:49:30 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,285 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- *
- */
-
-/*
- * Name: add_gnu_debuglink.c
- *
- * Description: Add a ".gnu_debuglink" section that refers to the specified
- * debug_info_path to the specified ELF object.
- *
- * This program is adapted from the example program shown on the
- * elf(3elf) man page and from code from the Solaris compiler
- * driver.
- */
-
-/*
- * needed to define SHF_EXCLUDE
- */
-#define ELF_TARGET_ALL
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <libelf.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-static void failure(void);
-static unsigned int gnu_debuglink_crc32(unsigned int crc, unsigned char *buf,
- size_t len);
-
-void
-main(int argc, char ** argv) {
- /* new ELF section name */
- static char SEC_NAME[] = ".gnu_debuglink";
-
- unsigned char buffer[8 * 1024]; /* I/O buffer */
- int buffer_len; /* buffer length */
- char * debug_info_path; /* debug info path */
- void * ehdr; /* ELF header */
- Elf * elf; /* ELF descriptor */
- char * elf_ident; /* ELF identity string */
- char * elf_obj; /* elf_obj file */
- int fd; /* descriptor for files */
- unsigned int file_crc = 0; /* CRC for debug info file */
- int is_elfclass64; /* is an ELFCLASS64 file? */
- Elf_Data * link_dat; /* ELF data for new debug info link */
- Elf_Data * name_dat; /* ELF data for new section name */
- Elf_Scn * new_scn; /* new ELF section descriptor */
- void * new_shdr; /* new ELF section header */
- Elf_Scn * scn; /* ELF section descriptor */
- void * shdr; /* ELF section header */
-
- if (argc != 3) {
- (void) fprintf(stderr, "Usage: %s debug_info_path elf_obj\n", argv[0]);
- exit(2);
- }
-
- debug_info_path = argv[1]; /* save for later */
- if ((fd = open(debug_info_path, O_RDONLY)) == -1) {
- (void) fprintf(stderr, "%s: cannot open file.\n", debug_info_path);
- exit(3);
- }
-
- (void) printf("Computing CRC for '%s'\n", debug_info_path);
- (void) fflush(stdout);
- /* compute CRC for the debug info file */
- for (;;) {
- int len = read(fd, buffer, sizeof buffer);
- if (len <= 0) {
- break;
- }
- file_crc = gnu_debuglink_crc32(file_crc, buffer, len);
- }
- (void) close(fd);
-
- /* open the elf_obj */
- elf_obj = argv[2];
- if ((fd = open(elf_obj, O_RDWR)) == -1) {
- (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
- exit(4);
- }
-
- (void) printf("Opening '%s' for update\n", elf_obj);
- (void) fflush(stdout);
- (void) elf_version(EV_CURRENT); /* coordinate ELF versions */
-
- /* obtain the ELF descriptors from the input file */
- if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
- failure();
- }
-
- /* determine if ELFCLASS64 or not? */
- elf_ident = elf_getident(elf, NULL);
- is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
-
- /* get the ELF header */
- if (is_elfclass64) {
- ehdr = elf64_getehdr(elf);
- } else {
- ehdr = elf32_getehdr(elf);
- }
- if (ehdr == NULL) {
- failure();
- }
-
- /* get the ELF section descriptor */
- if (is_elfclass64) {
- scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
- } else {
- scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
- }
- if (scn == NULL) {
- failure();
- }
-
- /* get the section header */
- if (is_elfclass64) {
- shdr = elf64_getshdr(scn);
- } else {
- shdr = elf32_getshdr(scn);
- }
- if (shdr == NULL) {
- failure();
- }
-
- (void) printf("Adding ELF data for new section name\n");
- (void) fflush(stdout);
- name_dat = elf_newdata(scn);
- name_dat->d_buf = (void *) SEC_NAME;
- if (is_elfclass64) {
- name_dat->d_off = ((Elf64_Shdr *) shdr)->sh_size + 1;
- } else {
- name_dat->d_off = ((Elf32_Shdr *) shdr)->sh_size + 1;
- }
- name_dat->d_align = 1;
- name_dat->d_size = strlen(SEC_NAME) + 1;
-
- new_scn = elf_newscn(elf);
-
- if (is_elfclass64) {
- new_shdr = elf64_getshdr(new_scn);
- ((Elf64_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
- ((Elf64_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
- ((Elf64_Shdr *) new_shdr)->sh_name = ((Elf64_Shdr *) shdr)->sh_size;
- ((Elf64_Shdr *) new_shdr)->sh_addralign = 1;
- ((Elf64_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
- } else {
- new_shdr = elf32_getshdr(new_scn);
- ((Elf32_Shdr *) new_shdr)->sh_flags = SHF_EXCLUDE;
- ((Elf32_Shdr *) new_shdr)->sh_type = SHT_PROGBITS;
- ((Elf32_Shdr *) new_shdr)->sh_name = ((Elf32_Shdr *) shdr)->sh_size;
- ((Elf32_Shdr *) new_shdr)->sh_addralign = 1;
- ((Elf32_Shdr *) shdr)->sh_size += (strlen(SEC_NAME) + 1);
- }
-
- (void) printf("Adding ELF data for debug_info_path value\n");
- (void) fflush(stdout);
- (void) memset(buffer, 0, sizeof buffer);
- buffer_len = strlen(debug_info_path) + 1; /* +1 for NUL */
- (void) strncpy((char *) buffer, debug_info_path, buffer_len);
- if (buffer_len % 4 != 0) {
- /* not on a 4 byte boundary so pad to the next one */
- buffer_len += (4 - buffer_len % 4);
- }
- /* save the CRC */
- (void) memcpy(&buffer[buffer_len], &file_crc, sizeof file_crc);
- buffer_len += sizeof file_crc;
-
- link_dat = elf_newdata(new_scn);
- link_dat->d_type = ELF_T_BYTE;
- link_dat->d_size = buffer_len;
- link_dat->d_buf = buffer;
- link_dat->d_align = 1;
-
- (void) printf("Saving updates to '%s'\n", elf_obj);
- (void) fflush(stdout);
- (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
- (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
- (void) elf_end(elf); /* done with ELF obj */
- (void) close(fd);
-
- (void) printf("Done updating '%s'\n", elf_obj);
- (void) fflush(stdout);
- exit(0);
-} /* end main */
-
-
-static void
-failure() {
- (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
- exit(5);
-}
-
-
-/*
- * The CRC used in gnu_debuglink, retrieved from
- * http://sourceware.org/gdb/current/onlinedocs/gdb/Separate-Debug-Files.html#Separate-Debug-Files.
- */
-
-static unsigned int
-gnu_debuglink_crc32(unsigned int crc, unsigned char *buf, size_t len) {
- static const unsigned int crc32_table[256] = {
- 0x00000000, 0x77073096, 0xee0e612c, 0x990951ba, 0x076dc419,
- 0x706af48f, 0xe963a535, 0x9e6495a3, 0x0edb8832, 0x79dcb8a4,
- 0xe0d5e91e, 0x97d2d988, 0x09b64c2b, 0x7eb17cbd, 0xe7b82d07,
- 0x90bf1d91, 0x1db71064, 0x6ab020f2, 0xf3b97148, 0x84be41de,
- 0x1adad47d, 0x6ddde4eb, 0xf4d4b551, 0x83d385c7, 0x136c9856,
- 0x646ba8c0, 0xfd62f97a, 0x8a65c9ec, 0x14015c4f, 0x63066cd9,
- 0xfa0f3d63, 0x8d080df5, 0x3b6e20c8, 0x4c69105e, 0xd56041e4,
- 0xa2677172, 0x3c03e4d1, 0x4b04d447, 0xd20d85fd, 0xa50ab56b,
- 0x35b5a8fa, 0x42b2986c, 0xdbbbc9d6, 0xacbcf940, 0x32d86ce3,
- 0x45df5c75, 0xdcd60dcf, 0xabd13d59, 0x26d930ac, 0x51de003a,
- 0xc8d75180, 0xbfd06116, 0x21b4f4b5, 0x56b3c423, 0xcfba9599,
- 0xb8bda50f, 0x2802b89e, 0x5f058808, 0xc60cd9b2, 0xb10be924,
- 0x2f6f7c87, 0x58684c11, 0xc1611dab, 0xb6662d3d, 0x76dc4190,
- 0x01db7106, 0x98d220bc, 0xefd5102a, 0x71b18589, 0x06b6b51f,
- 0x9fbfe4a5, 0xe8b8d433, 0x7807c9a2, 0x0f00f934, 0x9609a88e,
- 0xe10e9818, 0x7f6a0dbb, 0x086d3d2d, 0x91646c97, 0xe6635c01,
- 0x6b6b51f4, 0x1c6c6162, 0x856530d8, 0xf262004e, 0x6c0695ed,
- 0x1b01a57b, 0x8208f4c1, 0xf50fc457, 0x65b0d9c6, 0x12b7e950,
- 0x8bbeb8ea, 0xfcb9887c, 0x62dd1ddf, 0x15da2d49, 0x8cd37cf3,
- 0xfbd44c65, 0x4db26158, 0x3ab551ce, 0xa3bc0074, 0xd4bb30e2,
- 0x4adfa541, 0x3dd895d7, 0xa4d1c46d, 0xd3d6f4fb, 0x4369e96a,
- 0x346ed9fc, 0xad678846, 0xda60b8d0, 0x44042d73, 0x33031de5,
- 0xaa0a4c5f, 0xdd0d7cc9, 0x5005713c, 0x270241aa, 0xbe0b1010,
- 0xc90c2086, 0x5768b525, 0x206f85b3, 0xb966d409, 0xce61e49f,
- 0x5edef90e, 0x29d9c998, 0xb0d09822, 0xc7d7a8b4, 0x59b33d17,
- 0x2eb40d81, 0xb7bd5c3b, 0xc0ba6cad, 0xedb88320, 0x9abfb3b6,
- 0x03b6e20c, 0x74b1d29a, 0xead54739, 0x9dd277af, 0x04db2615,
- 0x73dc1683, 0xe3630b12, 0x94643b84, 0x0d6d6a3e, 0x7a6a5aa8,
- 0xe40ecf0b, 0x9309ff9d, 0x0a00ae27, 0x7d079eb1, 0xf00f9344,
- 0x8708a3d2, 0x1e01f268, 0x6906c2fe, 0xf762575d, 0x806567cb,
- 0x196c3671, 0x6e6b06e7, 0xfed41b76, 0x89d32be0, 0x10da7a5a,
- 0x67dd4acc, 0xf9b9df6f, 0x8ebeeff9, 0x17b7be43, 0x60b08ed5,
- 0xd6d6a3e8, 0xa1d1937e, 0x38d8c2c4, 0x4fdff252, 0xd1bb67f1,
- 0xa6bc5767, 0x3fb506dd, 0x48b2364b, 0xd80d2bda, 0xaf0a1b4c,
- 0x36034af6, 0x41047a60, 0xdf60efc3, 0xa867df55, 0x316e8eef,
- 0x4669be79, 0xcb61b38c, 0xbc66831a, 0x256fd2a0, 0x5268e236,
- 0xcc0c7795, 0xbb0b4703, 0x220216b9, 0x5505262f, 0xc5ba3bbe,
- 0xb2bd0b28, 0x2bb45a92, 0x5cb36a04, 0xc2d7ffa7, 0xb5d0cf31,
- 0x2cd99e8b, 0x5bdeae1d, 0x9b64c2b0, 0xec63f226, 0x756aa39c,
- 0x026d930a, 0x9c0906a9, 0xeb0e363f, 0x72076785, 0x05005713,
- 0x95bf4a82, 0xe2b87a14, 0x7bb12bae, 0x0cb61b38, 0x92d28e9b,
- 0xe5d5be0d, 0x7cdcefb7, 0x0bdbdf21, 0x86d3d2d4, 0xf1d4e242,
- 0x68ddb3f8, 0x1fda836e, 0x81be16cd, 0xf6b9265b, 0x6fb077e1,
- 0x18b74777, 0x88085ae6, 0xff0f6a70, 0x66063bca, 0x11010b5c,
- 0x8f659eff, 0xf862ae69, 0x616bffd3, 0x166ccf45, 0xa00ae278,
- 0xd70dd2ee, 0x4e048354, 0x3903b3c2, 0xa7672661, 0xd06016f7,
- 0x4969474d, 0x3e6e77db, 0xaed16a4a, 0xd9d65adc, 0x40df0b66,
- 0x37d83bf0, 0xa9bcae53, 0xdebb9ec5, 0x47b2cf7f, 0x30b5ffe9,
- 0xbdbdf21c, 0xcabac28a, 0x53b39330, 0x24b4a3a6, 0xbad03605,
- 0xcdd70693, 0x54de5729, 0x23d967bf, 0xb3667a2e, 0xc4614ab8,
- 0x5d681b02, 0x2a6f2b94, 0xb40bbe37, 0xc30c8ea1, 0x5a05df1b,
- 0x2d02ef8d
- };
-
- unsigned char *end;
-
- crc = ~crc & 0xffffffff;
- for (end = buf + len; buf < end; ++buf) {
- crc = crc32_table[(crc ^ *buf) & 0xff] ^ (crc >> 8);
- }
- return ~crc & 0xffffffff;
-}
--- a/jdk/make/src/native/fix_empty_sec_hdr_flags/fix_empty_sec_hdr_flags.c Tue Sep 15 15:49:30 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,181 +0,0 @@
-/*
- * Copyright (c) 2012, 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.
- *
- * 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.
- *
- */
-
-/*
- * Name: fix_empty_sec_hdr_flags.c
- *
- * Description: Remove the SHF_ALLOC flag from "empty" section headers.
- * An "empty" section header has sh_addr == 0 and sh_size == 0.
- *
- * This program is adapted from the example program shown on the
- * elf(3elf) man page and from code from the Solaris compiler
- * driver.
- */
-
-#include <fcntl.h>
-#include <stdio.h>
-#include <libelf.h>
-#include <stdlib.h>
-#include <string.h>
-#include <unistd.h>
-
-static void failure(void);
-
-void
-main(int argc, char ** argv) {
- void * ehdr; /* ELF header */
- unsigned int i; /* section counter */
- int fd; /* descriptor for file */
- Elf * elf; /* ELF descriptor */
- char * elf_ident; /* ELF identity string */
- char * elf_obj; /* elf_obj file */
- int fix_count; /* number of flags fixed */
- int is_elfclass64; /* is an ELFCLASS64 file? */
- Elf_Scn * scn; /* ELF section descriptor */
- void * shdr; /* ELF section header */
- Elf_Data * shstrtab; /* ELF section header string table */
-
- if (argc != 2) {
- (void) fprintf(stderr, "Usage: %s elf_obj\n", argv[0]);
- exit(2);
- }
-
- /* open the elf_obj */
- elf_obj = argv[1];
- if ((fd = open(elf_obj, O_RDWR)) == -1) {
- (void) fprintf(stderr, "%s: cannot open file.\n", elf_obj);
- exit(3);
- }
-
- (void) printf("Opening '%s' for update\n", elf_obj);
- (void) fflush(stdout);
- (void) elf_version(EV_CURRENT); /* coordinate ELF versions */
-
- /* obtain the ELF descriptors from the input file */
- if ((elf = elf_begin(fd, ELF_C_RDWR, NULL)) == NULL) {
- failure();
- }
-
- /* determine if ELFCLASS64 or not? */
- elf_ident = elf_getident(elf, NULL);
- is_elfclass64 = (elf_ident[EI_CLASS] == ELFCLASS64);
-
- /* get the ELF header */
- if (is_elfclass64) {
- ehdr = elf64_getehdr(elf);
- } else {
- ehdr = elf32_getehdr(elf);
- }
- if (ehdr == NULL) {
- failure();
- }
-
- /* get the ELF section descriptor */
- if (is_elfclass64) {
- scn = elf_getscn(elf, ((Elf64_Ehdr *) ehdr)->e_shstrndx);
- } else {
- scn = elf_getscn(elf, ((Elf32_Ehdr *) ehdr)->e_shstrndx);
- }
- if (scn == NULL) {
- failure();
- }
-
- /* get the section header string table */
- shstrtab = elf_getdata(scn, NULL);
- if (shstrtab == NULL) {
- failure();
- }
-
- fix_count = 0;
-
- /* traverse the sections of the input file */
- for (i = 1, scn = NULL; scn = elf_nextscn(elf, scn); i++) {
- int has_flag_set; /* is SHF_ALLOC flag set? */
- int is_empty; /* is section empty? */
- char * name; /* short hand pointer */
-
- /* get the section header */
- if (is_elfclass64) {
- shdr = elf64_getshdr(scn);
- } else {
- shdr = elf32_getshdr(scn);
- }
- if (shdr == NULL) {
- failure();
- }
-
- if (is_elfclass64) {
- name = (char *)shstrtab->d_buf + ((Elf64_Shdr *) shdr)->sh_name;
- } else {
- name = (char *)shstrtab->d_buf + ((Elf32_Shdr *) shdr)->sh_name;
- }
-
- if (is_elfclass64) {
- has_flag_set = ((Elf64_Shdr *) shdr)->sh_flags & SHF_ALLOC;
- is_empty = ((Elf64_Shdr *) shdr)->sh_addr == 0 &&
- ((Elf64_Shdr *) shdr)->sh_size == 0;
- } else {
- has_flag_set = ((Elf32_Shdr *) shdr)->sh_flags & SHF_ALLOC;
- is_empty = ((Elf32_Shdr *) shdr)->sh_addr == 0 &&
- ((Elf32_Shdr *) shdr)->sh_size == 0;
- }
-
- if (is_empty && has_flag_set) {
- (void) printf("section[%u] '%s' is empty, "
- "but SHF_ALLOC flag is set.\n", i, name);
- (void) printf("Clearing the SHF_ALLOC flag.\n");
-
- if (is_elfclass64) {
- ((Elf64_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
- } else {
- ((Elf32_Shdr *) shdr)->sh_flags &= ~SHF_ALLOC;
- }
- fix_count++;
- }
- } /* end for each ELF section */
-
- if (fix_count > 0) {
- (void) printf("Saving %d updates to '%s'\n", fix_count, elf_obj);
- (void) fflush(stdout);
- (void) elf_update(elf, ELF_C_NULL); /* recalc ELF memory structures */
- (void) elf_update(elf, ELF_C_WRITE); /* write out changes to ELF obj */
- } else {
- (void) printf("No SHF_ALLOC flags needed to be cleared.\n");
- }
-
- (void) elf_end(elf); /* done with ELF obj */
- (void) close(fd);
-
- (void) printf("Done %s '%s'\n",
- (fix_count > 0) ? "updating" : "with", elf_obj);
- (void) fflush(stdout);
- exit(0);
-} /* end main */
-
-
-static void
-failure() {
- (void) fprintf(stderr, "%s\n", elf_errmsg(elf_errno()));
- exit(6);
-}
--- a/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/linux/native/libjava/ProcessHandleImpl_linux.c Thu Sep 17 09:19:40 2015 -0700
@@ -141,17 +141,21 @@
struct stat stat_buf;
/*
+ * Stat /proc/<pid> to get the user id
+ */
+ snprintf(fn, sizeof fn, "/proc/%d", pid);
+ if (stat(fn, &stat_buf) == 0) {
+ unix_getUserInfo(env, jinfo, stat_buf.st_uid);
+ }
+
+ /*
* Try to open /proc/<pid>/cmdline
*/
- snprintf(fn, sizeof fn, "/proc/%d/cmdline", pid);
+ strncat(fn, "/cmdline", sizeof fn - strnlen(fn, sizeof fn) - 1);
if ((fd = open(fn, O_RDONLY)) < 0) {
return;
}
- if (fstat(fd, &stat_buf) == 0) {
- unix_getUserInfo(env, jinfo, stat_buf.st_uid);
- }
-
do { // Block to break out of on errors
int i, truncated = 0;
int count;
--- a/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/macosx/classes/java/net/DefaultInterface.java Thu Sep 17 09:19:40 2015 -0700
@@ -42,7 +42,7 @@
class DefaultInterface {
- private final static NetworkInterface defaultInterface =
+ private static final NetworkInterface defaultInterface =
chooseDefaultInterface();
static NetworkInterface getDefault() {
--- a/jdk/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/macosx/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/macosx/native/libosxsecurity/KeystoreImpl.m Thu Sep 17 09:19:40 2015 -0700
@@ -508,7 +508,7 @@
SecKeychainRef defaultKeychain = NULL;
SecKeychainCopyDefault(&defaultKeychain);
- SecExternalItemType dataType = (isCertificate == JNI_TRUE ? kSecFormatX509Cert : kSecFormatWrappedPKCS8);
+ SecExternalFormat dataFormat = (isCertificate == JNI_TRUE ? kSecFormatX509Cert : kSecFormatWrappedPKCS8);
// Convert the password obj into a CFStringRef that the keychain importer can use for encryption.
SecKeyImportExportParameters paramBlock;
@@ -533,7 +533,7 @@
paramBlock.keyUsage = CSSM_KEYUSE_ANY;
paramBlock.keyAttributes = CSSM_KEYATTR_RETURN_DEFAULT;
- err = SecKeychainItemImport(cfDataToImport, NULL, &dataType, NULL,
+ err = SecKeychainItemImport(cfDataToImport, NULL, &dataFormat, NULL,
0, ¶mBlock, defaultKeychain, &createdItems);
if (err == noErr) {
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/JceKeyStore.java Thu Sep 17 09:19:40 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"));
}
}
}
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Crypt.java Thu Sep 17 09:19:40 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,
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RC2Parameters.java Thu Sep 17 09:19:40 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,
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/RSACipher.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsKeyMaterialGenerator.java Thu Sep 17 09:19:40 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")
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsMasterSecretGenerator.java Thu Sep 17 09:19:40 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")
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsPrfGenerator.java Thu Sep 17 09:19:40 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);
}
--- a/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/crypto/provider/TlsRsaPremasterSecretGenerator.java Thu Sep 17 09:19:40 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")
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Attribute.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/BandStructure.java Thu Sep 17 09:19:40 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<Coding, Integer> basicCodingIndexes;
+ private static final Map<Coding, Integer> 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++) {
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Code.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Coding.java Thu Sep 17 09:19:40 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);
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/CodingChooser.java Thu Sep 17 09:19:40 2015 -0700
@@ -1139,7 +1139,7 @@
}
}
- static private
+ private static
String pct(double num, double den) {
return (Math.round((num / den)*10000)/100.0)+"%";
}
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/ConstantPool.java Thu Sep 17 09:19:40 2015 -0700
@@ -194,7 +194,7 @@
/** Entries in the constant pool. */
- public static abstract
+ public abstract static
class Entry implements Comparable<Object> {
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();
}
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Constants.java Thu Sep 17 09:19:40 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<Object> 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<Object> 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 "<init>". 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;
}
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Driver.java Thu Sep 17 09:19:40 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();
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Histogram.java Thu Sep 17 09:19:40 2015 -0700
@@ -218,7 +218,7 @@
return sum;
}
- static private
+ private static
double round(double x, double scale) {
return Math.round(x * scale) / scale;
}
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Instruction.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/NativeUnpack.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Package.java Thu Sep 17 09:19:40 2015 -0700
@@ -990,7 +990,7 @@
}
// Helper for building InnerClasses attributes.
- static private
+ private static
void visitInnerClassRefs(Collection<InnerClass> innerClasses, int mode, Collection<Entry> refs) {
if (innerClasses == null) {
return; // no attribute; nothing to do
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/PackageReader.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/java/util/jar/pack/Utils.java Thu Sep 17 09:19:40 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(); }
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/HttpsURLConnection.java Thu Sep 17 09:19:40 2015 -0700
@@ -46,7 +46,7 @@
* replaced by {@link javax.net.ssl.HttpsURLConnection}.
*/
@Deprecated
-abstract public
+public abstract
class HttpsURLConnection extends HttpURLConnection
{
/*
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/KeyManagerFactory.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/net/ssl/TrustManagerFactory.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/security/cert/internal/x509/X509V1CertImpl.java Thu Sep 17 09:19:40 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
{
--- a/jdk/src/java.base/share/classes/com/sun/security/ntlm/Client.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/security/ntlm/Client.java Thu Sep 17 09:19:40 2015 -0700
@@ -43,8 +43,8 @@
* </pre>
*/
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;
--- a/jdk/src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/security/ntlm/NTLMException.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/com/sun/security/ntlm/Server.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/com/sun/security/ntlm/Server.java Thu Sep 17 09:19:40 2015 -0700
@@ -49,8 +49,8 @@
* </pre>
*/
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:
--- a/jdk/src/java.base/share/classes/java/io/Console.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/Console.java Thu Sep 17 09:19:40 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();
--- a/jdk/src/java.base/share/classes/java/io/DataInputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/DataInputStream.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/io/File.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/File.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/io/FilePermission.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/FilePermission.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/ObjectInputStream.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/ObjectOutputStream.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamClass.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/io/ObjectStreamConstants.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/ObjectStreamConstants.java Thu Sep 17 09:19:40 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. <p>
@@ -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;
}
--- a/jdk/src/java.base/share/classes/java/io/Reader.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/Reader.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/java/io/Writer.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/io/Writer.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/java/lang/Class.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Class.java Thu Sep 17 09:19:40 2015 -0700
@@ -469,8 +469,8 @@
return null;
}
}
- private volatile transient Constructor<T> cachedConstructor;
- private volatile transient Class<?> newInstanceCallerCache;
+ private transient volatile Constructor<T> 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<T>> reflectionData;
+ private transient volatile SoftReference<ReflectionData<T>> 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<T> 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<String, T> enumConstantDirectory = null;
+ private transient volatile Map<String, T> 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);
--- a/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/ClassLoader.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/ConditionalSpecialCasing.java Thu Sep 17 09:19:40 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 = {
--- a/jdk/src/java.base/share/classes/java/lang/Integer.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Integer.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/lang/Package.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Package.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/ProcessBuilder.java Thu Sep 17 09:19:40 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}.
*/
--- a/jdk/src/java.base/share/classes/java/lang/StringCoding.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/StringCoding.java Thu Sep 17 09:19:40 2015 -0700
@@ -52,9 +52,9 @@
private StringCoding() { }
/** The cached coders for each thread */
- private final static ThreadLocal<SoftReference<StringDecoder>> decoder =
+ private static final ThreadLocal<SoftReference<StringDecoder>> decoder =
new ThreadLocal<>();
- private final static ThreadLocal<SoftReference<StringEncoder>> encoder =
+ private static final ThreadLocal<SoftReference<StringEncoder>> encoder =
new ThreadLocal<>();
private static boolean warnUnsupportedCharset = true;
--- a/jdk/src/java.base/share/classes/java/lang/System.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/System.java Thu Sep 17 09:19:40 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 <code>out</code>, 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.
*/
--- a/jdk/src/java.base/share/classes/java/lang/Thread.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/Thread.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/lang/VirtualMachineError.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/VirtualMachineError.java Thu Sep 17 09:19:40 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;
/**
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DelegatingMethodHandle.java Thu Sep 17 09:19:40 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);
--- a/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/DirectMethodHandle.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/InvokerBytecodeGenerator.java Thu Sep 17 09:19:40 2015 -0700
@@ -140,9 +140,9 @@
/** instance counters for dumped classes */
- private final static HashMap<String,Integer> DUMP_CLASS_FILES_COUNTERS;
+ private static final HashMap<String,Integer> 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,
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandleNatives.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodHandles.java Thu Sep 17 09:19:40 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
* <a href="MethodHandle.html#maxarity">too many parameters</a>
*/
- 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
* <a href="MethodHandle.html#maxarity">too many parameters</a>
*/
- 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
* <a href="MethodHandle.html#maxarity">too many parameters</a>
*/
- 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;
--- a/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/invoke/MethodTypeForm.java Thu Sep 17 09:19:40 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<MethodHandle> 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<LambdaForm> entry = lambdaForms[which];
if (entry != null) {
--- a/jdk/src/java.base/share/classes/java/lang/ref/Reference.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/ref/Reference.java Thu Sep 17 09:19:40 2015 -0700
@@ -107,7 +107,7 @@
* pending: next element in the pending list (or null if last)
* otherwise: NULL
*/
- transient private Reference<T> discovered; /* used by VM */
+ private transient Reference<T> 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();
--- a/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/ref/ReferenceQueue.java Thu Sep 17 09:19:40 2015 -0700
@@ -51,7 +51,7 @@
static ReferenceQueue<Object> NULL = new Null<>();
static ReferenceQueue<Object> ENQUEUED = new Null<>();
- static private class Lock { };
+ private static class Lock { };
private Lock lock = new Lock();
private volatile Reference<? extends T> head = null;
private long queueLength = 0;
--- a/jdk/src/java.base/share/classes/java/lang/ref/SoftReference.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/ref/SoftReference.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/lang/reflect/AccessibleObject.java Thu Sep 17 09:19:40 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");
/**
--- a/jdk/src/java.base/share/classes/java/math/BigDecimal.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/math/BigDecimal.java Thu Sep 17 09:19:40 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',
--- a/jdk/src/java.base/share/classes/java/math/BigInteger.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/math/BigInteger.java Thu Sep 17 09:19:40 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];
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainDatagramSocketImpl.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/AbstractPlainSocketImpl.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/java/net/Authenticator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/Authenticator.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/net/ContentHandler.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/ContentHandler.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/net/CookieHandler.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/CookieHandler.java Thu Sep 17 09:19:40 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);
--- a/jdk/src/java.base/share/classes/java/net/CookieManager.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/CookieManager.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/java/net/DatagramPacket.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/DatagramPacket.java Thu Sep 17 09:19:40 2015 -0700
@@ -384,5 +384,5 @@
/**
* Perform class load-time initializations.
*/
- private native static void init();
+ private static native void init();
}
--- a/jdk/src/java.base/share/classes/java/net/HostPortrange.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/HostPortrange.java Thu Sep 17 09:19:40 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")) {
--- a/jdk/src/java.base/share/classes/java/net/HttpCookie.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/HttpCookie.java Thu Sep 17 09:19:40 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 --------------
--- a/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/HttpURLConnection.java Thu Sep 17 09:19:40 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 */
/**
--- a/jdk/src/java.base/share/classes/java/net/Inet4Address.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/Inet4Address.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/net/Inet6Address.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/Inet6Address.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/java/net/NetworkInterface.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/NetworkInterface.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/java/net/Proxy.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/Proxy.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/java.base/share/classes/java/net/ResponseCache.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/ResponseCache.java Thu Sep 17 09:19:40 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);
--- a/jdk/src/java.base/share/classes/java/net/SocketInputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/SocketInputStream.java Thu Sep 17 09:19:40 2015 -0700
@@ -287,5 +287,5 @@
/**
* Perform class load-time initializations.
*/
- private native static void init();
+ private static native void init();
}
--- a/jdk/src/java.base/share/classes/java/net/SocketOptions.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/SocketOptions.java Thu Sep 17 09:19:40 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:
* <PRE>
@@ -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;
}
--- a/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/SocketOutputStream.java Thu Sep 17 09:19:40 2015 -0700
@@ -178,6 +178,6 @@
/**
* Perform class load-time initializations.
*/
- private native static void init();
+ private static native void init();
}
--- a/jdk/src/java.base/share/classes/java/net/SocketPermission.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/SocketPermission.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/net/URI.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/URI.java Thu Sep 17 09:19:40 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'
};
--- a/jdk/src/java.base/share/classes/java/net/URLConnection.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/URLConnection.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/net/URLStreamHandler.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/nio/Bits.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/nio/Bits.java Thu Sep 17 09:19:40 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) |
--- a/jdk/src/java.base/share/classes/java/nio/channels/Pipe.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/nio/channels/Pipe.java Thu Sep 17 09:19:40 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
{
--- a/jdk/src/java.base/share/classes/java/nio/charset/CoderResult.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/nio/charset/CoderResult.java Thu Sep 17 09:19:40 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<Integer,WeakReference<CoderResult>> cache = null;
--- a/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/AlgorithmParameterGenerator.java Thu Sep 17 09:19:40 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:
* <ul>
- * <li>{@code DiffieHellman} (1024)</li>
- * <li>{@code DSA} (1024)</li>
+ * <li>{@code DiffieHellman} (1024, 2048, 4096)</li>
+ * <li>{@code DSA} (1024, 2048)</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#AlgorithmParameterGenerator">
--- a/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/KeyPairGenerator.java Thu Sep 17 09:19:40 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:
* <ul>
- * <li>{@code DiffieHellman} (1024)</li>
- * <li>{@code DSA} (1024)</li>
- * <li>{@code RSA} (1024, 2048)</li>
+ * <li>{@code DiffieHellman} (1024, 2048, 4096)</li>
+ * <li>{@code DSA} (1024, 2048)</li>
+ * <li>{@code RSA} (1024, 2048, 4096)</li>
* </ul>
* These algorithms are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#KeyPairGenerator">
@@ -547,9 +547,9 @@
private Iterator<Service> 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;
--- a/jdk/src/java.base/share/classes/java/security/KeyStore.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/KeyStore.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/security/Provider.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/Provider.java Thu Sep 17 09:19:40 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)) {
--- a/jdk/src/java.base/share/classes/java/security/SecureRandom.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/SecureRandom.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/security/Signature.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/Signature.java Thu Sep 17 09:19:40 2015 -0700
@@ -102,6 +102,7 @@
* following standard {@code Signature} algorithms:
* <ul>
* <li>{@code SHA1withDSA}</li>
+ * <li>{@code SHA256withDSA}</li>
* <li>{@code SHA1withRSA}</li>
* <li>{@code SHA256withRSA}</li>
* </ul>
@@ -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<ServiceId> rsaIds = Arrays.asList(
+ private static final List<ServiceId> 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<String,Boolean> signatureInfo;
+ private static final Map<String,Boolean> 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 {
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathBuilder.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathHelperImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathHelperImpl.java Thu Sep 17 09:19:40 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();
}
--- a/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertPathValidator.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/java.base/share/classes/java/security/cert/CertStore.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/cert/CertStore.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/java.base/share/classes/java/security/cert/X509CertSelector.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/security/cert/X509CertSelector.java Thu Sep 17 09:19:40 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 {
--- a/jdk/src/java.base/share/classes/java/text/AttributedString.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/AttributedString.java Thu Sep 17 09:19:40 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<Attribute,Object> {
+ private final class AttributeMap extends AbstractMap<Attribute,Object> {
int runIndex;
int beginIndex;
--- a/jdk/src/java.base/share/classes/java/text/CollationElementIterator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/CollationElementIterator.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/text/CollationKey.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/CollationKey.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/java/text/Collator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/Collator.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/java/text/DateFormat.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/DateFormat.java Thu Sep 17 09:19:40 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);
}
}
--- a/jdk/src/java.base/share/classes/java/text/MessageFormat.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/MessageFormat.java Thu Sep 17 09:19:40 2015 -0700
@@ -1168,7 +1168,7 @@
* indicating the index in the <code>arguments</code> 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");
}
--- a/jdk/src/java.base/share/classes/java/text/NumberFormat.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/NumberFormat.java Thu Sep 17 09:19:40 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);
}
--- a/jdk/src/java.base/share/classes/java/text/RBCollationTables.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/RBCollationTables.java Thu Sep 17 09:19:40 2015 -0700
@@ -258,7 +258,7 @@
}
}
- final static int getEntry(Vector<EntryPair> list, String name, boolean fwd) {
+ static final int getEntry(Vector<EntryPair> 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
--- a/jdk/src/java.base/share/classes/java/text/RBTableBuilder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/RBTableBuilder.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/text/RuleBasedCollator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/RuleBasedCollator.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/text/SimpleDateFormat.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/util/AbstractList.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/AbstractList.java Thu Sep 17 09:19:40 2015 -0700
@@ -115,7 +115,7 @@
*
* @throws IndexOutOfBoundsException {@inheritDoc}
*/
- abstract public E get(int index);
+ public abstract E get(int index);
/**
* {@inheritDoc}
--- a/jdk/src/java.base/share/classes/java/util/BitSet.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/BitSet.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/util/Calendar.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Calendar.java Thu Sep 17 09:19:40 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> 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 <code>get</code> and <code>set</code> indicating the
* minute within the hour.
* E.g., at 10:04:15.250 PM the <code>MINUTE</code> is 4.
*/
- public final static int MINUTE = 12;
+ public static final int MINUTE = 12;
/**
* Field number for <code>get</code> and <code>set</code> indicating the
* second within the minute.
* E.g., at 10:04:15.250 PM the <code>SECOND</code> is 15.
*/
- public final static int SECOND = 13;
+ public static final int SECOND = 13;
/**
* Field number for <code>get</code> and <code>set</code> indicating the
* millisecond within the second.
* E.g., at 10:04:15.250 PM the <code>MILLISECOND</code> is 250.
*/
- public final static int MILLISECOND = 14;
+ public static final int MILLISECOND = 14;
/**
* Field number for <code>get</code> and <code>set</code>
@@ -553,7 +553,7 @@
* <code>TimeZone</code> implementation subclass supports
* historical GMT offset changes.
*/
- public final static int ZONE_OFFSET = 15;
+ public static final int ZONE_OFFSET = 15;
/**
* Field number for <code>get</code> and <code>set</code> indicating the
@@ -564,146 +564,146 @@
* <code>TimeZone</code> 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 <code>get</code> and <code>set</code>.
* Field numbers range from <code>0..FIELD_COUNT-1</code>.
*/
- 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 <code>GregorianCalendar</code>
* 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 @@
/**
* <code>True</code> 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 <code>SUNDAY</code>,
@@ -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
--- a/jdk/src/java.base/share/classes/java/util/Comparators.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Comparators.java Thu Sep 17 09:19:40 2015 -0700
@@ -61,7 +61,7 @@
/**
* Null-friendly comparators
*/
- final static class NullComparator<T> implements Comparator<T>, Serializable {
+ static final class NullComparator<T> implements Comparator<T>, Serializable {
private static final long serialVersionUID = -7569533591570686392L;
private final boolean nullFirst;
// if null, non-null Ts are considered equal
--- a/jdk/src/java.base/share/classes/java/util/Currency.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Currency.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/util/Date.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Date.java Thu Sep 17 09:19:40 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");
}
--- a/jdk/src/java.base/share/classes/java/util/Dictionary.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Dictionary.java Thu Sep 17 09:19:40 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<K> keys();
+ public abstract Enumeration<K> 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<V> elements();
+ public abstract Enumeration<V> 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);
}
--- a/jdk/src/java.base/share/classes/java/util/GregorianCalendar.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/GregorianCalendar.java Thu Sep 17 09:19:40 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 <a
--- a/jdk/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/JapaneseImperialCalendar.java Thu Sep 17 09:19:40 2015 -0700
@@ -1551,7 +1551,7 @@
* The fixed date corresponding to jdate. If the value is
* Long.MIN_VALUE, the fixed date value is unknown.
*/
- transient private long cachedFixedDate = Long.MIN_VALUE;
+ private transient long cachedFixedDate = Long.MIN_VALUE;
/**
* Converts the time value (millisecond offset from the <a
--- a/jdk/src/java.base/share/classes/java/util/ListResourceBundle.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/ListResourceBundle.java Thu Sep 17 09:19:40 2015 -0700
@@ -180,7 +180,7 @@
* @return an array of an <code>Object</code> array representing a
* key-value pair.
*/
- abstract protected Object[][] getContents();
+ protected abstract Object[][] getContents();
// ==================privates====================
--- a/jdk/src/java.base/share/classes/java/util/Locale.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Locale.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/util/PropertyPermission.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/PropertyPermission.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/java/util/Random.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Random.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/util/Scanner.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Scanner.java Thu Sep 17 09:19:40 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 @@
* }</pre></blockquote>
*
* <p>The <a name="default-delimiter">default whitespace delimiter</a> 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.
*
* <p>A scanning operation may block waiting for input.
*
* <p>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.
*
- * <p> The {@link #findInLine}, {@link #findWithinHorizon}, and {@link #skip}
+ * <p>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 @@
*
* <p> 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 @@
* <a name="initial-locale">initial locale </a>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
* <a href= "#localized-numbers">localized numbers</a> above.
*
- * <p>If the radix is less than {@code Character.MIN_RADIX}
- * or greater than {@code Character.MAX_RADIX}, then an
+ * <p>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.
*
* <p>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.
*
- * <p>The various {@code next}methods of {@code Scanner}
+ * <p>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
* <a href="#Integer-regex"><i>Integer</i></a> 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 @@
* <p>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 @@
*
* <p> 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.
*
* <p> 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()}.
*
* <p> 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.
+ *
+ * <p>The resulting stream is sequential and ordered. All stream elements are
+ * non-null.
+ *
+ * <p>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 <em>fail-fast</em> and will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if any such calls are detected
+ * during stream pipeline execution.
+ *
+ * <p>After stream pipeline execution completes, this scanner is left in an indeterminate
+ * state and cannot be reused.
+ *
+ * <p>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.
+ *
+ * <p>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:
+ *
+ * <pre>{@code
+ * List<String> result = new Scanner("abc,def,,ghi")
+ * .useDelimiter(",")
+ * .tokens()
+ * .collect(Collectors.toList());
+ * }</pre>
+ *
+ * <p>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<String> tokens() {
+ ensureOpen();
+ Stream<String> stream = StreamSupport.stream(new TokenSpliterator(), false);
+ return stream.onClose(this::close);
+ }
+
+ class TokenSpliterator extends Spliterators.AbstractSpliterator<String> {
+ int expectedCount = -1;
+
+ TokenSpliterator() {
+ super(Long.MAX_VALUE,
+ Spliterator.IMMUTABLE | Spliterator.NONNULL | Spliterator.ORDERED);
+ }
+
+ @Override
+ public boolean tryAdvance(Consumer<? super String> 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.
+ *
+ * <p>The resulting stream is sequential and ordered. All stream elements are
+ * non-null.
+ *
+ * <p>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 <em>fail-fast</em> and will, on a best-effort basis, throw a
+ * {@link java.util.ConcurrentModificationException} if any such calls are detected
+ * during stream pipeline execution.
+ *
+ * <p>After stream pipeline execution completes, this scanner is left in an indeterminate
+ * state and cannot be reused.
+ *
+ * <p>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.
+ *
+ * <p>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:
+ *
+ * <pre>{@code
+ * try (Scanner sc = new Scanner(Paths.get("input.txt"))) {
+ * Pattern pat = Pattern.compile("[A-Z]{7,}");
+ * List<String> capWords = sc.findAll(pat)
+ * .map(MatchResult::group)
+ * .collect(Collectors.toList());
+ * }
+ * }</pre>
+ *
+ * @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<MatchResult> findAll(Pattern pattern) {
+ Objects.requireNonNull(pattern);
+ ensureOpen();
+ Stream<MatchResult> 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:
+ *
+ * <pre>{@code
+ * scanner.findAll(Pattern.compile(patString))
+ * }</pre>
+ *
+ * @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<MatchResult> findAll(String patString) {
+ Objects.requireNonNull(patString);
+ ensureOpen();
+ return findAll(patternCache.forName(patString));
+ }
+
+ class FindSpliterator extends Spliterators.AbstractSpliterator<MatchResult> {
+ 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<? super MatchResult> 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
+ }
+ }
+ }
}
--- a/jdk/src/java.base/share/classes/java/util/SimpleTimeZone.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/SimpleTimeZone.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/java/util/Spliterators.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Spliterators.java Thu Sep 17 09:19:40 2015 -0700
@@ -833,7 +833,7 @@
// Implementations
- private static abstract class EmptySpliterator<T, S extends Spliterator<T>, C> {
+ private abstract static class EmptySpliterator<T, S extends Spliterator<T>, C> {
EmptySpliterator() { }
@@ -1253,7 +1253,7 @@
* @see #spliterator(Iterator, long, int)
* @since 1.8
*/
- public static abstract class AbstractSpliterator<T> implements Spliterator<T> {
+ public abstract static class AbstractSpliterator<T> implements Spliterator<T> {
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;
--- a/jdk/src/java.base/share/classes/java/util/TimeZone.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/TimeZone.java Thu Sep 17 09:19:40 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 <code>TimeZone</code> for the given ID.
--- a/jdk/src/java.base/share/classes/java/util/Timer.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/Timer.java Thu Sep 17 09:19:40 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();
}
--- a/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/jar/Pack200.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/java/util/regex/Pattern.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/regex/Pattern.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/java.base/share/classes/java/util/regex/UnicodeProp.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/regex/UnicodeProp.java Thu Sep 17 09:19:40 2015 -0700
@@ -202,8 +202,8 @@
}
};
- private final static HashMap<String, String> posix = new HashMap<>();
- private final static HashMap<String, String> aliases = new HashMap<>();
+ private static final HashMap<String, String> posix = new HashMap<>();
+ private static final HashMap<String, String> aliases = new HashMap<>();
static {
posix.put("ALPHA", "ALPHABETIC");
posix.put("LOWER", "LOWERCASE");
--- a/jdk/src/java.base/share/classes/java/util/stream/FindOps.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/FindOps.java Thu Sep 17 09:19:40 2015 -0700
@@ -167,7 +167,7 @@
* @param <T> The type of input element
* @param <O> The result type, typically an optional type
*/
- private static abstract class FindSink<T, O> implements TerminalSink<T, O> {
+ private abstract static class FindSink<T, O> implements TerminalSink<T, O> {
boolean hasValue;
T value;
--- a/jdk/src/java.base/share/classes/java/util/stream/ForEachOps.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/ForEachOps.java Thu Sep 17 09:19:40 2015 -0700
@@ -130,7 +130,7 @@
*
* @param <T> the output type of the stream pipeline
*/
- static abstract class ForEachOp<T>
+ abstract static class ForEachOp<T>
implements TerminalOp<T, Void>, TerminalSink<T, Void> {
private final boolean ordered;
--- a/jdk/src/java.base/share/classes/java/util/stream/MatchOps.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/MatchOps.java Thu Sep 17 09:19:40 2015 -0700
@@ -249,7 +249,7 @@
*
* @param <T> The output type of the stream pipeline
*/
- private static abstract class BooleanTerminalSink<T> implements Sink<T> {
+ private abstract static class BooleanTerminalSink<T> implements Sink<T> {
boolean stop;
boolean value;
--- a/jdk/src/java.base/share/classes/java/util/stream/Nodes.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/Nodes.java Thu Sep 17 09:19:40 2015 -0700
@@ -562,7 +562,7 @@
// Implementations
- private static abstract class EmptyNode<T, T_ARR, T_CONS> implements Node<T> {
+ private abstract static class EmptyNode<T, T_ARR, T_CONS> implements Node<T> {
EmptyNode() { }
@Override
@@ -750,7 +750,7 @@
/**
* Node class for an internal node with two or more children
*/
- private static abstract class AbstractConcNode<T, T_NODE extends Node<T>> implements Node<T> {
+ private abstract static class AbstractConcNode<T, T_NODE extends Node<T>> implements Node<T> {
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<T,
+ private abstract static class InternalNodeSpliterator<T,
S extends Spliterator<T>,
N extends Node<T>>
implements Spliterator<T> {
@@ -1114,7 +1114,7 @@
}
}
- private static abstract class OfPrimitive<T, T_CONS, T_ARR,
+ private abstract static class OfPrimitive<T, T_CONS, T_ARR,
T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>,
N extends Node.OfPrimitive<T, T_CONS, T_ARR, T_SPLITR, N>>
extends InternalNodeSpliterator<T, T_SPLITR, N>
@@ -1827,7 +1827,7 @@
* This and subclasses are not intended to be serializable
*/
@SuppressWarnings("serial")
- private static abstract class SizedCollectorTask<P_IN, P_OUT, T_SINK extends Sink<P_OUT>,
+ private abstract static class SizedCollectorTask<P_IN, P_OUT, T_SINK extends Sink<P_OUT>,
K extends SizedCollectorTask<P_IN, P_OUT, T_SINK, K>>
extends CountedCompleter<Void>
implements Sink<P_OUT> {
@@ -2030,7 +2030,7 @@
}
@SuppressWarnings("serial")
- private static abstract class ToArrayTask<T, T_NODE extends Node<T>,
+ private abstract static class ToArrayTask<T, T_NODE extends Node<T>,
K extends ToArrayTask<T, T_NODE, K>>
extends CountedCompleter<Void> {
protected final T_NODE node;
--- a/jdk/src/java.base/share/classes/java/util/stream/ReduceOps.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/ReduceOps.java Thu Sep 17 09:19:40 2015 -0700
@@ -797,7 +797,7 @@
/**
* A sink that counts elements
*/
- static abstract class CountingSink<T>
+ abstract static class CountingSink<T>
extends Box<Long>
implements AccumulatingSink<T, Long, CountingSink<T>> {
long count;
@@ -866,7 +866,7 @@
*
* @param <U> The type of the state element
*/
- private static abstract class Box<U> {
+ private abstract static class Box<U> {
U state;
Box() {} // Avoid creation of special accessor
@@ -886,7 +886,7 @@
* @param <R> the result type of the reducing operation
* @param <S> the type of the {@code AccumulatingSink}
*/
- private static abstract class ReduceOp<T, R, S extends AccumulatingSink<T, R, S>>
+ private abstract static class ReduceOp<T, R, S extends AccumulatingSink<T, R, S>>
implements TerminalOp<T, R> {
private final StreamShape inputShape;
--- a/jdk/src/java.base/share/classes/java/util/stream/Sink.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/Sink.java Thu Sep 17 09:19:40 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<T, E_OUT> implements Sink<T> {
+ abstract static class ChainedReference<T, E_OUT> implements Sink<T> {
protected final Sink<? super E_OUT> downstream;
public ChainedReference(Sink<? super E_OUT> 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<E_OUT> implements Sink.OfInt {
+ abstract static class ChainedInt<E_OUT> implements Sink.OfInt {
protected final Sink<? super E_OUT> downstream;
public ChainedInt(Sink<? super E_OUT> 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<E_OUT> implements Sink.OfLong {
+ abstract static class ChainedLong<E_OUT> implements Sink.OfLong {
protected final Sink<? super E_OUT> downstream;
public ChainedLong(Sink<? super E_OUT> 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<E_OUT> implements Sink.OfDouble {
+ abstract static class ChainedDouble<E_OUT> implements Sink.OfDouble {
protected final Sink<? super E_OUT> downstream;
public ChainedDouble(Sink<? super E_OUT> downstream) {
--- a/jdk/src/java.base/share/classes/java/util/stream/SortedOps.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/SortedOps.java Thu Sep 17 09:19:40 2015 -0700
@@ -301,7 +301,7 @@
* occur, in general (not restricted to just sorting), for short-circuiting
* parallel pipelines.
*/
- private static abstract class AbstractRefSortingSink<T> extends Sink.ChainedReference<T, T> {
+ private abstract static class AbstractRefSortingSink<T> extends Sink.ChainedReference<T, T> {
protected final Comparator<? super T> 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<Integer> {
+ private abstract static class AbstractIntSortingSink extends Sink.ChainedInt<Integer> {
protected boolean cancellationWasRequested;
AbstractIntSortingSink(Sink<? super Integer> downstream) {
@@ -506,7 +506,7 @@
/**
* Abstract {@link Sink} for implementing sort on long streams.
*/
- private static abstract class AbstractLongSortingSink extends Sink.ChainedLong<Long> {
+ private abstract static class AbstractLongSortingSink extends Sink.ChainedLong<Long> {
protected boolean cancellationWasRequested;
AbstractLongSortingSink(Sink<? super Long> downstream) {
@@ -604,7 +604,7 @@
/**
* Abstract {@link Sink} for implementing sort on long streams.
*/
- private static abstract class AbstractDoubleSortingSink extends Sink.ChainedDouble<Double> {
+ private abstract static class AbstractDoubleSortingSink extends Sink.ChainedDouble<Double> {
protected boolean cancellationWasRequested;
AbstractDoubleSortingSink(Sink<? super Double> downstream) {
--- a/jdk/src/java.base/share/classes/java/util/stream/StreamSpliterators.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/StreamSpliterators.java Thu Sep 17 09:19:40 2015 -0700
@@ -57,7 +57,7 @@
* <p>A wrapping spliterator produced from a sequential stream
* cannot be split if there are stateful operations present.
*/
- private static abstract class AbstractWrappingSpliterator<P_IN, P_OUT,
+ private abstract static class AbstractWrappingSpliterator<P_IN, P_OUT,
T_BUFFER extends AbstractSpinedBuffer>
implements Spliterator<P_OUT> {
@@ -607,7 +607,7 @@
* {@code SUBSIZED}.
*
*/
- static abstract class SliceSpliterator<T, T_SPLITR extends Spliterator<T>> {
+ abstract static class SliceSpliterator<T, T_SPLITR extends Spliterator<T>> {
// 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,
+ abstract static class OfPrimitive<T,
T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>,
T_CONS>
extends SliceSpliterator<T, T_SPLITR>
@@ -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<T, T_SPLITR extends Spliterator<T>> {
+ abstract static class UnorderedSliceSpliterator<T, T_SPLITR extends Spliterator<T>> {
static final int CHUNK_SIZE = 1 << 7;
// The spliterator to slice
@@ -1060,7 +1060,7 @@
* @param <T_BUFF> 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<T_CONS>,
@@ -1324,7 +1324,7 @@
* The {@code tryAdvance} method always returns true.
*
*/
- static abstract class InfiniteSupplyingSpliterator<T> implements Spliterator<T> {
+ abstract static class InfiniteSupplyingSpliterator<T> implements Spliterator<T> {
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<T_CONS> extends ArrayBuffer {
+ abstract static class OfPrimitive<T_CONS> extends ArrayBuffer {
int index;
@Override
--- a/jdk/src/java.base/share/classes/java/util/stream/Streams.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/Streams.java Thu Sep 17 09:19:40 2015 -0700
@@ -298,7 +298,7 @@
}
}
- private static abstract class AbstractStreamBuilderImpl<T, S extends Spliterator<T>> implements Spliterator<T> {
+ private abstract static class AbstractStreamBuilderImpl<T, S extends Spliterator<T>> implements Spliterator<T> {
// >= 0 when building, < 0 when built
// -1 == no elements
// -2 == one element, held by first
@@ -782,7 +782,7 @@
}
}
- private static abstract class OfPrimitive<T, T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>>
+ private abstract static class OfPrimitive<T, T_CONS, T_SPLITR extends Spliterator.OfPrimitive<T, T_CONS, T_SPLITR>>
extends ConcatSpliterator<T, T_SPLITR>
implements Spliterator.OfPrimitive<T, T_CONS, T_SPLITR> {
private OfPrimitive(T_SPLITR aSpliterator, T_SPLITR bSpliterator) {
--- a/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/stream/WhileOps.java Thu Sep 17 09:19:40 2015 -0700
@@ -649,7 +649,7 @@
* @param <T> the type of elements returned by this spliterator
* @param <T_SPLITR> the type of the spliterator
*/
- static abstract class UnorderedWhileSpliterator<T, T_SPLITR extends Spliterator<T>> implements Spliterator<T> {
+ abstract static class UnorderedWhileSpliterator<T, T_SPLITR extends Spliterator<T>> implements Spliterator<T> {
// 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<T> extends UnorderedWhileSpliterator<T, Spliterator<T>> implements Consumer<T> {
+ abstract static class OfRef<T> extends UnorderedWhileSpliterator<T, Spliterator<T>> implements Consumer<T> {
final Predicate<? super T> p;
T t;
@@ -820,7 +820,7 @@
}
}
- static abstract class OfInt extends UnorderedWhileSpliterator<Integer, Spliterator.OfInt> implements IntConsumer, Spliterator.OfInt {
+ abstract static class OfInt extends UnorderedWhileSpliterator<Integer, Spliterator.OfInt> implements IntConsumer, Spliterator.OfInt {
final IntPredicate p;
int t;
@@ -925,7 +925,7 @@
}
}
- static abstract class OfLong extends UnorderedWhileSpliterator<Long, Spliterator.OfLong> implements LongConsumer, Spliterator.OfLong {
+ abstract static class OfLong extends UnorderedWhileSpliterator<Long, Spliterator.OfLong> implements LongConsumer, Spliterator.OfLong {
final LongPredicate p;
long t;
@@ -1030,7 +1030,7 @@
}
}
- static abstract class OfDouble extends UnorderedWhileSpliterator<Double, Spliterator.OfDouble> implements DoubleConsumer, Spliterator.OfDouble {
+ abstract static class OfDouble extends UnorderedWhileSpliterator<Double, Spliterator.OfDouble> implements DoubleConsumer, Spliterator.OfDouble {
final DoublePredicate p;
double t;
--- a/jdk/src/java.base/share/classes/java/util/zip/Adler32.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/zip/Adler32.java Thu Sep 17 09:19:40 2015 -0700
@@ -127,12 +127,12 @@
return (long)adler & 0xffffffffL;
}
- private native static int update(int adler, int b);
+ private static native int update(int adler, int b);
@HotSpotIntrinsicCandidate
- private native static int updateBytes(int adler, byte[] b, int off,
+ private static native int updateBytes(int adler, byte[] b, int off,
int len);
@HotSpotIntrinsicCandidate
- private native static int updateByteBuffer(int adler, long addr,
+ private static native int updateByteBuffer(int adler, long addr,
int off, int len);
}
--- a/jdk/src/java.base/share/classes/java/util/zip/CRC32.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/zip/CRC32.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/java/util/zip/Deflater.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/zip/Deflater.java Thu Sep 17 09:19:40 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);
}
--- a/jdk/src/java.base/share/classes/java/util/zip/GZIPInputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/zip/GZIPInputStream.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/zip/GZIPOutputStream.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/java/util/zip/Inflater.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/java/util/zip/Inflater.java Thu Sep 17 09:19:40 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);
}
--- a/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/Cipher.java Thu Sep 17 09:19:40 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<String,Pattern> for previously compiled patterns
- private final static ConcurrentMap<String, Pattern> patternCache =
+ private static final ConcurrentMap<String, Pattern> patternCache =
new ConcurrentHashMap<String, Pattern>();
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,
--- a/jdk/src/java.base/share/classes/javax/crypto/JceSecurity.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/JceSecurity.java Thu Sep 17 09:19:40 2015 -0700
@@ -57,11 +57,11 @@
// Map<Provider,?> 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<Provider, Object> verificationResults =
+ private static final Map<Provider, Object> verificationResults =
new IdentityHashMap<>();
// Map<Provider,?> of the providers currently being verified
- private final static Map<Provider, Object> verifyingProviders =
+ private static final Map<Provider, Object> 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
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyAgreement.java Thu Sep 17 09:19:40 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)
--- a/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/crypto/KeyGenerator.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/HttpsURLConnection.java Thu Sep 17 09:19:40 2015 -0700
@@ -52,7 +52,7 @@
*
* @since 1.4
*/
-abstract public
+public abstract
class HttpsURLConnection extends HttpURLConnection
{
/**
--- a/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/KeyManagerFactory.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SNIHostName.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SNIHostName.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLContext.java Thu Sep 17 09:19:40 2015 -0700
@@ -37,11 +37,13 @@
* secure random bytes.
*
* <p> Every implementation of the Java platform is required to support the
- * following standard {@code SSLContext} protocol:
+ * following standard {@code SSLContext} protocols:
* <ul>
* <li>{@code TLSv1}</li>
+ * <li>{@code TLSv1.1}</li>
+ * <li>{@code TLSv1.2}</li>
* </ul>
- * This protocol is described in the <a href=
+ * These protocols are described in the <a href=
* "{@docRoot}/../technotes/guides/security/StandardNames.html#SSLContext">
* SSLContext section</a> of the
* Java Cryptography Architecture Standard Algorithm Name Documentation.
--- a/jdk/src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/SSLEngineResult.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/net/ssl/TrustManagerFactory.java Thu Sep 17 09:19:40 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.
+ *
+ * <p> Every implementation of the Java platform is required to support the
+ * following standard {@code TrustManagerFactory} algorithm:
+ * <ul>
+ * <li><tt>PKIX</tt></li>
+ * </ul>
+ * This algorithm is described in the <a href=
+ * "{@docRoot}/../technotes/guides/security/StandardNames.html#TrustManagerFactory">
+ * TrustManagerFactory section</a> 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
--- a/jdk/src/java.base/share/classes/javax/security/auth/Policy.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/javax/security/auth/Policy.java Thu Sep 17 09:19:40 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 =
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/BasicImageWriter.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocationBase.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageLocationBase.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageModuleData.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageModuleData.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageNativeSubstrate.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageNativeSubstrate.java Thu Sep 17 09:19:40 2015 -0700
@@ -49,32 +49,32 @@
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 native static long JIMAGE_Open(String path) throws IOException;
- public native static void JIMAGE_Close(long jimageHandle);
- public native static long JIMAGE_FindResource(long jimageHandle,
+ 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 native static long JIMAGE_GetResource(long jimageHandle,
+ 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 native static int JIMAGE_Resources(long jimageHandle,
+ public static native int JIMAGE_Resources(long jimageHandle,
String[] outputNames);
// Return the module name for the package
- public native static String JIMAGE_PackageToModule(long imageHandle,
+ public static native String JIMAGE_PackageToModule(long imageHandle,
String packageName);
static ByteBuffer newDirectByteBuffer(long address, long capacity) {
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/ImageReader.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/jdk/internal/jimage/PerfectHashBuilder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/jimage/PerfectHashBuilder.java Thu Sep 17 09:19:40 2015 -0700
@@ -33,7 +33,7 @@
import java.util.Map;
public class PerfectHashBuilder<E> {
- private final static int RETRY_LIMIT = 1000;
+ private static final int RETRY_LIMIT = 1000;
private Class<?> entryComponent;
private Class<?> bucketComponent;
--- a/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypePath.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypePath.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypeReference.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/TypeReference.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/commons/InstructionAdapter.java Thu Sep 17 09:19:40 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}. <i>Subclasses must not use this
--- a/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/signature/SignatureVisitor.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/org/objectweb/asm/signature/SignatureVisitor.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/util/xml/PropertiesDefaultHandler.java Thu Sep 17 09:19:40 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
////////////////////////////////////////////////////////////////////
--- a/jdk/src/java.base/share/classes/jdk/internal/util/xml/XMLStreamWriter.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/util/xml/XMLStreamWriter.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/util/xml/impl/Parser.java Thu Sep 17 09:19:40 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<String, Input> 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];
--- a/jdk/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/internal/util/xml/impl/ParserSAX.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/jdk/net/Sockets.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/jdk/net/Sockets.java Thu Sep 17 09:19:40 2015 -0700
@@ -58,7 +58,7 @@
@jdk.Exported
public class Sockets {
- private final static HashMap<Class<?>,Set<SocketOption<?>>>
+ private static final HashMap<Class<?>,Set<SocketOption<?>>>
options = new HashMap<>();
static {
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/invoke/anon/AnonymousClassLoader.java Thu Sep 17 09:19:40 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<? extends sun.misc.Unsafe> unsafeClass = unsafe.getClass();
--- a/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/invoke/anon/ConstantPoolPatch.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/invoke/util/BytecodeDescriptor.java Thu Sep 17 09:19:40 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);
--- a/jdk/src/java.base/share/classes/sun/invoke/util/ValueConversions.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/invoke/util/ValueConversions.java Thu Sep 17 09:19:40 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
/**
--- a/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/invoke/util/Wrapper.java Thu Sep 17 09:19:40 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,
--- a/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/launcher/LauncherHelper.java Thu Sep 17 09:19:40 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";
--- a/jdk/src/java.base/share/classes/sun/misc/BASE64Decoder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/BASE64Decoder.java Thu Sep 17 09:19:40 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++) {
--- a/jdk/src/java.base/share/classes/sun/misc/BASE64Encoder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/BASE64Encoder.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/misc/CharacterDecoder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/CharacterDecoder.java Thu Sep 17 09:19:40 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 { }
--- a/jdk/src/java.base/share/classes/sun/misc/CharacterEncoder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/CharacterEncoder.java Thu Sep 17 09:19:40 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;
/**
--- a/jdk/src/java.base/share/classes/sun/misc/Cleaner.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/Cleaner.java Thu Sep 17 09:19:40 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,
--- a/jdk/src/java.base/share/classes/sun/misc/FDBigInteger.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/FDBigInteger.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/misc/FloatingDecimal.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/FloatingDecimal.java Thu Sep 17 09:19:40 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 <code>ASCIIToBinaryConverter</code> container for a <code>double</code>.
*/
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;
--- a/jdk/src/java.base/share/classes/sun/misc/LRUCache.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/LRUCache.java Thu Sep 17 09:19:40 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];
--- a/jdk/src/java.base/share/classes/sun/misc/PerfCounter.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/PerfCounter.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/misc/ProxyGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/ProxyGenerator.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/sun/misc/Request.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/Request.java Thu Sep 17 09:19:40 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();
}
--- a/jdk/src/java.base/share/classes/sun/misc/SoftCache.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/SoftCache.java Thu Sep 17 09:19:40 2015 -0700
@@ -117,9 +117,9 @@
*/
- static private class ValueCell extends SoftReference<Object> {
- static private Object INVALID_KEY = new Object();
- static private int dropped = 0;
+ private static class ValueCell extends SoftReference<Object> {
+ private static Object INVALID_KEY = new Object();
+ private static int dropped = 0;
private Object key;
private ValueCell(Object key, Object value, ReferenceQueue<Object> queue) {
--- a/jdk/src/java.base/share/classes/sun/misc/UCDecoder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/UCDecoder.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/misc/UCEncoder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/UCEncoder.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/misc/VM.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/misc/VM.java Thu Sep 17 09:19:40 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();
}
--- a/jdk/src/java.base/share/classes/sun/net/NetProperties.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/NetProperties.java Thu Sep 17 09:19:40 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<Void>() {
@@ -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 <code>String</code> value for the property,
* or <code>null</code>
*/
- 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 <code>Integer</code> value for the property,
* or <code>null</code>
*/
- 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 <code>Boolean</code> value for the property,
* or <code>null</code>
*/
- static public Boolean getBoolean(String key) {
+ public static Boolean getBoolean(String key) {
String val = null;
try {
--- a/jdk/src/java.base/share/classes/sun/net/NetworkServer.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/NetworkServer.java Thu Sep 17 09:19:40 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 <i>port</i>. 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();
--- a/jdk/src/java.base/share/classes/sun/net/dns/ResolverConfiguration.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/dns/ResolverConfiguration.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/spi/DefaultProxySelector.java Thu Sep 17 09:19:40 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);
/**
--- a/jdk/src/java.base/share/classes/sun/net/util/IPAddressUtil.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/util/IPAddressUtil.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/ParseUtil.java Thu Sep 17 09:19:40 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'
};
--- a/jdk/src/java.base/share/classes/sun/net/www/URLConnection.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/URLConnection.java Thu Sep 17 09:19:40 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<String,Void> 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());
}
}
--- a/jdk/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/http/ChunkedInputStream.java Thu Sep 17 09:19:40 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 :-
--- a/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/http/HttpClient.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/AuthCacheValue.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/AuthCacheValue.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/AuthenticationInfo.java Thu Sep 17 09:19:40 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<String,Thread> requests = new HashMap<>();
+ private static HashMap<String,Thread> 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()) {
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/DigestAuthentication.java Thu Sep 17 09:19:40 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"
};
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpCallerInfo.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpCallerInfo.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/http/NegotiateAuthentication.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DefaultHostnameVerifier.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/net/www/protocol/https/DefaultHostnameVerifier.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/sun/nio/ch/Net.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/Net.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/nio/ch/SelectorImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/SelectorImpl.java Thu Sep 17 09:19:40 2015 -0700
@@ -159,6 +159,6 @@
protected abstract void implDereg(SelectionKeyImpl ski) throws IOException;
- abstract public Selector wakeup();
+ public abstract Selector wakeup();
}
--- a/jdk/src/java.base/share/classes/sun/nio/ch/ThreadPool.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/ch/ThreadPool.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/nio/cs/CharsetMapping.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/CharsetMapping.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/nio/cs/DoubleByte.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/DoubleByte.java Thu Sep 17 09:19:40 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);
--- a/jdk/src/java.base/share/classes/sun/nio/cs/SingleByte.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/SingleByte.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/nio/cs/ThreadLocalCoders.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/nio/cs/ThreadLocalCoders.java Thu Sep 17 09:19:40 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<Object[]> cache = new ThreadLocal<>();
--- a/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/reflect/UnsafeQualifiedStaticFieldAccessorImpl.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/internal/spec/TlsRsaPremasterSecretParameterSpec.java Thu Sep 17 09:19:40 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<Boolean>() {
public Boolean run() {
String value = System.getProperty(PROP_NAME);
--- a/jdk/src/java.base/share/classes/sun/security/jca/JCAUtil.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/jca/JCAUtil.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/jca/ProviderConfig.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/jca/ProviderList.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/jca/ProviderList.java Thu Sep 17 09:19:40 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);
--- a/jdk/src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs/PKCS9Attribute.java Thu Sep 17 09:19:40 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++) {
--- a/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/pkcs12/PKCS12KeyStore.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/ByteArrayAccess.java Thu Sep 17 09:19:40 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)
--- a/jdk/src/java.base/share/classes/sun/security/provider/ConfigFile.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/ConfigFile.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/provider/MD2.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/MD2.java Thu Sep 17 09:19:40 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][];
--- a/jdk/src/java.base/share/classes/sun/security/provider/MD4.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/MD4.java Thu Sep 17 09:19:40 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") {
--- a/jdk/src/java.base/share/classes/sun/security/provider/ParameterCache.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/ParameterCache.java Thu Sep 17 09:19:40 2015 -0700
@@ -50,10 +50,10 @@
}
// cache of DSA parameters
- private final static Map<Integer,DSAParameterSpec> dsaCache;
+ private static final Map<Integer,DSAParameterSpec> dsaCache;
// cache of DH parameters
- private final static Map<Integer,DHParameterSpec> dhCache;
+ private static final Map<Integer,DHParameterSpec> dhCache;
/**
* Return cached DSA parameters for the given length combination of
--- a/jdk/src/java.base/share/classes/sun/security/provider/SHA.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SHA.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/sun/security/provider/SecureRandom.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SecureRandom.java Thu Sep 17 09:19:40 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++) {
--- a/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SeedGenerator.java Thu Sep 17 09:19:40 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);
--- a/jdk/src/java.base/share/classes/sun/security/provider/SunEntries.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/SunEntries.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/AlgorithmChecker.java Thu Sep 17 09:19:40 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<CryptoPrimitive> SIGNATURE_PRIMITIVE_SET =
+ private static final Set<CryptoPrimitive> 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);
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/Builder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/Builder.java Thu Sep 17 09:19:40 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"));
/**
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/ForwardBuilder.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/ForwardBuilder.java Thu Sep 17 09:19:40 2015 -0700
@@ -433,7 +433,7 @@
*/
static class PKIXCertComparator implements Comparator<X509Certificate> {
- final static String METHOD_NME = "PKIXCertComparator.compare()";
+ static final String METHOD_NME = "PKIXCertComparator.compare()";
private final Set<X500Principal> trustedSubjectDNs;
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/OCSPResponse.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/URICertStore.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/UntrustedChecker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/UntrustedChecker.java Thu Sep 17 09:19:40 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");
--- a/jdk/src/java.base/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/provider/certpath/ssl/SSLServerCertStore.java Thu Sep 17 09:19:40 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();
--- a/jdk/src/java.base/share/classes/sun/security/rsa/RSACore.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSACore.java Thu Sep 17 09:19:40 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<BigInteger, BlindingParameters>
// use a weak hashmap so that cached values are automatically cleared
// when the modulus is GC'ed
- private final static Map<BigInteger, BlindingParameters>
+ private static final Map<BigInteger, BlindingParameters>
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;
--- a/jdk/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSAKeyFactory.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/security/rsa/RSAPadding.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSAPadding.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/rsa/RSAPrivateCrtKeyImpl.java Thu Sep 17 09:19:40 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);
/**
--- a/jdk/src/java.base/share/classes/sun/security/ssl/AppOutputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/AppOutputStream.java Thu Sep 17 09:19:40 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);
}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Authenticator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Authenticator.java Thu Sep 17 09:19:40 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) |
--- a/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/BaseSSLSocketImpl.java Thu Sep 17 09:19:40 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);
//
--- a/jdk/src/java.base/share/classes/sun/security/ssl/CipherBox.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/CipherBox.java Thu Sep 17 09:19:40 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");
--- a/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/CipherSuite.java Thu Sep 17 09:19:40 2015 -0700
@@ -72,27 +72,27 @@
final class CipherSuite implements Comparable<CipherSuite> {
// 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<Integer,CipherSuite> idMap;
+ private static final Map<Integer,CipherSuite> idMap;
// Map String(name) -> CipherSuite
// contains only supported CipherSuites (i.e. allowed == true)
- private final static Map<String,CipherSuite> nameMap;
+ private static final Map<String,CipherSuite> 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<BulkCipher,Boolean> availableCache =
+ private static final Map<BulkCipher,Boolean> 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);
}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Ciphertext.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Ciphertext.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientHandshaker.java Thu Sep 17 09:19:40 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<SNIServerName> requestedServerNames =
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchange.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ClientKeyExchange.java Thu Sep 17 09:19:40 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();
}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/DTLSInputRecord.java Thu Sep 17 09:19:40 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();
--- a/jdk/src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/EphemeralKeyManager.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ExtensionType.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ExtensionType.java Thu Sep 17 09:19:40 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
}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeMessage.java Thu Sep 17 09:19:40 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<Class<?>,Object> methodCache =
+ private static final Map<Class<?>,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 };
--- a/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeStateManager.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/HandshakeStateManager.java Thu Sep 17 09:19:40 2015 -0700
@@ -218,9 +218,9 @@
private boolean isDTLS;
- private final static boolean debugIsOn;
+ private static final boolean debugIsOn;
- private final static HashMap<Byte, String> handshakeTypes;
+ private static final HashMap<Byte, String> handshakeTypes;
static {
debugIsOn = (Handshaker.debug != null) &&
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Handshaker.java Thu Sep 17 09:19:40 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();
}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/InputRecord.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/InputRecord.java Thu Sep 17 09:19:40 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();
--- a/jdk/src/java.base/share/classes/sun/security/ssl/JsseJce.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/JsseJce.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/MAC.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/MAC.java Thu Sep 17 09:19:40 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];
--- a/jdk/src/java.base/share/classes/sun/security/ssl/OutputRecord.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/OutputRecord.java Thu Sep 17 09:19:40 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();
--- a/jdk/src/java.base/share/classes/sun/security/ssl/Plaintext.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/Plaintext.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ProtocolVersion.java Thu Sep 17 09:19:40 2015 -0700
@@ -54,33 +54,33 @@
public final class ProtocolVersion implements Comparable<ProtocolVersion> {
// 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<ProtocolVersion> availableProtocols;
+ static final Set<ProtocolVersion> availableProtocols;
// version in 16 bit MSB format as it appears in records and
// messages, i.e. 0x0301 for TLS 1.0
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLAlgorithmConstraints.java Thu Sep 17 09:19:40 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<CryptoPrimitive> primitives, Key key) {
+ public final boolean permits(Set<CryptoPrimitive> primitives, Key key) {
return true;
}
@Override
- final public boolean permits(Set<CryptoPrimitive> primitives,
+ public final boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, Key key, AlgorithmParameters parameters) {
if (algorithm == null || algorithm.length() == 0) {
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLContextImpl.java Thu Sep 17 09:19:40 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<ProtocolVersion>
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.
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineImpl.java Thu Sep 17 09:19:40 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 <code>SSLEngine</code>.
*/
@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
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLEngineOutputRecord.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLServerSocketImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLServerSocketImpl.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSocketFactoryImpl.java Thu Sep 17 09:19:40 2015 -0700
@@ -41,7 +41,7 @@
*
* @author David Brownell
*/
-final public class SSLSocketFactoryImpl extends SSLSocketFactory {
+public final class SSLSocketFactoryImpl extends SSLSocketFactory {
private SSLContextImpl context;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SSLSocketImpl.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerHandshaker.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/ServerNameExtension.java Thu Sep 17 09:19:40 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<Integer, SNIServerName> sniMap;
private int listLength; // ServerNameList length
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SignatureAndHashAlgorithm.java Thu Sep 17 09:19:40 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<CryptoPrimitive> SIGNATURE_PRIMITIVE_SET =
+ private static final Set<CryptoPrimitive> SIGNATURE_PRIMITIVE_SET =
Collections.unmodifiableSet(EnumSet.of(CryptoPrimitive.SIGNATURE));
// supported pairs of signature and hash algorithm
- private final static Map<Integer, SignatureAndHashAlgorithm> supportedMap;
- private final static Map<Integer, SignatureAndHashAlgorithm> priorityMap;
+ private static final Map<Integer, SignatureAndHashAlgorithm> supportedMap;
+ private static final Map<Integer, SignatureAndHashAlgorithm> priorityMap;
// the hash algorithm
private HashAlgorithm hash;
--- a/jdk/src/java.base/share/classes/sun/security/ssl/StatusRequestType.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/StatusRequestType.java Thu Sep 17 09:19:40 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");
}
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SupportedEllipticCurvesExtension.java Thu Sep 17 09:19:40 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<String,Integer> curveIndices;
+ private static final Map<String,Integer> curveIndices;
static {
curveIndices = new HashMap<String,Integer>();
--- a/jdk/src/java.base/share/classes/sun/security/ssl/SupportedEllipticPointFormatsExtension.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/SupportedEllipticPointFormatsExtension.java Thu Sep 17 09:19:40 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(
--- a/jdk/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/ssl/X509KeyManagerImpl.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/security/timestamp/TSResponse.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/timestamp/TSResponse.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/sun/security/util/Cache.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/Cache.java Thu Sep 17 09:19:40 2015 -0700
@@ -202,7 +202,7 @@
class NullCache<K,V> extends Cache<K,V> {
- final static Cache<Object,Object> INSTANCE = new NullCache<>();
+ static final Cache<Object,Object> INSTANCE = new NullCache<>();
private NullCache() {
// empty
@@ -244,10 +244,10 @@
class MemoryCache<K,V> extends Cache<K,V> {
- 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<K, CacheEntry<K,V>> cacheMap;
private int maxSize;
--- a/jdk/src/java.base/share/classes/sun/security/util/CurveDB.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/CurveDB.java Thu Sep 17 09:19:40 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<String,NamedCurve> oidMap =
new LinkedHashMap<String,NamedCurve>();
--- a/jdk/src/java.base/share/classes/sun/security/util/Debug.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/Debug.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/sun/security/util/DerValue.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/DerValue.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/DisabledAlgorithmConstraints.java Thu Sep 17 09:19:40 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<String, String[]> disabledAlgorithmsMap =
+ private static final Map<String, String[]> disabledAlgorithmsMap =
new HashMap<>();
- private final static Map<String, KeySizeConstraints> keySizeConstraintsMap =
+ private static final Map<String, KeySizeConstraints> keySizeConstraintsMap =
new HashMap<>();
private final String[] disabledAlgorithms;
@@ -80,7 +80,7 @@
}
@Override
- final public boolean permits(Set<CryptoPrimitive> primitives,
+ public final boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, AlgorithmParameters parameters) {
if (primitives == null || primitives.isEmpty()) {
@@ -92,12 +92,12 @@
}
@Override
- final public boolean permits(Set<CryptoPrimitive> primitives, Key key) {
+ public final boolean permits(Set<CryptoPrimitive> primitives, Key key) {
return checkConstraints(primitives, "", key, null);
}
@Override
- final public boolean permits(Set<CryptoPrimitive> primitives,
+ public final boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, Key key, AlgorithmParameters parameters) {
if (algorithm == null || algorithm.length() == 0) {
--- a/jdk/src/java.base/share/classes/sun/security/util/HostnameChecker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/HostnameChecker.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/LegacyAlgorithmConstraints.java Thu Sep 17 09:19:40 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<String, String[]> legacyAlgorithmsMap =
+ private static final Map<String, String[]> legacyAlgorithmsMap =
new HashMap<>();
private final String[] legacyAlgorithms;
@@ -54,18 +54,18 @@
}
@Override
- final public boolean permits(Set<CryptoPrimitive> primitives,
+ public final boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, AlgorithmParameters parameters) {
return checkAlgorithm(legacyAlgorithms, algorithm, decomposer);
}
@Override
- final public boolean permits(Set<CryptoPrimitive> primitives, Key key) {
+ public final boolean permits(Set<CryptoPrimitive> primitives, Key key) {
return true;
}
@Override
- final public boolean permits(Set<CryptoPrimitive> primitives,
+ public final boolean permits(Set<CryptoPrimitive> primitives,
String algorithm, Key key, AlgorithmParameters parameters) {
return checkAlgorithm(legacyAlgorithms, algorithm, decomposer);
}
--- a/jdk/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/util/ObjectIdentifier.java Thu Sep 17 09:19:40 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 {
--- a/jdk/src/java.base/share/classes/sun/security/validator/EndEntityChecker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/validator/EndEntityChecker.java Thu Sep 17 09:19:40 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<String> KU_SERVER_SIGNATURE =
+ private static final Collection<String> 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<String> KU_SERVER_ENCRYPTION =
+ private static final Collection<String> KU_SERVER_ENCRYPTION =
Arrays.asList("RSA");
// TLS key exchange algorithms requiring keyAgreement key usage
- private final static Collection<String> KU_SERVER_KEY_AGREEMENT =
+ private static final Collection<String> KU_SERVER_KEY_AGREEMENT =
Arrays.asList("DH_DSS", "DH_RSA", "ECDH_ECDSA", "ECDH_RSA");
// variant of this end entity cert checker
--- a/jdk/src/java.base/share/classes/sun/security/validator/KeyStores.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/validator/KeyStores.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/sun/security/validator/PKIXValidator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/validator/PKIXValidator.java Thu Sep 17 09:19:40 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"));
--- a/jdk/src/java.base/share/classes/sun/security/validator/SimpleValidator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/validator/SimpleValidator.java Thu Sep 17 09:19:40 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;
/**
--- a/jdk/src/java.base/share/classes/sun/security/validator/Validator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/validator/Validator.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/validator/ValidatorException.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/validator/ValidatorException.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/x509/AVA.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/x509/AVA.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/security/x509/DistributionPoint.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/x509/DistributionPoint.java Thu Sep 17 09:19:40 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,
--- a/jdk/src/java.base/share/classes/sun/security/x509/IPAddressName.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/x509/IPAddressName.java Thu Sep 17 09:19:40 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('/');
--- a/jdk/src/java.base/share/classes/sun/security/x509/OIDMap.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/x509/OIDMap.java Thu Sep 17 09:19:40 2015 -0700
@@ -106,10 +106,10 @@
{ 2, 16, 840, 1, 113730, 1, 1 };
/** Map ObjectIdentifier(oid) -> OIDInfo(info) */
- private final static Map<ObjectIdentifier,OIDInfo> oidMap;
+ private static final Map<ObjectIdentifier,OIDInfo> oidMap;
/** Map String(friendly name) -> OIDInfo(info) */
- private final static Map<String,OIDInfo> nameMap;
+ private static final Map<String,OIDInfo> nameMap;
static {
oidMap = new HashMap<ObjectIdentifier,OIDInfo>();
--- a/jdk/src/java.base/share/classes/sun/security/x509/ReasonFlags.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/x509/ReasonFlags.java Thu Sep 17 09:19:40 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,
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CRLEntryImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CRLEntryImpl.java Thu Sep 17 09:19:40 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;
/**
--- a/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/security/x509/X509CRLImpl.java Thu Sep 17 09:19:40 2015 -0700
@@ -107,7 +107,7 @@
private Map<X509IssuerSerial,X509CRLEntry> revokedMap = new TreeMap<>();
private List<X509CRLEntry> 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<X509IssuerSerial> {
final X500Principal issuer;
final BigInteger serial;
--- a/jdk/src/java.base/share/classes/sun/text/CompactByteArray.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/text/CompactByteArray.java Thu Sep 17 09:19:40 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)
{
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/Norm2AllModes.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/NormalizerBase.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/NormalizerBase.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/Trie2.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/Trie2.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/UBiDiProps.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/UBiDiProps.java Thu Sep 17 09:19:40 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;
}
--- a/jdk/src/java.base/share/classes/sun/text/normalizer/Utility.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/text/normalizer/Utility.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/sun/util/calendar/CalendarSystem.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/CalendarSystem.java Thu Sep 17 09:19:40 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<String, String> 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 <code>Gregorian</code>
--- a/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfo.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/calendar/ZoneInfoFile.java Thu Sep 17 09:19:40 2015 -0700
@@ -206,7 +206,7 @@
}
private static String versionId;
- private final static Map<String, ZoneInfo> zones = new ConcurrentHashMap<>();
+ private static final Map<String, ZoneInfo> zones = new ConcurrentHashMap<>();
private static Map<String, String> aliases = new HashMap<>();
private static byte[][] ruleArray;
--- a/jdk/src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/cldr/CLDRLocaleProviderAdapter.java Thu Sep 17 09:19:40 2015 -0700
@@ -41,6 +41,7 @@
import java.util.ServiceLoader;
import java.util.Set;
import java.util.StringTokenizer;
+import java.util.stream.Stream;
import sun.util.locale.provider.JRELocaleProviderAdapter;
import sun.util.locale.provider.LocaleProviderAdapter;
import sun.util.locale.provider.LocaleDataMetaInfo;
@@ -148,11 +149,9 @@
private List<Locale> applyParentLocales(String baseName, List<Locale> candidates) {
if (Objects.isNull(parentLocalesMap)) {
Map<Locale, Locale> map = new HashMap<>();
- Map<String, String> parentLocales = baseMetaInfo.parentLocales();
- parentLocales.keySet().forEach(parent -> {
- Arrays.asList(parentLocales.get(parent).split(" ")).stream().forEach(child -> {
- map.put(Locale.forLanguageTag(child),
- "root".equals(parent) ? Locale.ROOT : Locale.forLanguageTag(parent));
+ baseMetaInfo.parentLocales().forEach((parent, children) -> {
+ Stream.of(children).forEach(child -> {
+ map.put(Locale.forLanguageTag(child), parent);
});
});
parentLocalesMap = Collections.unmodifiableMap(map);
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/CalendarDataUtility.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/java.base/share/classes/sun/util/locale/provider/CollationRules.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/locale/provider/CollationRules.java Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/logging/PlatformLogger.java Thu Sep 17 09:19:40 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) {
--- a/jdk/src/java.base/share/classes/sun/util/resources/OpenListResourceBundle.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/share/classes/sun/util/resources/OpenListResourceBundle.java Thu Sep 17 09:19:40 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.
--- a/jdk/src/java.base/unix/classes/java/lang/ProcessEnvironment.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/classes/java/lang/ProcessEnvironment.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/classes/java/net/PlainDatagramSocketImpl.java Thu Sep 17 09:19:40 2015 -0700
@@ -135,5 +135,5 @@
/**
* Perform class load-time initializations.
*/
- private native static void init();
+ private static native void init();
}
--- a/jdk/src/java.base/unix/classes/sun/net/NetHooks.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/classes/sun/net/NetHooks.java Thu Sep 17 09:19:40 2015 -0700
@@ -45,7 +45,7 @@
* <p> 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.
*/
--- a/jdk/src/java.base/unix/classes/sun/net/PortConfig.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/classes/sun/net/PortConfig.java Thu Sep 17 09:19:40 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() {}
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousServerSocketChannelImpl.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/classes/sun/nio/ch/UnixAsynchronousSocketChannelImpl.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/classes/sun/nio/fs/UnixUriUtils.java Thu Sep 17 09:19:40 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'
};
--- a/jdk/src/java.base/unix/classes/sun/security/provider/NativePRNG.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/classes/sun/security/provider/NativePRNG.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/unix/native/libjava/java_props_md.c Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/native/libjava/java_props_md.c Thu Sep 17 09:19:40 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
--- a/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/unix/native/libnet/PlainDatagramSocketImpl.c Thu Sep 17 09:19:40 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__ */
--- a/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/windows/classes/java/net/DefaultDatagramSocketImplFactory.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/windows/classes/java/net/TwoStacksPlainDatagramSocketImpl.java Thu Sep 17 09:19:40 2015 -0700
@@ -212,5 +212,5 @@
/**
* Perform class load-time initializations.
*/
- private native static void init();
+ private static native void init();
}
--- a/jdk/src/java.base/windows/classes/sun/net/PortConfig.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/windows/classes/sun/net/PortConfig.java Thu Sep 17 09:19:40 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(
--- a/jdk/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/windows/classes/sun/net/www/protocol/http/ntlm/NTLMAuthSequence.java Thu Sep 17 09:19:40 2015 -0700
@@ -87,7 +87,7 @@
return status.sequenceComplete;
}
- private native static void initFirst (Class<NTLMAuthSequence.Status> clazz);
+ private static native void initFirst (Class<NTLMAuthSequence.Status> clazz);
private native long getCredentialsHandle (String user, String domain, String password);
--- a/jdk/src/java.base/windows/classes/sun/nio/ch/WindowsSelectorImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/windows/classes/sun/nio/ch/WindowsSelectorImpl.java Thu Sep 17 09:19:40 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<Integer, MapEntry> {
+ private static final class FdMap extends HashMap<Integer, MapEntry> {
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;
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsConstants.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsConstants.java Thu Sep 17 09:19:40 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;
--- a/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/windows/classes/sun/nio/fs/WindowsWatchService.java Thu Sep 17 09:19:40 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 {
--- a/jdk/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/java.base/windows/classes/sun/util/locale/provider/HostLocaleProviderAdapterImpl.java Thu Sep 17 09:19:40 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() {
--- a/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.pkcs11/share/classes/sun/security/pkcs11/P11KeyStore.java Thu Sep 17 09:19:40 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
@@ -750,6 +750,21 @@
} else {
login(new PasswordCallbackHandler(password));
}
+ } catch(LoginException e) {
+ Throwable cause = e.getCause();
+ if (cause instanceof PKCS11Exception) {
+ PKCS11Exception pe = (PKCS11Exception) cause;
+ if (pe.getErrorCode() == CKR_PIN_INCORRECT) {
+ // if password is wrong, the cause of the IOException
+ // should be an UnrecoverableKeyException
+ throw new IOException("load failed",
+ new UnrecoverableKeyException().initCause(e));
+ }
+ }
+ throw new IOException("load failed", e);
+ }
+
+ try {
if (mapLabels() == true) {
// CKA_LABELs are shared by multiple certs
writeDisabled = true;
@@ -757,7 +772,7 @@
if (debug != null) {
dumpTokenMap();
}
- } catch (LoginException | KeyStoreException | PKCS11Exception e) {
+ } catch (KeyStoreException | PKCS11Exception e) {
throw new IOException("load failed", e);
}
}
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/GCMParameters.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/GCMParameters.java Thu Sep 17 09:19:40 2015 -0700
@@ -90,7 +90,8 @@
return paramSpec.cast(new GCMParameterSpec(tLen*8, iv.clone()));
} else {
throw new InvalidParameterSpecException
- ("Inappropriate parameter specification");
+ ("Inappropriate parameter specification. Received " +
+ paramSpec.getClass().getName());
}
}
@@ -98,7 +99,8 @@
throws InvalidParameterSpecException {
if (!(paramSpec instanceof GCMParameterSpec)) {
throw new InvalidParameterSpecException
- ("Inappropriate parameter specification");
+ ("Inappropriate parameter specification. Received " +
+ paramSpec.getClass().getName());
}
GCMParameterSpec gcmSpec = (GCMParameterSpec) paramSpec;
try {
@@ -114,7 +116,8 @@
val.data.reset();
setValues(val.data.getOctetString(), val.data.getInteger());
} else {
- throw new IOException("GCM parameter parsing error: SEQ tag expected");
+ throw new IOException("GCM parameter parsing error: SEQ tag expected." +
+ " Received: " + val.tag);
}
}
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipher.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipher.java Thu Sep 17 09:19:40 2015 -0700
@@ -274,13 +274,14 @@
if (params != null) {
if (!(params instanceof IvParameterSpec)) {
throw new InvalidAlgorithmParameterException
- ("IvParameterSpec required");
+ ("IvParameterSpec required. Received: " +
+ params.getClass().getName());
} else {
ivBytes = ((IvParameterSpec) params).getIV();
if (ivBytes.length != blockSize) {
throw new InvalidAlgorithmParameterException
("Wrong IV length: must be " + blockSize +
- " bytes long");
+ " bytes long. Received length:" + ivBytes.length);
}
}
} else {
@@ -442,12 +443,13 @@
if (fixedKeySize == -1) {
// all 3 AES key lengths are allowed
if (keyLen != 16 && keyLen != 24 && keyLen != 32) {
- throw new InvalidKeyException("Key size is not valid");
+ throw new InvalidKeyException("Key size is not valid." +
+ " Got key length of: " + keyLen);
}
} else {
if (keyLen != fixedKeySize) {
throw new InvalidKeyException("Only " + fixedKeySize +
- "-byte keys are accepted");
+ "-byte keys are accepted. Got: " + keyLen);
}
}
// return the validated key length in bytes
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeCipherWithJavaPadding.java Thu Sep 17 09:19:40 2015 -0700
@@ -184,7 +184,7 @@
if (padValue < 1 || padValue > blockSize) {
UcryptoProvider.debug("PKCS5Padding: unpad, lastData: " + Arrays.toString(lastData));
UcryptoProvider.debug("PKCS5Padding: unpad, padValue=" + padValue);
- throw new BadPaddingException("Invalid pad value!");
+ throw new BadPaddingException("Invalid pad value: " + padValue);
}
// sanity check padding bytes
@@ -388,7 +388,7 @@
out = Arrays.copyOf(out, actualOut);
}
} catch (ShortBufferException sbe) {
- throw new UcryptoException("Internal Error");
+ throw new UcryptoException("Internal Error", sbe);
} finally {
reset();
}
@@ -404,7 +404,8 @@
int estimatedOutLen = engineGetOutputSize(inLen);
if (out.length - outOfs < estimatedOutLen) {
- throw new ShortBufferException();
+ throw new ShortBufferException("Actual: " + (out.length - outOfs) +
+ ". Estimated Out Length: " + estimatedOutLen);
}
try {
if (nc.encrypt) {
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeDigest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeDigest.java Thu Sep 17 09:19:40 2015 -0700
@@ -131,7 +131,8 @@
try {
int len = engineDigest(digest, 0, digestLen);
if (len != digestLen) {
- throw new UcryptoException("Digest length mismatch");
+ throw new UcryptoException("Digest length mismatch." +
+ " Len: " + len + ". digestLen: " + digestLen);
}
return digest;
} catch (DigestException de) {
@@ -144,10 +145,11 @@
throws DigestException {
if (len < digestLen) {
throw new DigestException("Output buffer must be at least " +
- digestLen + " bytes long");
+ digestLen + " bytes long. Got: " + len);
}
if ((ofs < 0) || (len < 0) || (ofs > out.length - len)) {
- throw new DigestException("Buffer too short to store digest");
+ throw new DigestException("Buffer too short to store digest. " +
+ "ofs: " + ofs + ". len: " + len + ". out.length: " + out.length);
}
if (pCtxt == null) {
@@ -177,7 +179,8 @@
return;
}
if ((ofs < 0) || (len < 0) || (ofs > in.length - len)) {
- throw new ArrayIndexOutOfBoundsException();
+ throw new ArrayIndexOutOfBoundsException("ofs: " + ofs + ". len: "
+ + len + ". in.length: " + in.length);
}
if (pCtxt == null) {
pCtxt = new DigestContextRef(this, nativeInit(mech), mech);
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeGCMCipher.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeGCMCipher.java Thu Sep 17 09:19:40 2015 -0700
@@ -188,7 +188,8 @@
byte[] ivBytes = null;
if (params != null) {
if (!(params instanceof GCMParameterSpec)) {
- throw new InvalidAlgorithmParameterException("GCMParameterSpec required");
+ throw new InvalidAlgorithmParameterException("GCMParameterSpec required." +
+ " Received: " + params.getClass().getName());
} else {
tagLen = ((GCMParameterSpec) params).getTLen();
ivBytes = ((GCMParameterSpec) params).getIV();
@@ -264,9 +265,9 @@
int outOfs) throws ShortBufferException {
int len = getOutputSizeByOperation(inLen, false);
if (out.length - outOfs < len) {
- throw new ShortBufferException("Output buffer must be "
- + "(at least) " + len
- + " bytes long");
+ throw new ShortBufferException("Output buffer must be " +
+ "(at least) " + len + " bytes long. Got: " +
+ (out.length - outOfs));
}
if (aadBuffer != null && aadBuffer.size() > 0) {
// init again with AAD data
@@ -365,8 +366,8 @@
int len = getOutputSizeByOperation(inLen, true);
if (out.length - outOfs < len) {
throw new ShortBufferException("Output buffer must be "
- + "(at least) " + len
- + " bytes long");
+ + "(at least) " + len + " bytes long. Got: " +
+ (out.length - outOfs));
}
if (aadBuffer != null && aadBuffer.size() > 0) {
// init again with AAD data
@@ -385,7 +386,8 @@
if (inLen < tagLen/8) {
// Otherwise, Solaris lib will error out w/ CRYPTO_BUFFER_TOO_SMALL
// when ucrypto_decrypt_final() is called
- throw new AEADBadTagException("Input too short - need tag");
+ throw new AEADBadTagException("Input too short - need tag." +
+ " inLen: " + inLen + ". tagLen: " + tagLen);
}
// refresh 'in' to all buffered-up bytes
in = ibuffer.toByteArray();
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeKey.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeKey.java Thu Sep 17 09:19:40 2015 -0700
@@ -94,7 +94,8 @@
pKey = nativeInit(NativeKey.getMagnitude(mod),
NativeKey.getMagnitude(privateExp));
} else {
- throw new InvalidKeySpecException("Only supports RSAPrivateKeySpec");
+ throw new InvalidKeySpecException("Only supports RSAPrivateKeySpec." +
+ " Received: " + keySpec.getClass().getName());
}
if (pKey == 0L) {
throw new UcryptoException("Error constructing RSA PrivateKey");
@@ -141,7 +142,8 @@
NativeKey.getMagnitude(primeExpQ),
NativeKey.getMagnitude(crtCoeff));
} else {
- throw new InvalidKeySpecException("Only supports RSAPrivateCrtKeySpec");
+ throw new InvalidKeySpecException("Only supports RSAPrivateCrtKeySpec."
+ + " Received: " + keySpec.getClass().getName());
}
if (pKey == 0L) {
throw new UcryptoException("Error constructing RSA PrivateCrtKey");
@@ -184,7 +186,8 @@
pKey = nativeInit(NativeKey.getMagnitude(mod),
NativeKey.getMagnitude(publicExp));
} else {
- throw new InvalidKeySpecException("Only supports RSAPublicKeySpec");
+ throw new InvalidKeySpecException("Only supports RSAPublicKeySpec." +
+ " Received: " + keySpec.getClass().getName());
}
if (pKey == 0L) {
throw new UcryptoException("Error constructing RSA PublicKey");
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSACipher.java Thu Sep 17 09:19:40 2015 -0700
@@ -159,7 +159,8 @@
@Override
protected int engineGetKeySize(Key key) throws InvalidKeyException {
if (!(key instanceof RSAKey)) {
- throw new InvalidKeyException("RSAKey required");
+ throw new InvalidKeyException("RSAKey required. Got: " +
+ key.getClass().getName());
}
int n = ((RSAKey)key).getModulus().bitLength();
// strip off the leading extra 0x00 byte prefix
@@ -206,9 +207,11 @@
// Make sure the proper opmode uses the proper key
if (doEncrypt && (!(newKey instanceof RSAPublicKey))) {
- throw new InvalidKeyException("RSAPublicKey required for encryption");
+ throw new InvalidKeyException("RSAPublicKey required for encryption." +
+ " Received: " + newKey.getClass().getName());
} else if (!doEncrypt && (!(newKey instanceof RSAPrivateKey))) {
- throw new InvalidKeyException("RSAPrivateKey required for decryption");
+ throw new InvalidKeyException("RSAPrivateKey required for decryption." +
+ " Received: " + newKey.getClass().getName());
}
NativeKey nativeKey = null;
@@ -237,13 +240,14 @@
privateKey.getPrimeExponentP(),
privateKey.getPrimeExponentQ(),
privateKey.getCrtCoefficient()));
- } else if (newKey instanceof RSAPrivateKey) {
+ } else if (newKey instanceof RSAPrivateKey) {
RSAPrivateKey privateKey = (RSAPrivateKey) newKey;
nativeKey = (NativeKey) keyFactory.engineGeneratePrivate
(new RSAPrivateKeySpec(privateKey.getModulus(),
privateKey.getPrivateExponent()));
} else {
- throw new InvalidKeyException("Unsupported type of RSAPrivateKey");
+ throw new InvalidKeyException("Unsupported type of RSAPrivateKey." +
+ " Received: " + newKey.getClass().getName());
}
} catch (InvalidKeySpecException ikse) {
throw new InvalidKeyException(ikse);
@@ -282,7 +286,8 @@
protected synchronized int engineUpdate(byte[] in, int inOfs, int inLen, byte[] out,
int outOfs) throws ShortBufferException {
if (out.length - outOfs < outputSize) {
- throw new ShortBufferException("Output buffer too small");
+ throw new ShortBufferException("Output buffer too small. outputSize: " +
+ outputSize + ". out.length: " + out.length + ". outOfs: " + outOfs);
}
if (inLen > 0) {
update(in, inOfs, inLen);
@@ -332,7 +337,9 @@
"the key to be wrapped");
}
if (encodedKey.length > buffer.length) {
- throw new InvalidKeyException("Key is too long for wrapping");
+ throw new InvalidKeyException("Key is too long for wrapping. " +
+ "encodedKey.length: " + encodedKey.length +
+ ". buffer.length: " + buffer.length);
}
return engineDoFinal(encodedKey, 0, encodedKey.length);
} catch (BadPaddingException e) {
@@ -349,7 +356,9 @@
throws InvalidKeyException, NoSuchAlgorithmException {
if (wrappedKey.length > buffer.length) {
- throw new InvalidKeyException("Key is too long for unwrapping");
+ throw new InvalidKeyException("Key is too long for unwrapping." +
+ " wrappedKey.length: " + wrappedKey.length +
+ ". buffer.length: " + buffer.length);
}
boolean isTlsRsaPremasterSecret =
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSAKeyFactory.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSAKeyFactory.java Thu Sep 17 09:19:40 2015 -0700
@@ -56,7 +56,8 @@
} else if (keySpec instanceof RSAPrivateKeySpec) {
return new NativeKey.RSAPrivate(keySpec);
} else {
- throw new InvalidKeySpecException("Unsupported key spec");
+ throw new InvalidKeySpecException("Unsupported key spec." +
+ " Received: " + keySpec.getClass().getName());
}
}
--- a/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSASignature.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/src/jdk.crypto.ucrypto/solaris/classes/com/oracle/security/ucrypto/NativeRSASignature.java Thu Sep 17 09:19:40 2015 -0700
@@ -192,7 +192,8 @@
// Need to check RSA key length whenever a new private key is set
if (privateKey != key) {
if (!(privateKey instanceof RSAPrivateKey)) {
- throw new InvalidKeyException("RSAPrivateKey required");
+ throw new InvalidKeyException("RSAPrivateKey required. " +
+ "Received: " + privateKey.getClass().getName());
}
RSAPrivateKey rsaPrivKey = (RSAPrivateKey) privateKey;
BigInteger mod = rsaPrivKey.getModulus();
@@ -242,7 +243,8 @@
throw new InvalidKeyException(ikse);
}
} else {
- throw new InvalidKeyException("RSAPublicKey required");
+ throw new InvalidKeyException("RSAPublicKey required. " +
+ "Received: " + publicKey.getClass().getName());
}
}
init(false, newKey, newSigLength);
@@ -269,7 +271,8 @@
throws SignatureException {
if (outbuf == null || (offset < 0) || (outbuf.length < (offset + sigLength))
|| (len < sigLength)) {
- throw new SignatureException("Invalid output buffer");
+ throw new SignatureException("Invalid output buffer. offset: " +
+ offset + ". len: " + len + ". sigLength: " + sigLength);
}
int rv = doFinal(outbuf, offset, sigLength);
if (rv < 0) {
@@ -328,7 +331,8 @@
throws SignatureException {
if (sigBytes == null || (sigOfs < 0) || (sigBytes.length < (sigOfs + this.sigLength))
|| (sigLen < this.sigLength)) {
- throw new SignatureException("Invalid signature buffer");
+ throw new SignatureException("Invalid signature buffer. sigOfs: " +
+ sigOfs + ". sigLen: " + sigLen + ". this.sigLength: " + this.sigLength);
}
int rv = doFinal(sigBytes, sigOfs, sigLen);
@@ -405,7 +409,8 @@
// returns 0 (success) or negative (ucrypto error occurred)
private int update(byte[] in, int inOfs, int inLen) {
if (inOfs < 0 || inOfs + inLen > in.length) {
- throw new ArrayIndexOutOfBoundsException();
+ throw new ArrayIndexOutOfBoundsException("inOfs :" + inOfs +
+ ". inLen: " + inLen + ". in.length: " + in.length);
}
ensureInitialized();
int k = nativeUpdate(pCtxt.id, sign, in, inOfs, inLen);
@@ -442,7 +447,8 @@
int maxDataSize = keySize - PKCS1PADDING_LEN;
if (maxDataSize < encodedLen) {
throw new InvalidKeyException
- ("Key is too short for this signature algorithm");
+ ("Key is too short for this signature algorithm. maxDataSize: " +
+ maxDataSize + ". encodedLen: " + encodedLen);
}
return keySize;
}
--- a/jdk/test/ProblemList.txt Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/ProblemList.txt Thu Sep 17 09:19:40 2015 -0700
@@ -133,9 +133,6 @@
# 8029891
java/lang/ClassLoader/deadlock/GetResource.java generic-all
-# 8133552
-java/lang/ProcessHandle/InfoTest.java generic-all
-
############################################################################
# jdk_instrument
--- a/jdk/test/TEST.ROOT Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/TEST.ROOT Thu Sep 17 09:19:40 2015 -0700
@@ -23,5 +23,8 @@
# Group definitions
groups=TEST.groups [closed/TEST.groups]
+# Allow querying of sun.arch.data.model in @requires clauses
+requires.properties=sun.arch.data.model
+
# Tests using jtreg 4.1 b11 features
requiredVersion=4.1 b11
--- a/jdk/test/com/oracle/security/ucrypto/CipherSignNotSupported.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/com/oracle/security/ucrypto/CipherSignNotSupported.java Thu Sep 17 09:19:40 2015 -0700
@@ -23,7 +23,7 @@
/**
* @test
- * @bug 8029849 8132082
+ * @bug 8029849 8132082 8133535
* @summary Make sure signing via encrypt and verifying via decrypt are not
* supported by OracleUcrypto provider.
* @author Anthony Scarpino
@@ -89,8 +89,7 @@
ct = c.doFinal(pt);
throw new RuntimeException("Encrypt operation should have failed.");
} catch (InvalidKeyException e) {
- if (e.getMessage().compareTo("RSAPublicKey required for " +
- "encryption") != 0) {
+ if (!e.getMessage().contains("RSAPublicKey required for encryption")) {
System.out.println("Wrong exception thrown.");
throw e;
}
@@ -103,8 +102,7 @@
c.doFinal(ct);
throw new RuntimeException("Decrypt operation should have failed.");
} catch (InvalidKeyException e) {
- if (e.getMessage().compareTo("RSAPrivateKey required for " +
- "decryption") != 0) {
+ if (!e.getMessage().contains("RSAPrivateKey required for decryption")) {
System.out.println("Wrong exception thrown.");
throw e;
}
--- a/jdk/test/java/io/File/MaxPathLength.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/File/MaxPathLength.java Thu Sep 17 09:19:40 2015 -0700
@@ -39,7 +39,7 @@
"areallylongfilenamethatsforsur";
private static boolean isWindows = false;
- private final static int MAX_LENGTH = 256;
+ private static final int MAX_LENGTH = 256;
private static int counter = 0;
--- a/jdk/test/java/io/File/SymLinks.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/File/SymLinks.java Thu Sep 17 09:19:40 2015 -0700
@@ -34,22 +34,22 @@
import static java.nio.file.LinkOption.*;
public class SymLinks {
- final static PrintStream out = System.out;
+ static final PrintStream out = System.out;
- final static File top = new File(System.getProperty("test.dir", "."));
+ static final File top = new File(System.getProperty("test.dir", "."));
// files used by the test
- final static File file = new File(top, "foofile");
- final static File link2file = new File(top, "link2file");
- final static File link2link2file = new File(top, "link2link2file");
+ static final File file = new File(top, "foofile");
+ static final File link2file = new File(top, "link2file");
+ static final File link2link2file = new File(top, "link2link2file");
- final static File dir = new File(top, "foodir");
- final static File link2dir = new File(top, "link2dir");
- final static File link2link2dir = new File(top, "link2link2dir");
+ static final File dir = new File(top, "foodir");
+ static final File link2dir = new File(top, "link2dir");
+ static final File link2link2dir = new File(top, "link2link2dir");
- final static File link2nobody = new File(top, "link2nobody");
- final static File link2link2nobody = new File(top, "link2link2nobody");
+ static final File link2nobody = new File(top, "link2nobody");
+ static final File link2link2nobody = new File(top, "link2link2nobody");
/**
* Setup files, directories, and sym links used by test.
--- a/jdk/test/java/io/FileDescriptor/Sharing.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/FileDescriptor/Sharing.java Thu Sep 17 09:19:40 2015 -0700
@@ -35,8 +35,8 @@
public class Sharing {
- final static int numFiles = 10;
- volatile static boolean fail;
+ static final int numFiles = 10;
+ static volatile boolean fail;
public static void main(String[] args) throws Exception {
TestFinalizer();
--- a/jdk/test/java/io/IOException/LastErrorString.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/IOException/LastErrorString.java Thu Sep 17 09:19:40 2015 -0700
@@ -65,7 +65,7 @@
}
- static abstract class Test {
+ abstract static class Test {
String name;
@@ -73,7 +73,7 @@
this.name = name;
}
- abstract public void run() throws IOException;
+ public abstract void run() throws IOException;
public void go() throws IOException {
try {
@@ -88,7 +88,7 @@
}
- static abstract class ClosedFISTest extends Test {
+ abstract static class ClosedFISTest extends Test {
FileInputStream in;
@@ -104,7 +104,7 @@
}
- static abstract class ClosedFOSTest extends Test {
+ abstract static class ClosedFOSTest extends Test {
FileOutputStream out;
@@ -120,7 +120,7 @@
}
- static abstract class ClosedRAFTest extends Test {
+ abstract static class ClosedRAFTest extends Test {
RandomAccessFile raf;
@@ -136,7 +136,7 @@
}
- static abstract class ReadOnlyRAFTest extends Test {
+ abstract static class ReadOnlyRAFTest extends Test {
RandomAccessFile raf;
--- a/jdk/test/java/io/InputStreamReader/One.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/InputStreamReader/One.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,7 +32,7 @@
public class One {
- private static abstract class Test {
+ private abstract static class Test {
InputStreamReader isr;
StringBuffer sb;
--- a/jdk/test/java/io/PrintStream/OversynchronizedTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/PrintStream/OversynchronizedTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -87,7 +87,7 @@
System.out.println("In test().");
}
- synchronized public String toString() {
+ public synchronized String toString() {
System.out.println("Calling toString\n");
return mStr;
}
--- a/jdk/test/java/io/PrintWriter/OversynchronizedTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/PrintWriter/OversynchronizedTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -87,7 +87,7 @@
writer.println("In test().");
}
- synchronized public String toString() {
+ public synchronized String toString() {
writer.println("Calling toString\n");
return mStr;
}
--- a/jdk/test/java/io/Serializable/defaulted/GetFieldRead.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/defaulted/GetFieldRead.java Thu Sep 17 09:19:40 2015 -0700
@@ -35,7 +35,7 @@
private static final long serialVersionUID=5748652654655279289L;
// Fields to be serialized.
- private final static ObjectStreamField[] serialPersistentFields = {
+ private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("objectI", Integer.class),
new ObjectStreamField("primitiveI", Integer.TYPE),
new ObjectStreamField("foo", Foo.class)
--- a/jdk/test/java/io/Serializable/defaulted/GetFieldWrite.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/defaulted/GetFieldWrite.java Thu Sep 17 09:19:40 2015 -0700
@@ -42,7 +42,7 @@
private static final long serialVersionUID = 5748652654655279289L;
// Fields to be serialized.
- private final static ObjectStreamField[] serialPersistentFields = {
+ private static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("objectI", Integer.class)};
Integer objectI;
--- a/jdk/test/java/io/Serializable/evolution/RenamePackage/extension/ExtendedObjectInputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/evolution/RenamePackage/extension/ExtendedObjectInputStream.java Thu Sep 17 09:19:40 2015 -0700
@@ -28,7 +28,7 @@
public class ExtendedObjectInputStream extends ObjectInputStream {
- static private Hashtable renamedClassMap;
+ private static Hashtable renamedClassMap;
public ExtendedObjectInputStream(InputStream si)
throws IOException, StreamCorruptedException
@@ -49,7 +49,7 @@
return super.resolveClass(v);
}
- static public void addRenamedClassName(String oldName, String newName)
+ public static void addRenamedClassName(String oldName, String newName)
throws ClassNotFoundException
{
Class cl = null;
--- a/jdk/test/java/io/Serializable/oldTests/CheckingEquality.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/oldTests/CheckingEquality.java Thu Sep 17 09:19:40 2015 -0700
@@ -181,7 +181,7 @@
private static int seven[];
protected byte eight = (byte)9;
- final static byte dcare = (byte) 128;
+ static final byte dcare = (byte) 128;
private short nine = 8888;
long ten;
java.util.Enumeration zero;
--- a/jdk/test/java/io/Serializable/subclass/AbstractObjectInputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/subclass/AbstractObjectInputStream.java Thu Sep 17 09:19:40 2015 -0700
@@ -143,7 +143,7 @@
* @see java.io.ext.AbstractObjectOutputStream
* @since JDK1.2
*/
-abstract public class AbstractObjectInputStream extends ObjectInputStream
+public abstract class AbstractObjectInputStream extends ObjectInputStream
{
protected InputStream in;
/**
@@ -167,7 +167,7 @@
this.in = in;
}
- abstract public void close() throws IOException;
+ public abstract void close() throws IOException;
/***************************************************************/
/* Read an object from the stream. */
@@ -230,7 +230,7 @@
* @exception ClassNotFoundException if no corresponding local class can be
* found in the local JVM.
*/
- abstract public void defaultReadObject()
+ public abstract void defaultReadObject()
throws IOException, ClassNotFoundException, NotActiveException;
/**
@@ -252,7 +252,7 @@
* <STRONG>ofClass</STRONG>.
* @exception InstantiationException TBD.
*/
- final protected native Object
+ protected final native Object
allocateNewObject(Class ofClass, Class ctorClass)
throws InstantiationException, IllegalAccessException;
@@ -270,7 +270,7 @@
* @exception IllegalAccessException TBD.
* @exception InstantiationException TBD.
*/
- final protected native Object
+ protected final native Object
allocateNewArray(Class componentClass, int length)
throws InstantiationException, IllegalAccessException;
@@ -283,12 +283,12 @@
* @exception IOException if an I/O error occurs.
* @exception NotActiveException if readObject() is not currently active.
*/
- abstract public ObjectInputStream.GetField readFields()
+ public abstract ObjectInputStream.GetField readFields()
throws IOException, ClassNotFoundException, NotActiveException;
- abstract protected boolean enableResolveObject(boolean enable) throws SecurityException;
+ protected abstract boolean enableResolveObject(boolean enable) throws SecurityException;
- abstract public void registerValidation(ObjectInputValidation obj,
+ public abstract void registerValidation(ObjectInputValidation obj,
int prio)
throws NotActiveException, InvalidObjectException;
@@ -297,25 +297,25 @@
/* Use DataInput methods to read primitive data from the stream. */
- abstract public int read() throws IOException;
- abstract public int read(byte[] data, int offset, int length)
+ public abstract int read() throws IOException;
+ public abstract int read(byte[] data, int offset, int length)
throws IOException;
- abstract public boolean readBoolean() throws IOException;
- abstract public byte readByte() throws IOException;
- abstract public int readUnsignedByte() throws IOException;
- abstract public short readShort() throws IOException;
- abstract public int readUnsignedShort() throws IOException;
- abstract public char readChar() throws IOException;
- abstract public int readInt() throws IOException;
- abstract public long readLong() throws IOException;
- abstract public float readFloat() throws IOException;
- abstract public double readDouble() throws IOException;
- abstract public void readFully(byte[] data) throws IOException;
- abstract public void readFully(byte[] data, int offset, int size) throws IOException;
- abstract public String readUTF() throws IOException;
- abstract public int available() throws IOException;
- abstract public int skipBytes(int len) throws IOException;
+ public abstract boolean readBoolean() throws IOException;
+ public abstract byte readByte() throws IOException;
+ public abstract int readUnsignedByte() throws IOException;
+ public abstract short readShort() throws IOException;
+ public abstract int readUnsignedShort() throws IOException;
+ public abstract char readChar() throws IOException;
+ public abstract int readInt() throws IOException;
+ public abstract long readLong() throws IOException;
+ public abstract float readFloat() throws IOException;
+ public abstract double readDouble() throws IOException;
+ public abstract void readFully(byte[] data) throws IOException;
+ public abstract void readFully(byte[] data, int offset, int size) throws IOException;
+ public abstract String readUTF() throws IOException;
+ public abstract int available() throws IOException;
+ public abstract int skipBytes(int len) throws IOException;
/* @deprecated */
- abstract public String readLine() throws IOException;
+ public abstract String readLine() throws IOException;
};
--- a/jdk/test/java/io/Serializable/subclass/AbstractObjectOutputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/subclass/AbstractObjectOutputStream.java Thu Sep 17 09:19:40 2015 -0700
@@ -134,7 +134,7 @@
*
* @since JDK1.2
*/
-abstract public class AbstractObjectOutputStream extends ObjectOutputStream
+public abstract class AbstractObjectOutputStream extends ObjectOutputStream
{
protected OutputStream out;
/* Stream Management Methods. */
@@ -156,9 +156,9 @@
this.out = out;
}
- abstract public void reset() throws IOException;
- abstract protected void drain() throws IOException;
- abstract public void close() throws IOException;
+ public abstract void reset() throws IOException;
+ protected abstract void drain() throws IOException;
+ public abstract void close() throws IOException;
/*******************************************************************/
@@ -214,14 +214,14 @@
* @exception NotActiveException Thrown if a writeObject method is not
* active.
*/
- abstract public void defaultWriteObject() throws IOException;
+ public abstract void defaultWriteObject() throws IOException;
/*************************************************************/
/* Use the methods of PutField to map between Serializable fields
* and actual fields of a Serializable class.
*/
- abstract public ObjectOutputStream.PutField putFields() throws IOException;
+ public abstract ObjectOutputStream.PutField putFields() throws IOException;
/**
* Note: The PutField being serialized is not passed to this method.
@@ -229,25 +229,25 @@
* the state of the last putFields call and
* only allowed this method to be invoked for that PutFields object.
*/
- abstract public void writeFields() throws IOException;
+ public abstract void writeFields() throws IOException;
- abstract protected boolean enableReplaceObject(boolean enable) throws SecurityException;
+ protected abstract boolean enableReplaceObject(boolean enable) throws SecurityException;
/*******************************************************************/
/* Write Primitive Data to stream. DataOutput methods. */
- abstract public void write(int data) throws IOException;
- abstract public void write(byte b[]) throws IOException;
- abstract public void write(byte b[], int off, int len) throws IOException;
- abstract public void writeBoolean(boolean data) throws IOException;
- abstract public void writeByte(int data) throws IOException;
- abstract public void writeShort(int data) throws IOException;
- abstract public void writeChar(int data) throws IOException;
- abstract public void writeInt(int data) throws IOException;
- abstract public void writeLong(long data) throws IOException;
- abstract public void writeFloat(float data) throws IOException;
- abstract public void writeDouble(double data) throws IOException;
- abstract public void writeBytes(String data) throws IOException;
- abstract public void writeChars(String data) throws IOException;
- abstract public void writeUTF(String data) throws IOException;
+ public abstract void write(int data) throws IOException;
+ public abstract void write(byte b[]) throws IOException;
+ public abstract void write(byte b[], int off, int len) throws IOException;
+ public abstract void writeBoolean(boolean data) throws IOException;
+ public abstract void writeByte(int data) throws IOException;
+ public abstract void writeShort(int data) throws IOException;
+ public abstract void writeChar(int data) throws IOException;
+ public abstract void writeInt(int data) throws IOException;
+ public abstract void writeLong(long data) throws IOException;
+ public abstract void writeFloat(float data) throws IOException;
+ public abstract void writeDouble(double data) throws IOException;
+ public abstract void writeBytes(String data) throws IOException;
+ public abstract void writeChars(String data) throws IOException;
+ public abstract void writeUTF(String data) throws IOException;
};
--- a/jdk/test/java/io/Serializable/subclass/Test.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/subclass/Test.java Thu Sep 17 09:19:40 2015 -0700
@@ -49,7 +49,7 @@
*/
class B implements Serializable {
public int publicIntField;
- static public int numWriteObjectCalled = 0;
+ public static int numWriteObjectCalled = 0;
B(int v) {
publicIntField = v;
}
@@ -73,7 +73,7 @@
class C implements Serializable {
public int xx1;
public int xx2;
- final static ObjectStreamField[] serialPersistentFields = {
+ static final ObjectStreamField[] serialPersistentFields = {
new ObjectStreamField("x1", Integer.TYPE),
new ObjectStreamField("x2", Integer.TYPE),
new ObjectStreamField("x3", Integer.TYPE),
@@ -112,7 +112,7 @@
};
public class Test {
- static public void main(String argv[])
+ public static void main(String argv[])
throws IOException, ClassNotFoundException
{
boolean expectSecurityException = false;
--- a/jdk/test/java/io/Serializable/subclass/XObjectInputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/subclass/XObjectInputStream.java Thu Sep 17 09:19:40 2015 -0700
@@ -37,12 +37,12 @@
dis = new DataInputStream(in);
}
- final public void defaultReadObject()
+ public final void defaultReadObject()
throws IOException, ClassNotFoundException, NotActiveException
{
}
- final protected Object readObjectOverride()
+ protected final Object readObjectOverride()
throws OptionalDataException, ClassNotFoundException, IOException {
Object readResult = null;
@@ -256,7 +256,7 @@
* Set the accessible flag on it here. ObjectOutputStream
* will call it as necessary.
*/
- static public Method getReadObjectMethod(final Class cl) {
+ public static Method getReadObjectMethod(final Class cl) {
Method readObjectMethod = (Method)
java.security.AccessController.doPrivileged
@@ -286,7 +286,7 @@
/*************************************************************/
/* taken verbatim from ObjectInputStream. */
- static private void invokeMethod(final Object obj, final Method m,
+ private static void invokeMethod(final Object obj, final Method m,
final Object[] argList)
throws IOException
{
--- a/jdk/test/java/io/Serializable/subclass/XObjectOutputStream.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/subclass/XObjectOutputStream.java Thu Sep 17 09:19:40 2015 -0700
@@ -53,7 +53,7 @@
super.writeStreamHeader();
}
- final protected void writeObjectOverride(Object obj) throws IOException {
+ protected final void writeObjectOverride(Object obj) throws IOException {
Object prevCurrentObject = currentObject;
currentObject = obj;
System.out.println("writeObjectOverride(" + obj.toString() + ")");
@@ -300,7 +300,7 @@
* Set the accessible flag on it here.
* Subclass of AbstractObjectOutputStream will call it as necessary.
*/
- static public Method getWriteObjectMethod(final Class cl) {
+ public static Method getWriteObjectMethod(final Class cl) {
Method writeObjectMethod = (Method)
java.security.AccessController.doPrivileged
@@ -330,7 +330,7 @@
/*************************************************************/
/* CODE LIFTED FROM ObjectOutputStream. */
- static private void invokeMethod(final Object obj, final Method m,
+ private static void invokeMethod(final Object obj, final Method m,
final Object[] argList)
throws IOException
{
--- a/jdk/test/java/io/Serializable/typeSafeEnum/TypeSafeEnum.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/Serializable/typeSafeEnum/TypeSafeEnum.java Thu Sep 17 09:19:40 2015 -0700
@@ -39,9 +39,9 @@
this.value = value;
}
- final public static TypeSafeEnum FIRST = new TypeSafeEnum("First");
- final public static TypeSafeEnum SECOND = new TypeSafeEnum("Second");
- final public static TypeSafeEnum THIRD = new TypeSafeEnum("Third");
+ public static final TypeSafeEnum FIRST = new TypeSafeEnum("First");
+ public static final TypeSafeEnum SECOND = new TypeSafeEnum("Second");
+ public static final TypeSafeEnum THIRD = new TypeSafeEnum("Third");
static int numReadResolve = 0;
static int numWriteReplace = 0;
static boolean verbose = false;
--- a/jdk/test/java/io/StreamTokenizer/ReadAhead.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/io/StreamTokenizer/ReadAhead.java Thu Sep 17 09:19:40 2015 -0700
@@ -39,7 +39,7 @@
/* An InputStream subclass that cannot read past a given limit */
- static private class LimitedInputStream extends InputStream {
+ private static class LimitedInputStream extends InputStream {
private String input;
private int limit; /* Do not allow input[limit] to be read */
@@ -60,7 +60,7 @@
/* A Reader subclass that cannot read past a given limit */
- static private class LimitedReader extends Reader {
+ private static class LimitedReader extends Reader {
private String input;
private int limit; /* Do not allow input[limit] to be read */
@@ -95,11 +95,11 @@
/* Interface for objects that can create new StreamTokenizers
with a given limited input */
- static private interface StreamTokenizerMaker {
+ private static interface StreamTokenizerMaker {
public StreamTokenizer create(String input, int limit);
}
- static private void fail(String why) throws Exception {
+ private static void fail(String why) throws Exception {
throw new Exception(why);
}
--- a/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/Class/getDeclaredField/ClassDeclaredFieldsTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -135,7 +135,7 @@
}
// A Helper class to build a set of permissions.
- final static class PermissionsBuilder {
+ static final class PermissionsBuilder {
final Permissions perms;
public PermissionsBuilder() {
this(new Permissions());
--- a/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/Class/getDeclaredField/FieldSetAccessibleTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -301,7 +301,7 @@
}
// A Helper class to build a set of permissions.
- final static class PermissionsBuilder {
+ static final class PermissionsBuilder {
final Permissions perms;
public PermissionsBuilder() {
this(new Permissions());
--- a/jdk/test/java/lang/Enum/ValueOf.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/Enum/ValueOf.java Thu Sep 17 09:19:40 2015 -0700
@@ -219,7 +219,7 @@
FOO {
public void foo() {}
};
- abstract public void foo();
+ public abstract void foo();
};
}
--- a/jdk/test/java/lang/ProcessBuilder/Basic.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/ProcessBuilder/Basic.java Thu Sep 17 09:19:40 2015 -0700
@@ -653,7 +653,7 @@
}
static class EnglishUnix {
- private final static Boolean is =
+ private static final Boolean is =
(! Windows.is() && isEnglish("LANG") && isEnglish("LC_ALL"));
private static boolean isEnglish(String envvar) {
--- a/jdk/test/java/lang/ProcessHandle/InfoTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/ProcessHandle/InfoTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -257,10 +257,15 @@
}
}
}
- p1.waitFor(Utils.adjustTimeout(5), TimeUnit.SECONDS);
+ p1.sendAction("exit");
+ Assert.assertTrue(p1.waitFor(Utils.adjustTimeout(30L), TimeUnit.SECONDS),
+ "timeout waiting for process to terminate");
} catch (IOException | InterruptedException ie) {
ie.printStackTrace(System.out);
Assert.fail("unexpected exception", ie);
+ } finally {
+ // Destroy any children that still exist
+ ProcessUtil.destroyProcessTree(ProcessHandle.current());
}
}
@@ -270,8 +275,9 @@
@Test
public static void test3() {
try {
- for (int sleepTime : Arrays.asList(1, 2)) {
+ for (long sleepTime : Arrays.asList(Utils.adjustTimeout(30), Utils.adjustTimeout(32))) {
Process p = spawn("sleep", String.valueOf(sleepTime));
+
ProcessHandle.Info info = p.info();
System.out.printf(" info: %s%n", info);
@@ -297,7 +303,9 @@
Assert.assertEquals(args[0], String.valueOf(sleepTime));
}
}
- Assert.assertTrue(p.waitFor(15, TimeUnit.SECONDS));
+ p.destroy();
+ Assert.assertTrue(p.waitFor(Utils.adjustTimeout(30), TimeUnit.SECONDS),
+ "timeout waiting for process to terminate");
}
} catch (IOException | InterruptedException ex) {
ex.printStackTrace(System.out);
--- a/jdk/test/java/lang/Runtime/exec/ExitValue.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/Runtime/exec/ExitValue.java Thu Sep 17 09:19:40 2015 -0700
@@ -72,7 +72,7 @@
expectedExitValue);
}
- final static int EXIT_CODE = 5;
+ static final int EXIT_CODE = 5;
public static void main(String[] args) throws Exception {
if (! UnixCommands.isUnix) {
--- a/jdk/test/java/lang/SecurityManager/CheckPackageMatching.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/SecurityManager/CheckPackageMatching.java Thu Sep 17 09:19:40 2015 -0700
@@ -55,7 +55,7 @@
* PackageMatcher implements a state machine that matches package
* names against packages parsed from the package access list.
*/
- private static abstract class PackageMatcher {
+ private abstract static class PackageMatcher {
// For each state, chars[state] contains the chars that matches.
private final char[][] chars;
// For each state, states[state][i] contains the next state to go
--- a/jdk/test/java/lang/String/StringContentEqualsBug.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/String/StringContentEqualsBug.java Thu Sep 17 09:19:40 2015 -0700
@@ -28,7 +28,7 @@
*/
public class StringContentEqualsBug {
- static abstract class Task extends Thread {
+ abstract static class Task extends Thread {
volatile StringBuffer sb;
volatile Exception exception;
--- a/jdk/test/java/lang/String/StringJoinTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/String/StringJoinTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -34,17 +34,17 @@
@Test(groups = {"unit","string","lang","libs"})
public class StringJoinTest {
- private final static String DASH = "-";
- private final static String BEGIN = "Hi there";
- private final static String JIM = "Jim";
- private final static String JOHN = "John";
- private final static String AND_JOE = "and Joe";
- private final static String BILL = "Bill";
- private final static String BOB = "Bob";
- private final static String AND_BO = "and Bo";
- private final static String ZEKE = "Zeke";
- private final static String ZACK = "Zack";
- private final static String AND_ZOE = "and Zoe";
+ private static final String DASH = "-";
+ private static final String BEGIN = "Hi there";
+ private static final String JIM = "Jim";
+ private static final String JOHN = "John";
+ private static final String AND_JOE = "and Joe";
+ private static final String BILL = "Bill";
+ private static final String BOB = "Bob";
+ private static final String AND_BO = "and Bo";
+ private static final String ZEKE = "Zeke";
+ private static final String ZACK = "Zack";
+ private static final String AND_ZOE = "and Zoe";
/**
* Tests the join() methods on String
--- a/jdk/test/java/lang/StringBuffer/BufferForwarding.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/StringBuffer/BufferForwarding.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,10 +32,10 @@
import java.util.List;
public class BufferForwarding {
- private final static String A_STRING_BUFFER_VAL = "aStringBuffer";
- private final static String A_STRING_BUILDER_VAL = "aStringBuilder";
- private final static String A_STRING_VAL = "aString";
- private final static String NON_EMPTY_VAL = "NonEmpty";
+ private static final String A_STRING_BUFFER_VAL = "aStringBuffer";
+ private static final String A_STRING_BUILDER_VAL = "aStringBuilder";
+ private static final String A_STRING_VAL = "aString";
+ private static final String NON_EMPTY_VAL = "NonEmpty";
public BufferForwarding() {
System.out.println( "Starting BufferForwarding");
--- a/jdk/test/java/lang/StringBuilder/BuilderForwarding.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/StringBuilder/BuilderForwarding.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,10 +32,10 @@
import java.util.List;
public class BuilderForwarding {
- private final static String A_STRING_BUFFER_VAL = "aStringBuffer";
- private final static String A_STRING_BUILDER_VAL = "aStringBuilder";
- private final static String A_STRING_VAL = "aString";
- private final static String NON_EMPTY_VAL = "NonEmpty";
+ private static final String A_STRING_BUFFER_VAL = "aStringBuffer";
+ private static final String A_STRING_BUILDER_VAL = "aStringBuilder";
+ private static final String A_STRING_VAL = "aString";
+ private static final String NON_EMPTY_VAL = "NonEmpty";
public BuilderForwarding() {
System.out.println( "Starting BuilderForwarding");
--- a/jdk/test/java/lang/System/finalization/FinThreads.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/System/finalization/FinThreads.java Thu Sep 17 09:19:40 2015 -0700
@@ -44,7 +44,7 @@
/* Instances are only created in an auxiliary thread, in order to
guard against stray references from the current thread's stack
*/
- static public void create(final boolean catchFinalizer)
+ public static void create(final boolean catchFinalizer)
throws InterruptedException
{
Thread t = new Thread(new Runnable() {
--- a/jdk/test/java/lang/Thread/GenerifyStackTraces.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/Thread/GenerifyStackTraces.java Thu Sep 17 09:19:40 2015 -0700
@@ -120,7 +120,7 @@
}
- static private void waitForDump() {
+ private static void waitForDump() {
synchronized(go) {
try {
go.wait();
@@ -130,7 +130,7 @@
}
}
- static private void finishDump() {
+ private static void finishDump() {
synchronized(go) {
try {
go.notifyAll();
--- a/jdk/test/java/lang/ThreadLocal/ImmutableLocal.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/ThreadLocal/ImmutableLocal.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,13 +32,13 @@
/**
* {@link ThreadLocal} guaranteed to always return the same reference.
*/
- abstract public static class ImmutableThreadLocal extends ThreadLocal {
+ public abstract static class ImmutableThreadLocal extends ThreadLocal {
public void set(final Object value) {
throw new RuntimeException("ImmutableThreadLocal set called");
}
// force override
- abstract protected Object initialValue();
+ protected abstract Object initialValue();
}
private static final ThreadLocal cache = new ImmutableThreadLocal() {
--- a/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedInterfaces.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedInterfaces.java Thu Sep 17 09:19:40 2015 -0700
@@ -76,5 +76,5 @@
interface If {}
- static abstract class Clz {}
+ abstract static class Clz {}
}
--- a/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedSuperclass.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/annotation/typeAnnotations/GetAnnotatedSuperclass.java Thu Sep 17 09:19:40 2015 -0700
@@ -94,5 +94,5 @@
interface If {}
- static abstract class Clz {}
+ abstract static class Clz {}
}
--- a/jdk/test/java/lang/instrument/ATestCaseScaffold.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/instrument/ATestCaseScaffold.java Thu Sep 17 09:19:40 2015 -0700
@@ -169,7 +169,7 @@
assertEquals("Expected equality", expected, actual);
}
- public final static class
+ public static final class
TestCaseScaffoldException extends RuntimeException {
public
TestCaseScaffoldException() {
--- a/jdk/test/java/lang/invoke/6998541/Test6998541.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/6998541/Test6998541.java Thu Sep 17 09:19:40 2015 -0700
@@ -136,7 +136,7 @@
throw new AssertionError();
}
- private final static MethodHandles.Lookup lookup = MethodHandles.lookup();
+ private static final MethodHandles.Lookup lookup = MethodHandles.lookup();
private static MethodHandle mh(Class ret, Class... args) {
try {
@@ -191,14 +191,14 @@
private static MethodHandle mh_z(Class ret) { return mh(ret, boolean.class); }
- private final static MethodHandle mh_zz = mh_z(boolean.class);
- private final static MethodHandle mh_bz = mh_z(byte.class );
- private final static MethodHandle mh_cz = mh_z(char.class );
- private final static MethodHandle mh_sz = mh_z(short.class );
- private final static MethodHandle mh_iz = mh_z(int.class );
- private final static MethodHandle mh_jz = mh_z(long.class );
- private final static MethodHandle mh_fz = mh_z(float.class );
- private final static MethodHandle mh_dz = mh_z(double.class );
+ private static final MethodHandle mh_zz = mh_z(boolean.class);
+ private static final MethodHandle mh_bz = mh_z(byte.class );
+ private static final MethodHandle mh_cz = mh_z(char.class );
+ private static final MethodHandle mh_sz = mh_z(short.class );
+ private static final MethodHandle mh_iz = mh_z(int.class );
+ private static final MethodHandle mh_jz = mh_z(long.class );
+ private static final MethodHandle mh_fz = mh_z(float.class );
+ private static final MethodHandle mh_dz = mh_z(double.class );
private static void boolean2prim(boolean x) throws Throwable {
int i = x ? 1 : 0;
@@ -225,14 +225,14 @@
private static MethodHandle mh_b(Class ret) { return mh(ret, byte.class); }
- private final static MethodHandle mh_zb = mh_b(boolean.class);
- private final static MethodHandle mh_bb = mh_b(byte.class );
- private final static MethodHandle mh_cb = mh_b(char.class );
- private final static MethodHandle mh_sb = mh_b(short.class );
- private final static MethodHandle mh_ib = mh_b(int.class );
- private final static MethodHandle mh_jb = mh_b(long.class );
- private final static MethodHandle mh_fb = mh_b(float.class );
- private final static MethodHandle mh_db = mh_b(double.class );
+ private static final MethodHandle mh_zb = mh_b(boolean.class);
+ private static final MethodHandle mh_bb = mh_b(byte.class );
+ private static final MethodHandle mh_cb = mh_b(char.class );
+ private static final MethodHandle mh_sb = mh_b(short.class );
+ private static final MethodHandle mh_ib = mh_b(int.class );
+ private static final MethodHandle mh_jb = mh_b(long.class );
+ private static final MethodHandle mh_fb = mh_b(float.class );
+ private static final MethodHandle mh_db = mh_b(double.class );
private static void byte2prim(byte x) throws Throwable {
assertEquals((byte) x, (byte) mh_bb.invokeExact(x)); // byte -> byte
@@ -254,14 +254,14 @@
private static MethodHandle mh_c(Class ret) { return mh(ret, char.class); }
- private final static MethodHandle mh_zc = mh_c(boolean.class);
- private final static MethodHandle mh_bc = mh_c(byte.class );
- private final static MethodHandle mh_cc = mh_c(char.class );
- private final static MethodHandle mh_sc = mh_c(short.class );
- private final static MethodHandle mh_ic = mh_c(int.class );
- private final static MethodHandle mh_jc = mh_c(long.class );
- private final static MethodHandle mh_fc = mh_c(float.class );
- private final static MethodHandle mh_dc = mh_c(double.class );
+ private static final MethodHandle mh_zc = mh_c(boolean.class);
+ private static final MethodHandle mh_bc = mh_c(byte.class );
+ private static final MethodHandle mh_cc = mh_c(char.class );
+ private static final MethodHandle mh_sc = mh_c(short.class );
+ private static final MethodHandle mh_ic = mh_c(int.class );
+ private static final MethodHandle mh_jc = mh_c(long.class );
+ private static final MethodHandle mh_fc = mh_c(float.class );
+ private static final MethodHandle mh_dc = mh_c(double.class );
private static void char2prim(char x) throws Throwable {
assertEquals((char) x, (char) mh_cc.invokeExact(x)); // char -> char
@@ -284,14 +284,14 @@
private static MethodHandle mh_s(Class ret) { return mh(ret, short.class); }
- private final static MethodHandle mh_zs = mh_s(boolean.class);
- private final static MethodHandle mh_bs = mh_s(byte.class );
- private final static MethodHandle mh_cs = mh_s(char.class );
- private final static MethodHandle mh_ss = mh_s(short.class );
- private final static MethodHandle mh_is = mh_s(int.class );
- private final static MethodHandle mh_js = mh_s(long.class );
- private final static MethodHandle mh_fs = mh_s(float.class );
- private final static MethodHandle mh_ds = mh_s(double.class );
+ private static final MethodHandle mh_zs = mh_s(boolean.class);
+ private static final MethodHandle mh_bs = mh_s(byte.class );
+ private static final MethodHandle mh_cs = mh_s(char.class );
+ private static final MethodHandle mh_ss = mh_s(short.class );
+ private static final MethodHandle mh_is = mh_s(int.class );
+ private static final MethodHandle mh_js = mh_s(long.class );
+ private static final MethodHandle mh_fs = mh_s(float.class );
+ private static final MethodHandle mh_ds = mh_s(double.class );
private static void short2prim(short x) throws Throwable {
assertEquals((short) x, (short) mh_ss.invokeExact(x)); // short -> short
@@ -314,14 +314,14 @@
private static MethodHandle mh_i(Class ret) { return mh(ret, int.class); }
- private final static MethodHandle mh_zi = mh_i(boolean.class);
- private final static MethodHandle mh_bi = mh_i(byte.class );
- private final static MethodHandle mh_ci = mh_i(char.class );
- private final static MethodHandle mh_si = mh_i(short.class );
- private final static MethodHandle mh_ii = mh_i(int.class );
- private final static MethodHandle mh_ji = mh_i(long.class );
- private final static MethodHandle mh_fi = mh_i(float.class );
- private final static MethodHandle mh_di = mh_i(double.class );
+ private static final MethodHandle mh_zi = mh_i(boolean.class);
+ private static final MethodHandle mh_bi = mh_i(byte.class );
+ private static final MethodHandle mh_ci = mh_i(char.class );
+ private static final MethodHandle mh_si = mh_i(short.class );
+ private static final MethodHandle mh_ii = mh_i(int.class );
+ private static final MethodHandle mh_ji = mh_i(long.class );
+ private static final MethodHandle mh_fi = mh_i(float.class );
+ private static final MethodHandle mh_di = mh_i(double.class );
private static void int2prim(int x) throws Throwable {
assertEquals((int) x, (int) mh_ii.invokeExact(x)); // int -> int
@@ -345,14 +345,14 @@
private static MethodHandle mh_j(Class ret) { return mh(ret, long.class); }
- private final static MethodHandle mh_zj = mh_j(boolean.class);
- private final static MethodHandle mh_bj = mh_j(byte.class );
- private final static MethodHandle mh_cj = mh_j(char.class );
- private final static MethodHandle mh_sj = mh_j(short.class );
- private final static MethodHandle mh_ij = mh_j(int.class );
- private final static MethodHandle mh_jj = mh_j(long.class );
- private final static MethodHandle mh_fj = mh_j(float.class );
- private final static MethodHandle mh_dj = mh_j(double.class );
+ private static final MethodHandle mh_zj = mh_j(boolean.class);
+ private static final MethodHandle mh_bj = mh_j(byte.class );
+ private static final MethodHandle mh_cj = mh_j(char.class );
+ private static final MethodHandle mh_sj = mh_j(short.class );
+ private static final MethodHandle mh_ij = mh_j(int.class );
+ private static final MethodHandle mh_jj = mh_j(long.class );
+ private static final MethodHandle mh_fj = mh_j(float.class );
+ private static final MethodHandle mh_dj = mh_j(double.class );
private static void long2prim(long x) throws Throwable {
assertEquals((long) x, (long) mh_jj.invokeExact(x)); // long -> long
@@ -377,14 +377,14 @@
private static MethodHandle mh_f(Class ret) { return mh(ret, float.class); }
- private final static MethodHandle mh_zf = mh_f(boolean.class);
- private final static MethodHandle mh_bf = mh_f(byte.class );
- private final static MethodHandle mh_cf = mh_f(char.class );
- private final static MethodHandle mh_sf = mh_f(short.class );
- private final static MethodHandle mh_if = mh_f(int.class );
- private final static MethodHandle mh_jf = mh_f(long.class );
- private final static MethodHandle mh_ff = mh_f(float.class );
- private final static MethodHandle mh_df = mh_f(double.class );
+ private static final MethodHandle mh_zf = mh_f(boolean.class);
+ private static final MethodHandle mh_bf = mh_f(byte.class );
+ private static final MethodHandle mh_cf = mh_f(char.class );
+ private static final MethodHandle mh_sf = mh_f(short.class );
+ private static final MethodHandle mh_if = mh_f(int.class );
+ private static final MethodHandle mh_jf = mh_f(long.class );
+ private static final MethodHandle mh_ff = mh_f(float.class );
+ private static final MethodHandle mh_df = mh_f(double.class );
private static void float2prim(float x) throws Throwable {
assertEquals((float) x, (float) mh_ff.invokeExact(x)); // float -> float
@@ -410,14 +410,14 @@
private static MethodHandle mh_d(Class ret) { return mh(ret, double.class); }
- private final static MethodHandle mh_zd = mh_d(boolean.class);
- private final static MethodHandle mh_bd = mh_d(byte.class );
- private final static MethodHandle mh_cd = mh_d(char.class );
- private final static MethodHandle mh_sd = mh_d(short.class );
- private final static MethodHandle mh_id = mh_d(int.class );
- private final static MethodHandle mh_jd = mh_d(long.class );
- private final static MethodHandle mh_fd = mh_d(float.class );
- private final static MethodHandle mh_dd = mh_d(double.class );
+ private static final MethodHandle mh_zd = mh_d(boolean.class);
+ private static final MethodHandle mh_bd = mh_d(byte.class );
+ private static final MethodHandle mh_cd = mh_d(char.class );
+ private static final MethodHandle mh_sd = mh_d(short.class );
+ private static final MethodHandle mh_id = mh_d(int.class );
+ private static final MethodHandle mh_jd = mh_d(long.class );
+ private static final MethodHandle mh_fd = mh_d(float.class );
+ private static final MethodHandle mh_dd = mh_d(double.class );
private static void double2prim(double x) throws Throwable {
assertEquals((double) x, (double) mh_dd.invokeExact(x)); // double -> double
@@ -442,14 +442,14 @@
try { float y = (float) mh_fd.invokeExact(x); fail(); } catch (ClassCastException expected) {} // double -> float
}
- private final static MethodHandle mh_zv = mh(boolean.class);
- private final static MethodHandle mh_bv = mh(byte.class );
- private final static MethodHandle mh_cv = mh(char.class );
- private final static MethodHandle mh_sv = mh(short.class );
- private final static MethodHandle mh_iv = mh(int.class );
- private final static MethodHandle mh_jv = mh(long.class );
- private final static MethodHandle mh_fv = mh(float.class );
- private final static MethodHandle mh_dv = mh(double.class );
+ private static final MethodHandle mh_zv = mh(boolean.class);
+ private static final MethodHandle mh_bv = mh(byte.class );
+ private static final MethodHandle mh_cv = mh(char.class );
+ private static final MethodHandle mh_sv = mh(short.class );
+ private static final MethodHandle mh_iv = mh(int.class );
+ private static final MethodHandle mh_jv = mh(long.class );
+ private static final MethodHandle mh_fv = mh(float.class );
+ private static final MethodHandle mh_dv = mh(double.class );
private static void void2prim(int i) throws Throwable {
assertEquals( false, (boolean) mh_zv.invokeExact()); // void -> boolean
@@ -468,14 +468,14 @@
private static MethodHandle mh_v(Class arg) { return mh(void.class, arg); }
- private final static MethodHandle mh_vz = mh_v(boolean.class);
- private final static MethodHandle mh_vb = mh_v(byte.class );
- private final static MethodHandle mh_vc = mh_v(char.class );
- private final static MethodHandle mh_vs = mh_v(short.class );
- private final static MethodHandle mh_vi = mh_v(int.class );
- private final static MethodHandle mh_vj = mh_v(long.class );
- private final static MethodHandle mh_vf = mh_v(float.class );
- private final static MethodHandle mh_vd = mh_v(double.class );
+ private static final MethodHandle mh_vz = mh_v(boolean.class);
+ private static final MethodHandle mh_vb = mh_v(byte.class );
+ private static final MethodHandle mh_vc = mh_v(char.class );
+ private static final MethodHandle mh_vs = mh_v(short.class );
+ private static final MethodHandle mh_vi = mh_v(int.class );
+ private static final MethodHandle mh_vj = mh_v(long.class );
+ private static final MethodHandle mh_vf = mh_v(float.class );
+ private static final MethodHandle mh_vd = mh_v(double.class );
private static void prim2void(int x) throws Throwable {
boolean z = ((x & 1) != 0);
--- a/jdk/test/java/lang/invoke/7157574/Test7157574.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/7157574/Test7157574.java Thu Sep 17 09:19:40 2015 -0700
@@ -50,8 +50,8 @@
import static java.lang.invoke.MethodType.*;
public class Test7157574 {
interface Intf { void ig1(); void ig2(); void ig3(); void ig4(); void m1(); }
- static abstract class Super implements Intf { public abstract void m2(); public int f2; }
- static abstract class Sub extends Super { }
+ abstract static class Super implements Intf { public abstract void m2(); public int f2; }
+ abstract static class Sub extends Super { }
public static void main(String... av) throws Throwable {
MethodHandle m1 = lookup().findVirtual(Sub.class, "m1", methodType(void.class));
System.out.println(m1);
--- a/jdk/test/java/lang/invoke/7196190/ClassForNameTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/7196190/ClassForNameTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -35,7 +35,7 @@
import java.util.Arrays;
public class ClassForNameTest {
- final static String NAME = ClassForNameTest.class.getName();
+ static final String NAME = ClassForNameTest.class.getName();
public static void main(String[] args) throws Throwable {
{
--- a/jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/7196190/GetUnsafeTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -35,7 +35,7 @@
import java.util.Arrays;
public class GetUnsafeTest {
- final static String NAME = "sun.misc.Unsafe";
+ static final String NAME = "sun.misc.Unsafe";
private static boolean isTestFailed = false;
--- a/jdk/test/java/lang/invoke/AccessControlTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/AccessControlTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -459,29 +459,29 @@
static Lookup lookup_in_self() {
return MethodHandles.lookup();
}
- static public void pub_in_self() { }
- static protected void pro_in_self() { }
+ public static void pub_in_self() { }
+ protected static void pro_in_self() { }
static /*package*/ void pkg_in_self() { }
- static private void pri_in_self() { }
+ private static void pri_in_self() { }
static class Inner_nestmate {
static Lookup lookup_in_nestmate() {
return MethodHandles.lookup();
}
- static public void pub_in_nestmate() { }
- static protected void pro_in_nestmate() { }
+ public static void pub_in_nestmate() { }
+ protected static void pro_in_nestmate() { }
static /*package*/ void pkg_in_nestmate() { }
- static private void pri_in_nestmate() { }
+ private static void pri_in_nestmate() { }
}
}
class AccessControlTest_sibling {
static Lookup lookup_in_sibling() {
return MethodHandles.lookup();
}
- static public void pub_in_sibling() { }
- static protected void pro_in_sibling() { }
+ public static void pub_in_sibling() { }
+ protected static void pro_in_sibling() { }
static /*package*/ void pkg_in_sibling() { }
- static private void pri_in_sibling() { }
+ private static void pri_in_sibling() { }
}
// This guy tests access from outside the package:
--- a/jdk/test/java/lang/invoke/AccessControlTest_subpkg/Acquaintance_remote.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/AccessControlTest_subpkg/Acquaintance_remote.java Thu Sep 17 09:19:40 2015 -0700
@@ -16,27 +16,27 @@
public static Lookup lookup_in_remote() {
return MethodHandles.lookup();
}
- static public void pub_in_remote() { }
- static protected void pro_in_remote() { }
+ public static void pub_in_remote() { }
+ protected static void pro_in_remote() { }
static /*package*/ void pkg_in_remote() { }
- static private void pri_in_remote() { }
+ private static void pri_in_remote() { }
- static public class Remote_subclass extends AccessControlTest {
+ public static class Remote_subclass extends AccessControlTest {
static Lookup lookup_in_subclass() {
return MethodHandles.lookup();
}
- static public void pub_in_subclass() { }
- static protected void pro_in_subclass() { }
+ public static void pub_in_subclass() { }
+ protected static void pro_in_subclass() { }
static /*package*/ void pkg_in_subclass() { }
- static private void pri_in_subclass() { }
+ private static void pri_in_subclass() { }
}
static /*package*/ class Remote_hidden {
static Lookup lookup_in_hidden() {
return MethodHandles.lookup();
}
- static public void pub_in_hidden() { }
- static protected void pro_in_hidden() { }
+ public static void pub_in_hidden() { }
+ protected static void pro_in_hidden() { }
static /*package*/ void pkg_in_hidden() { }
- static private void pri_in_hidden() { }
+ private static void pri_in_hidden() { }
}
}
--- a/jdk/test/java/lang/invoke/CallSiteTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/CallSiteTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -43,7 +43,7 @@
import static java.lang.invoke.MethodType.*;
public class CallSiteTest {
- private final static Class<?> CLASS = CallSiteTest.class;
+ private static final Class<?> CLASS = CallSiteTest.class;
private static CallSite mcs;
private static CallSite vcs;
@@ -66,9 +66,9 @@
testVolatileCallSite();
}
- private final static int N = Integer.MAX_VALUE / 100;
- private final static int RESULT1 = 762786192;
- private final static int RESULT2 = -21474836;
+ private static final int N = Integer.MAX_VALUE / 100;
+ private static final int RESULT1 = 762786192;
+ private static final int RESULT2 = -21474836;
private static void assertEquals(int expected, int actual) {
if (expected != actual)
--- a/jdk/test/java/lang/invoke/JavaDocExamplesTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/JavaDocExamplesTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -75,14 +75,14 @@
{}
-static final private Lookup LOOKUP = lookup();
+private static final Lookup LOOKUP = lookup();
// static final private MethodHandle CONCAT_1 = LOOKUP.findVirtual(String.class,
// "concat", methodType(String.class, String.class));
// static final private MethodHandle HASHCODE_1 = LOOKUP.findVirtual(Object.class,
// "hashCode", methodType(int.class));
// form required if ReflectiveOperationException is intercepted:
- static final private MethodHandle CONCAT_2, HASHCODE_2, ADD_2, SUB_2;
+ private static final MethodHandle CONCAT_2, HASHCODE_2, ADD_2, SUB_2;
static {
try {
Class<?> THIS_CLASS = LOOKUP.lookupClass();
--- a/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/LFCaching/LambdaFormTestCase.java Thu Sep 17 09:19:40 2015 -0700
@@ -50,9 +50,9 @@
* Reflection link to {@code j.l.i.MethodHandle.internalForm} method. It is
* used to get a lambda form from a method handle.
*/
- protected final static Method INTERNAL_FORM;
- protected final static Field DEBUG_NAME;
- protected final static Field REF_FIELD;
+ protected static final Method INTERNAL_FORM;
+ protected static final Field DEBUG_NAME;
+ protected static final Field REF_FIELD;
private static final List<GarbageCollectorMXBean> gcInfo;
private static long gcCount() {
--- a/jdk/test/java/lang/invoke/MethodHandles/TestCatchException.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/MethodHandles/TestCatchException.java Thu Sep 17 09:19:40 2015 -0700
@@ -35,8 +35,8 @@
import static org.junit.Assert.*;
public class TestCatchException {
- final static MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
- final static MethodType M_TYPE = MethodType.methodType(int.class, Object.class, Object.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class);
+ static final MethodHandles.Lookup LOOKUP = MethodHandles.lookup();
+ static final MethodType M_TYPE = MethodType.methodType(int.class, Object.class, Object.class, int.class, int.class, int.class, int.class, int.class, int.class, int.class);
private static int noThrow(Object o1, Object o2, int i1, int i2, int i3, int i4, int i5, int i6, int i7) {
return 42;
@@ -72,8 +72,8 @@
assertEquals(x, 17);
}
- final static Object masterParam = new Object();
- final static Object[] masterTail = new Object[] { "str" };
+ static final Object masterParam = new Object();
+ static final Object[] masterTail = new Object[] { "str" };
static Exception masterEx = new Exception();
public static Object m1(Object o1, Object o2, Object o3, Object o4, Object o5,
--- a/jdk/test/java/lang/invoke/MethodHandlesTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/MethodHandlesTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -497,7 +497,7 @@
}
/** Is findVirtual (etc.) of "<init<" supposed to elicit a NoSuchMethodException? */
- final static boolean INIT_REF_CAUSES_NSME = true;
+ static final boolean INIT_REF_CAUSES_NSME = true;
@Test
public void testFindStatic() throws Throwable {
--- a/jdk/test/java/lang/invoke/indify/Indify.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/invoke/indify/Indify.java Thu Sep 17 09:19:40 2015 -0700
@@ -1220,7 +1220,7 @@
for (Object x : data) writeOutput(out, x);
}
- public static abstract class Outer {
+ public abstract static class Outer {
public abstract List<? extends Inner> inners();
protected void linkInners() {
for (Inner i : inners()) {
@@ -1250,7 +1250,7 @@
}
}
public interface Inner { Outer outer(); void linkOuter(Outer o); }
- public static abstract class InnerOuter extends Outer implements Inner {
+ public abstract static class InnerOuter extends Outer implements Inner {
public Outer outer;
public Outer outer() { return outer; }
public void linkOuter(Outer o) { assert(outer == null); outer = o; }
--- a/jdk/test/java/lang/management/MemoryMXBean/GetMBeanInfo.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/management/MemoryMXBean/GetMBeanInfo.java Thu Sep 17 09:19:40 2015 -0700
@@ -35,7 +35,7 @@
import javax.management.*;
public class GetMBeanInfo {
- private final static int EXPECTED_NOTIF_TYPES = 2;
+ private static final int EXPECTED_NOTIF_TYPES = 2;
private static int count = 0;
public static void main(String argv[]) throws Exception {
--- a/jdk/test/java/lang/management/MemoryMXBean/Pending.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/management/MemoryMXBean/Pending.java Thu Sep 17 09:19:40 2015 -0700
@@ -39,9 +39,9 @@
import java.lang.management.*;
public class Pending {
- final static int NO_REF_COUNT = 600;
- final static int REF_COUNT = 500;
- final static int TOTAL_FINALIZABLE = (NO_REF_COUNT + REF_COUNT);
+ static final int NO_REF_COUNT = 600;
+ static final int REF_COUNT = 500;
+ static final int TOTAL_FINALIZABLE = (NO_REF_COUNT + REF_COUNT);
private static int finalized = 0;
private static MemoryMXBean mbean
= ManagementFactory.getMemoryMXBean();
--- a/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/management/RuntimeMXBean/UpTime.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,9 +32,9 @@
import java.lang.management.*;
public class UpTime {
- final static long DELAY = 5; // Seconds
- final static long TIMEOUT = 30; // Minutes
- final static long MULTIPLIER = 1000; // millisecond ticks
+ static final long DELAY = 5; // Seconds
+ static final long TIMEOUT = 30; // Minutes
+ static final long MULTIPLIER = 1000; // millisecond ticks
private static final RuntimeMXBean metrics
= ManagementFactory.getRuntimeMXBean();
--- a/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/management/ThreadMXBean/AllThreadIds.java Thu Sep 17 09:19:40 2015 -0700
@@ -57,9 +57,9 @@
}
}
- final static int DAEMON_THREADS = 20;
- final static int USER_THREADS = 5;
- final static int ALL_THREADS = DAEMON_THREADS + USER_THREADS;
+ static final int DAEMON_THREADS = 20;
+ static final int USER_THREADS = 5;
+ static final int ALL_THREADS = DAEMON_THREADS + USER_THREADS;
private static final boolean live[] = new boolean[ALL_THREADS];
private static final Thread allThreads[] = new Thread[ALL_THREADS];
private static final ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadBlockedCount.java Thu Sep 17 09:19:40 2015 -0700
@@ -35,8 +35,8 @@
import java.util.concurrent.Phaser;
public class ThreadBlockedCount {
- final static long EXPECTED_BLOCKED_COUNT = 3;
- final static int DEPTH = 10;
+ static final long EXPECTED_BLOCKED_COUNT = 3;
+ static final int DEPTH = 10;
private static final ThreadMXBean mbean
= ManagementFactory.getThreadMXBean();
--- a/jdk/test/java/lang/management/ThreadMXBean/ThreadCounts.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/management/ThreadMXBean/ThreadCounts.java Thu Sep 17 09:19:40 2015 -0700
@@ -37,11 +37,11 @@
import java.lang.management.*;
public class ThreadCounts {
- final static int DAEMON_THREADS = 21;
- final static int USER_THREADS_1 = 11;
- final static int USER_THREADS_2 = 9;
- final static int USER_THREADS = USER_THREADS_1 + USER_THREADS_2;
- final static int ALL_THREADS = DAEMON_THREADS + USER_THREADS;
+ static final int DAEMON_THREADS = 21;
+ static final int USER_THREADS_1 = 11;
+ static final int USER_THREADS_2 = 9;
+ static final int USER_THREADS = USER_THREADS_1 + USER_THREADS_2;
+ static final int ALL_THREADS = DAEMON_THREADS + USER_THREADS;
private static volatile boolean live[] = new boolean[ALL_THREADS];
private ThreadMXBean mbean = ManagementFactory.getThreadMXBean();
private static boolean testFailed = false;
--- a/jdk/test/java/lang/ref/ReferenceEnqueuePending.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/ref/ReferenceEnqueuePending.java Thu Sep 17 09:19:40 2015 -0700
@@ -38,9 +38,9 @@
}
}
- final static boolean debug = System.getProperty("test.debug") != null;
- final static int iterations = 1000;
- final static int gc_trigger = 99;
+ static final boolean debug = System.getProperty("test.debug") != null;
+ static final int iterations = 1000;
+ static final int gc_trigger = 99;
static int[] a = new int[2 * iterations];
// Keep all weak references alive with the following array.
static NumberedWeakReference[] b = new NumberedWeakReference[iterations];
--- a/jdk/test/java/lang/ref/SoftReference/Bash.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/ref/SoftReference/Bash.java Thu Sep 17 09:19:40 2015 -0700
@@ -49,8 +49,8 @@
}
- final static int NUM_BLOCKS = 2048;
- final static int BLOCK_SIZE = 32768;
+ static final int NUM_BLOCKS = 2048;
+ static final int BLOCK_SIZE = 32768;
public static void main(String[] args) throws Exception {
--- a/jdk/test/java/lang/ref/SoftReference/Pin.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/ref/SoftReference/Pin.java Thu Sep 17 09:19:40 2015 -0700
@@ -34,8 +34,8 @@
public class Pin {
- final static int NUM_BLOCKS = 128;
- final static int BLOCK_SIZE = 32768;
+ static final int NUM_BLOCKS = 128;
+ static final int BLOCK_SIZE = 32768;
public static void main(String[] args) throws Exception {
--- a/jdk/test/java/lang/reflect/Field/GenericStringTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/reflect/Field/GenericStringTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -64,7 +64,7 @@
int field1;
@ExpectedString("private static java.lang.String TestClass1.field2")
- static private String field2;
+ private static String field2;
}
class TestClass2<E> {
--- a/jdk/test/java/lang/reflect/Method/defaultMethodModeling/DefaultMethodModeling.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/reflect/Method/defaultMethodModeling/DefaultMethodModeling.java Thu Sep 17 09:19:40 2015 -0700
@@ -145,7 +145,7 @@
abstract class Base {
@ExpectedModel(modifiers=PUBLIC|ABSTRACT, declaringClass=Base.class)
- abstract public void baz();
+ public abstract void baz();
@ExpectedModel(declaringClass=Base.class)
public void quux() {;}
--- a/jdk/test/java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/lang/reflect/Proxy/nonPublicProxy/NonPublicProxyClass.java Thu Sep 17 09:19:40 2015 -0700
@@ -127,7 +127,7 @@
return policy.grant;
}
- private final static String NEW_PROXY_IN_PKG = "newProxyInPackage.";
+ private static final String NEW_PROXY_IN_PKG = "newProxyInPackage.";
private void newProxyInstance() {
// expect newProxyInstance to succeed if it's in the same runtime package
int i = proxyClass.getName().lastIndexOf('.');
--- a/jdk/test/java/security/KeyStore/TestKeyStoreBasic.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/security/KeyStore/TestKeyStoreBasic.java Thu Sep 17 09:19:40 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2001, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2001, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -21,36 +21,97 @@
* questions.
*/
-import static java.lang.System.out;
-
+import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.security.KeyFactory;
import java.security.KeyStore;
import java.security.KeyStoreException;
-import java.security.Provider;
-import java.security.Security;
-import javax.crypto.SecretKey;
-import javax.crypto.spec.SecretKeySpec;
+import java.security.NoSuchProviderException;
+import java.security.PrivateKey;
+import java.security.UnrecoverableKeyException;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.security.spec.KeySpec;
+import java.security.spec.PKCS8EncodedKeySpec;
+import java.util.Base64;
/*
* @test
- * @bug 8048621
- * @summary Test the basic operations of KeyStore, provided by SunJCE (jceks),
- * and SunPKCS11-Solaris(PKCS11KeyStore)
+ * @bug 8048621 8133090
+ * @summary Test basic operations with keystores (jks, jceks, pkcs12)
* @author Yu-Ching Valerie PENG
*/
+public class TestKeyStoreBasic {
-public class TestKeyStoreBasic {
+ private static final String PRIVATE_KEY_PKCS8_BASE64 = ""
+ + "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCpyz97liuWPDYcLH9TX8BiT78o"
+ + "lCmAfmevvch6ncXUVuCzbdaKuKXwn4EVbDszsVJLoK5zdtP+X3iDhutj+IgKmLhuczF3M9VIcWr+"
+ + "JJUyTH4+3h/RT8cjCDZOmk9iXkb5ifruVsLqzb9g+Vp140Oz7leikne7KmclHvTfvFd0WDI7Gb9v"
+ + "o4f5rT717BXJ/n+M6pNk8DLpLiEu6eziYvXRv5x+t5Go3x0eCXdaxEQUf2j876Wfr2qHRJK7lDfF"
+ + "e1DDsMg/KpKGiILYZ+g2qtVMZSxtp5BZEtfB5qV/IE5kWO+mCIAGpXSZIdbERR6pZUq8GLEe1T9e"
+ + "+sO6H24w2F19AgMBAAECggEBAId/12187dO6wUPCjumuJA1QrrBnbKdKONyai36uoc1Od4s5QFj7"
+ + "+hEIeS7rbGNYQuBvnkgusAbzkW0FIpxpHce3EJez/emux6pEOKoP77BwMt9gy+txyu0+BHi91FQg"
+ + "AGvrnQDO5EYVY4Cz/WjOsJzKu8zVLg+DS0Toa2qRFwmUe9mVAXPNOCZ3Oae/Q6tCDsaINNw0fmjj"
+ + "jn6uohPbS+n6xENG3FkQXB36getXy310xTGED2J27cmAQH6gLR6Kl2iROzNPbbpBqbuemI9kbcld"
+ + "EwBS1jRfZWeaPstYA1niVrE9UgUBzemnoh4TDkG076sYthHMr5QFGjPswnwtJ4ECgYEA0sURQ5+v"
+ + "baH4tdaemI3qpnknXTlzSpuZZmAoyvY0Id0mlduwKwmZ3Y5989wHfnnhFfyNO4IkTKjI2Wp97qP5"
+ + "4eqUNpA7FtNU7KUzMcFDTtwtNZuRYMrKlqo2lLbA+gVrAYpYZFL4b7tcwtX4DnYorDsmude6W8sG"
+ + "4Mx2VdFJC9UCgYEAzjsdXCYH5doWUHb0dvn9ID7IikffEMRM720MRjrnnnVbpzx6ACntkPDNZg7p"
+ + "TRE/mx7iBz81ZaUWE+V0wd0JvCHEdpAz3mksyvDFhU4Bgs6xzf2pSul5muhsx3hHcvvPezz5Bnxs"
+ + "faJlzkxfwotyGmvWN15GA/pyfsZjsbbTpwkCgYAO6NnbysQCIV8SnegCKqfatt9N/O5m7LLhRxQb"
+ + "p2bwrlA4cZ34rWkw/w9x3LK7A6wkfgUPnJkswxPSLXJTG05l6M4rPfCwIKr1Qopojp9QSMr569NQ"
+ + "4YeLOOc7heIIzbFQHpU6I5Rncv2Q2sn9W+ZsqJKIuvX34FjQNiZ406EzMQKBgHSxOGS61D84DuZK"
+ + "2Ps1awhC3kB4eHzJRms3vflDPWoJJ+pSKwpKrzUTPHXiPBqyhtYkPGszVeiE6CAr9sv3YZnFVaBs"
+ + "6hyQUJsob+uE/w/gGvXe8VsFDx0bJOodYfhrCbTHBHWqE81nBcocpxayxsayfAzqWB3KKd0YLrMR"
+ + "K2PZAoGAcZa8915R2m0KZ6HVJUt/JDR85jCbN71kcVDFY2XSFkOJvOdFoHNfRckfLzjq9Y2MSSTV"
+ + "+QDWbDo2doUQCejJUTaN8nP79tfyir24X5uVPvQaeVoGTKYb+LfUqK0F60lStmjuddIGSZH55y3v"
+ + "+9XjmxbVERtd1lqgQg3VlmKlEXY=";
+
+ /*
+ * Certificate:
+ * Data:
+ * Version: 3 (0x2)
+ * Serial Number: 7 (0x7)
+ * Signature Algorithm: sha512WithRSAEncryption
+ * Issuer: CN=Root
+ * Validity
+ * Not Before: Sep 1 18:03:59 2015 GMT
+ * Not After : Jan 17 18:03:59 2043 GMT
+ * Subject: CN=EE
+ */
+ private static final String CERTIFICATE = ""
+ + "-----BEGIN CERTIFICATE-----\n"
+ + "MIIDHTCCAgWgAwIBAgIBBzANBgkqhkiG9w0BAQ0FADAPMQ0wCwYDVQQDDARSb290\n"
+ + "MB4XDTE1MDkwMTE4MDM1OVoXDTQzMDExNzE4MDM1OVowDTELMAkGA1UEAwwCRUUw\n"
+ + "ggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQCpyz97liuWPDYcLH9TX8Bi\n"
+ + "T78olCmAfmevvch6ncXUVuCzbdaKuKXwn4EVbDszsVJLoK5zdtP+X3iDhutj+IgK\n"
+ + "mLhuczF3M9VIcWr+JJUyTH4+3h/RT8cjCDZOmk9iXkb5ifruVsLqzb9g+Vp140Oz\n"
+ + "7leikne7KmclHvTfvFd0WDI7Gb9vo4f5rT717BXJ/n+M6pNk8DLpLiEu6eziYvXR\n"
+ + "v5x+t5Go3x0eCXdaxEQUf2j876Wfr2qHRJK7lDfFe1DDsMg/KpKGiILYZ+g2qtVM\n"
+ + "ZSxtp5BZEtfB5qV/IE5kWO+mCIAGpXSZIdbERR6pZUq8GLEe1T9e+sO6H24w2F19\n"
+ + "AgMBAAGjgYUwgYIwNAYDVR0fBC0wKzApoCegJYYjbGRhcDovL2xkYXAuaG9zdC5m\n"
+ + "b3IuY3JsZHAvbWFpbi5jcmwwSgYIKwYBBQUHAQEEPjA8MDoGCCsGAQUFBzAChi5s\n"
+ + "ZGFwOi8vbGRhcC5ob3N0LmZvci5haWEvZGM9Um9vdD9jQUNlcnRpZmljYXRlMA0G\n"
+ + "CSqGSIb3DQEBDQUAA4IBAQBWDfZHpuUx0yn5d3+BuztFqoks1MkGdk+USlH0TB1/\n"
+ + "gWWBd+4S4PCKlpSur0gj2rMW4fP5HQfNlHci8JV8/bG4KuKRAXW56dg1818Hl3pc\n"
+ + "iIrUSRn8uUjH3p9qb+Rb/u3mmVQRyJjN2t/zceNsO8/+Dd808OB9aEwGs8lMT0nn\n"
+ + "ZYaaAqYz1GIY/Ecyx1vfEZEQ1ljo6i/r70C3igbypBUShxSiGsleiVTLOGNA+MN1\n"
+ + "/a/Qh0bkaQyTGqK3bwvzzMeQVqWu2EWTBD/PmND5ExkpRICdv8LBVXfLnpoBr4lL\n"
+ + "hnxn9+e0Ah+t8dS5EKfn44w5bI5PCu2bqxs6RCTxNjcY\n"
+ + "-----END CERTIFICATE-----\n";
+
private static final char[] PASSWD2 = new char[] {
'b', 'o', 'r', 'e', 'd'
};
- private static final char[] PASSWDK = new String("cannot be null")
+ private static final char[] PASSWDK = "cannot be null"
.toCharArray();
private static final String[] KS_Type = {
"jks", "jceks", "pkcs12", "PKCS11KeyStore"
};
- private static final String[] PRO_TYPE = {
+ private static final String[] PROVIDERS = {
"SUN", "SunJCE", "SunJSSE", "SunPKCS11-Solaris"
};
private static final String ALIAS_HEAD = "test";
@@ -61,41 +122,58 @@
}
public void run() throws Exception {
- Provider[] providers = Security.getProviders();
- for (Provider p: providers) {
- String prvName = p.getName();
- if (prvName.startsWith("SunJCE")
- || prvName.startsWith("SunPKCS11-Solaris")) {
- try {
- runTest(p);
- out.println("Test with provider " + p.getName() + ""
- + " passed");
- } catch (java.security.KeyStoreException e) {
- if (prvName.startsWith("SunPKCS11-Solaris")) {
- out.println("KeyStoreException is expected "
- + "PKCS11KeyStore is invalid keystore type.");
- e.printStackTrace();
- } else {
- throw e;
- }
+ for (String provider : PROVIDERS) {
+ try {
+ runTest(provider);
+ System.out.println("Test with provider " + provider + "passed");
+ } catch (java.security.KeyStoreException e) {
+ if (provider.equals("SunPKCS11-Solaris")) {
+ System.out.println("KeyStoreException is expected: "
+ + "PKCS11KeyStore is invalid keystore type: " + e);
+ } else {
+ throw e;
+ }
+ } catch (NoSuchProviderException e) {
+ String osName = System.getProperty("os.name");
+ if (provider.equals("SunPKCS11-Solaris")
+ && !osName.equals("SunOS")) {
+ System.out.println("Skip SunPKCS11-Solaris provider on "
+ + osName);
+ } else {
+ throw e;
}
}
}
}
- public void runTest(Provider p) throws Exception {
- SecretKey key = new SecretKeySpec(
- new String("No one knows").getBytes(), "PBE");
+ public void runTest(String provider) throws Exception {
+
+ // load private key
+ // all keystore types should support private keys
+ KeySpec spec = new PKCS8EncodedKeySpec(
+ Base64.getMimeDecoder().decode(PRIVATE_KEY_PKCS8_BASE64));
+ PrivateKey privateKey = KeyFactory.getInstance("RSA")
+ .generatePrivate(spec);
+
+ // load x509 certificate
+ Certificate cert;
+ try (InputStream is = new BufferedInputStream(
+ new ByteArrayInputStream(CERTIFICATE.getBytes()))) {
+ cert = CertificateFactory.getInstance("X.509")
+ .generateCertificate(is);
+ }
+
int numEntries = 5;
- String proName = p.getName();
String type = null;
- for (int i = 0; i < PRO_TYPE.length; i++) {
- if (proName.compareTo(PRO_TYPE[i]) == 0) {
+ for (int i = 0; i < PROVIDERS.length; i++) {
+ if (provider.compareTo(PROVIDERS[i]) == 0) {
type = KS_Type[i];
break;
}
}
- KeyStore ks = KeyStore.getInstance(type, p);
+
+ System.out.printf("Test %s provider and %s keystore%n", provider, type);
+ KeyStore ks = KeyStore.getInstance(type, provider);
KeyStore ks2 = KeyStore.getInstance(type, ks.getProvider().getName());
// create an empty key store
@@ -103,7 +181,8 @@
// store the secret keys
for (int j = 0; j < numEntries; j++) {
- ks.setKeyEntry(ALIAS_HEAD + j, key, PASSWDK, null);
+ ks.setKeyEntry(ALIAS_HEAD + j, privateKey, PASSWDK,
+ new Certificate[] { cert });
}
// initialize the 2nd key store object with the 1st one
@@ -134,13 +213,18 @@
throw new RuntimeException(
"ERROR: passed the loading with incorrect password");
} catch (IOException ex) {
+ System.out.println("Expected exception: " + ex);
+ if (!causedBy(ex, UnrecoverableKeyException.class)) {
+ ex.printStackTrace(System.out);
+ throw new RuntimeException("Unexpected cause");
+ }
+ System.out.println("Expected cause: "
+ + UnrecoverableKeyException.class.getName());
+
bais.reset();
ks.load(bais, PASSWD2);
bais.reset();
ks.load(bais, null);
- } finally {
- bais.close();
- baos.close();
}
// check key store type
@@ -158,7 +242,6 @@
private void checkType(KeyStore obj, String type) {
if (!obj.getType().equals(type)) {
throw new RuntimeException("ERROR: wrong key store type");
-
}
}
@@ -168,7 +251,6 @@
if (!obj.containsAlias(ALIAS_HEAD + k)) {
throw new RuntimeException("ERROR: alias (" + k
+ ") should exist");
-
}
}
}
@@ -176,16 +258,25 @@
// compare the creation dates - true if all the same
private void compareCreationDate(KeyStore o1, KeyStore o2, int range)
throws KeyStoreException {
- boolean result = true;
- String alias = null;
+ String alias;
for (int k = 0; k < range; k++) {
alias = ALIAS_HEAD + k;
if (!o1.getCreationDate(alias).equals(o2.getCreationDate(alias))) {
throw new RuntimeException("ERROR: entry creation time (" + k
+ ") differs");
-
}
}
}
+ // checks if an exception was caused by specified exception class
+ private static boolean causedBy(Exception e, Class klass) {
+ Throwable cause = e;
+ while ((cause = cause.getCause()) != null) {
+ if (cause.getClass().equals(klass)) {
+ return true;
+ }
+ }
+ return false;
+ }
+
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/cert/CertPathEncodingTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,253 @@
+/*
+ * 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.
+ *
+ * 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.
+ */
+import java.io.ByteArrayInputStream;
+import java.security.cert.CertPath;
+import java.security.cert.Certificate;
+import java.security.cert.CertificateFactory;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Base64;
+import java.util.List;
+
+/*
+ * @test
+ * @bug 8074931
+ * @summary CertPathEncodingTest tests the ability of the CertPath and
+ * CertificateFactory to encode and decode CertPaths.
+ */
+public final class CertPathEncodingTest {
+ /*
+ Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 935438132 (0x37c1a734)
+ Signature Algorithm: dsaWithSHA1
+ Issuer: C=us, O=sun, OU=east, OU=bcn, CN=yassir
+ Validity
+ Not Before: Aug 23 19:55:32 1999 GMT
+ Not After : Aug 22 19:55:32 2000 GMT
+ Subject: C=us, O=sun, OU=east, OU=bcn
+ Subject Public Key Info:
+ Public Key Algorithm: dsaEncryption
+ pub:
+ 63:47:4f:f6:29:e5:98:a2:21:fd:da:97:9e:3f:ca:
+ b0:17:49:8d:8a:a7:06:0d:a6:78:97:39:59:33:72:
+ a2:a5:74:d5:3a:ef:e6:7c:07:d7:8e:8e:d1:66:73:
+ 99:14:04:96:f5:31:d6:72:ee:d2:53:f8:90:b5:f3:
+ c3:f1:64:ba:1a:9e:c0:0a:da:92:48:c5:d3:84:7e:
+ 48:09:66:d9:51:ba:74:56:5a:77:8a:8c:9a:9c:f6:
+ 84:12:61:12:51:dc:c6:4f:84:94:ec:cb:78:51:83:
+ 8c:20:8a:53:7b:d2:b6:36:df:50:35:95:1f:cb:50:
+ 55:8b:3f:fb:e2:77:cb
+ P:
+ 00:fd:7f:53:81:1d:75:12:29:52:df:4a:9c:2e:ec:
+ e4:e7:f6:11:b7:52:3c:ef:44:00:c3:1e:3f:80:b6:
+ 51:26:69:45:5d:40:22:51:fb:59:3d:8d:58:fa:bf:
+ c5:f5:ba:30:f6:cb:9b:55:6c:d7:81:3b:80:1d:34:
+ 6f:f2:66:60:b7:6b:99:50:a5:a4:9f:9f:e8:04:7b:
+ 10:22:c2:4f:bb:a9:d7:fe:b7:c6:1b:f8:3b:57:e7:
+ c6:a8:a6:15:0f:04:fb:83:f6:d3:c5:1e:c3:02:35:
+ 54:13:5a:16:91:32:f6:75:f3:ae:2b:61:d7:2a:ef:
+ f2:22:03:19:9d:d1:48:01:c7
+ Q:
+ 00:97:60:50:8f:15:23:0b:cc:b2:92:b9:82:a2:eb:
+ 84:0b:f0:58:1c:f5
+ G:
+ 00:f7:e1:a0:85:d6:9b:3d:de:cb:bc:ab:5c:36:b8:
+ 57:b9:79:94:af:bb:fa:3a:ea:82:f9:57:4c:0b:3d:
+ 07:82:67:51:59:57:8e:ba:d4:59:4f:e6:71:07:10:
+ 81:80:b4:49:16:71:23:e8:4c:28:16:13:b7:cf:09:
+ 32:8c:c8:a6:e1:3c:16:7a:8b:54:7c:8d:28:e0:a3:
+ ae:1e:2b:b3:a6:75:91:6e:a3:7f:0b:fa:21:35:62:
+ f1:fb:62:7a:01:24:3b:cc:a4:f1:be:a8:51:90:89:
+ a8:83:df:e1:5a:e5:9f:06:92:8b:66:5e:80:7b:55:
+ 25:64:01:4c:3b:fe:cf:49:2a
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Digital Signature, Key Encipherment, Certificate Sign
+ Signature Algorithm: dsaWithSHA1
+ r:
+ 52:80:52:2b:2c:3d:02:66:58:b4:dc:ef:52:26:70:
+ 1b:53:ca:b3:7d
+ s:
+ 62:03:b2:ab:3e:18:2a:66:09:b6:ce:d4:05:a5:8e:
+ a5:7a:0d:55:67
+ */
+ private static final String cert1 =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICzTCCAougAwIBAgIEN8GnNDALBgcqhkjOOAQDBQAwSTELMAkGA1UEBhMCdXMx\n" +
+ "DDAKBgNVBAoTA3N1bjENMAsGA1UECxMEZWFzdDEMMAoGA1UECxMDYmNuMQ8wDQYD\n" +
+ "VQQDEwZ5YXNzaXIwHhcNOTkwODIzMTk1NTMyWhcNMDAwODIyMTk1NTMyWjA4MQsw\n" +
+ "CQYDVQQGEwJ1czEMMAoGA1UEChMDc3VuMQ0wCwYDVQQLEwRlYXN0MQwwCgYDVQQL\n" +
+ "EwNiY24wggG1MIIBLAYHKoZIzjgEATCCAR8CgYEA/X9TgR11EilS30qcLuzk5/YR\n" +
+ "t1I870QAwx4/gLZRJmlFXUAiUftZPY1Y+r/F9bow9subVWzXgTuAHTRv8mZgt2uZ\n" +
+ "UKWkn5/oBHsQIsJPu6nX/rfGG/g7V+fGqKYVDwT7g/bTxR7DAjVUE1oWkTL2dfOu\n" +
+ "K2HXKu/yIgMZndFIAccCFQCXYFCPFSMLzLKSuYKi64QL8Fgc9QKBgQD34aCF1ps9\n" +
+ "3su8q1w2uFe5eZSvu/o66oL5V0wLPQeCZ1FZV4661FlP5nEHEIGAtEkWcSPoTCgW\n" +
+ "E7fPCTKMyKbhPBZ6i1R8jSjgo64eK7OmdZFuo38L+iE1YvH7YnoBJDvMpPG+qFGQ\n" +
+ "iaiD3+Fa5Z8GkotmXoB7VSVkAUw7/s9JKgOBggACf2NHT/Yp5ZiiIf3al54/yrAX\n" +
+ "SY2KpwYNpniXOVkzcqKldNU67+Z8B9eOjtFmc5kUBJb1MdZy7tJT+JC188PxZLoa\n" +
+ "nsAK2pJIxdOEfkgJZtlRunRWWneKjJqc9oQSYRJR3MZPhJTsy3hRg4wgilN70rY2\n" +
+ "31A1lR/LUFWLP/vid8ujEzARMA8GA1UdDwEB/wQFAwMHpAAwCwYHKoZIzjgEAwUA\n" +
+ "Ay8AMCwCFFKAUissPQJmWLTc71ImcBtTyrN9AhRiA7KrPhgqZgm2ztQFpY6leg1V\n" +
+ "Zw==\n" +
+ "-----END CERTIFICATE-----\n" +
+ "";
+
+ /*
+ Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 935095671 (0x37bc6d77)
+ Signature Algorithm: dsaWithSHA1
+ Issuer: C=us, O=sun, OU=east, OU=bcn, CN=yassir
+ Validity
+ Not Before: Aug 19 20:47:51 1999 GMT
+ Not After : Aug 18 20:47:51 2000 GMT
+ Subject: C=us, O=sun, OU=east, OU=bcn, CN=yassir
+ Subject Public Key Info:
+ Public Key Algorithm: dsaEncryption
+ pub:
+ 0a:cc:a4:ec:d6:88:45:c2:24:6b:0d:78:f1:82:f3:
+ 5e:3e:31:5d:fb:64:d5:06:5e:39:16:f1:0a:85:d1:
+ ff:d1:a4:74:c5:e6:b0:ba:93:1c:ee:69:51:be:3b:
+ a6:66:44:50:b4:f0:5e:0e:dd:9f:08:71:fe:a1:91:
+ 2e:d4:9e:6b:b2:c0:82:3c:91:6c:18:b0:d9:bc:a3:
+ 48:91:3f:8b:59:01:61:00:02:ab:22:31:bc:7c:6c:
+ 0d:9f:ed:be:33:e6:5c:44:9e:62:30:95:f8:6d:22:
+ d7:e5:85:4c:b0:98:6e:ad:cc:ca:3b:ad:cb:fa:f7:
+ 9f:37:13:f7:ca:e2:22:ba
+ P:
+ 00:fd:7f:53:81:1d:75:12:29:52:df:4a:9c:2e:ec:
+ e4:e7:f6:11:b7:52:3c:ef:44:00:c3:1e:3f:80:b6:
+ 51:26:69:45:5d:40:22:51:fb:59:3d:8d:58:fa:bf:
+ c5:f5:ba:30:f6:cb:9b:55:6c:d7:81:3b:80:1d:34:
+ 6f:f2:66:60:b7:6b:99:50:a5:a4:9f:9f:e8:04:7b:
+ 10:22:c2:4f:bb:a9:d7:fe:b7:c6:1b:f8:3b:57:e7:
+ c6:a8:a6:15:0f:04:fb:83:f6:d3:c5:1e:c3:02:35:
+ 54:13:5a:16:91:32:f6:75:f3:ae:2b:61:d7:2a:ef:
+ f2:22:03:19:9d:d1:48:01:c7
+ Q:
+ 00:97:60:50:8f:15:23:0b:cc:b2:92:b9:82:a2:eb:
+ 84:0b:f0:58:1c:f5
+ G:
+ 00:f7:e1:a0:85:d6:9b:3d:de:cb:bc:ab:5c:36:b8:
+ 57:b9:79:94:af:bb:fa:3a:ea:82:f9:57:4c:0b:3d:
+ 07:82:67:51:59:57:8e:ba:d4:59:4f:e6:71:07:10:
+ 81:80:b4:49:16:71:23:e8:4c:28:16:13:b7:cf:09:
+ 32:8c:c8:a6:e1:3c:16:7a:8b:54:7c:8d:28:e0:a3:
+ ae:1e:2b:b3:a6:75:91:6e:a3:7f:0b:fa:21:35:62:
+ f1:fb:62:7a:01:24:3b:cc:a4:f1:be:a8:51:90:89:
+ a8:83:df:e1:5a:e5:9f:06:92:8b:66:5e:80:7b:55:
+ 25:64:01:4c:3b:fe:cf:49:2a
+ X509v3 extensions:
+ X509v3 Key Usage: critical
+ Digital Signature, Key Encipherment, Certificate Sign
+ X509v3 Basic Constraints: critical
+ CA:TRUE, pathlen:5
+ Signature Algorithm: dsaWithSHA1
+ r:
+ 2f:88:46:37:94:92:b2:02:07:5b:8d:76:e5:81:23:
+ 85:7f:bc:8d:b9
+ s:
+ 00:8b:d7:41:fa:11:c7:ab:27:92:5d:0a:03:98:56:
+ 36:42:5f:f5:1f:9d
+ */
+ private static final String cert2 =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIIC9TCCArKgAwIBAgIEN7xtdzALBgcqhkjOOAQDBQAwSTELMAkGA1UEBhMCdXMx\n" +
+ "DDAKBgNVBAoTA3N1bjENMAsGA1UECxMEZWFzdDEMMAoGA1UECxMDYmNuMQ8wDQYD\n" +
+ "VQQDEwZ5YXNzaXIwHhcNOTkwODE5MjA0NzUxWhcNMDAwODE4MjA0NzUxWjBJMQsw\n" +
+ "CQYDVQQGEwJ1czEMMAoGA1UEChMDc3VuMQ0wCwYDVQQLEwRlYXN0MQwwCgYDVQQL\n" +
+ "EwNiY24xDzANBgNVBAMTBnlhc3NpcjCCAbcwggEsBgcqhkjOOAQBMIIBHwKBgQD9\n" +
+ "f1OBHXUSKVLfSpwu7OTn9hG3UjzvRADDHj+AtlEmaUVdQCJR+1k9jVj6v8X1ujD2\n" +
+ "y5tVbNeBO4AdNG/yZmC3a5lQpaSfn+gEexAiwk+7qdf+t8Yb+DtX58aophUPBPuD\n" +
+ "9tPFHsMCNVQTWhaRMvZ1864rYdcq7/IiAxmd0UgBxwIVAJdgUI8VIwvMspK5gqLr\n" +
+ "hAvwWBz1AoGBAPfhoIXWmz3ey7yrXDa4V7l5lK+7+jrqgvlXTAs9B4JnUVlXjrrU\n" +
+ "WU/mcQcQgYC0SRZxI+hMKBYTt88JMozIpuE8FnqLVHyNKOCjrh4rs6Z1kW6jfwv6\n" +
+ "ITVi8ftiegEkO8yk8b6oUZCJqIPf4VrlnwaSi2ZegHtVJWQBTDv+z0kqA4GEAAKB\n" +
+ "gArMpOzWiEXCJGsNePGC814+MV37ZNUGXjkW8QqF0f/RpHTF5rC6kxzuaVG+O6Zm\n" +
+ "RFC08F4O3Z8Icf6hkS7UnmuywII8kWwYsNm8o0iRP4tZAWEAAqsiMbx8bA2f7b4z\n" +
+ "5lxEnmIwlfhtItflhUywmG6tzMo7rcv69583E/fK4iK6oycwJTAPBgNVHQ8BAf8E\n" +
+ "BQMDB6QAMBIGA1UdEwEB/wQIMAYBAf8CAQUwCwYHKoZIzjgEAwUAAzAAMC0CFC+I\n" +
+ "RjeUkrICB1uNduWBI4V/vI25AhUAi9dB+hHHqyeSXQoDmFY2Ql/1H50=\n" +
+ "-----END CERTIFICATE-----\n" +
+ "";
+
+ private static final String pkcs7path =
+ "MIIF9QYJKoZIhvcNAQcCoIIF5jCCBeICAQExADALBgkqhkiG9w0BBwGgggXKMIICzTCCAougAwIB\n" +
+ "AgIEN8GnNDALBgcqhkjOOAQDBQAwSTELMAkGA1UEBhMCdXMxDDAKBgNVBAoTA3N1bjENMAsGA1UE\n" +
+ "CxMEZWFzdDEMMAoGA1UECxMDYmNuMQ8wDQYDVQQDEwZ5YXNzaXIwHhcNOTkwODIzMTk1NTMyWhcN\n" +
+ "MDAwODIyMTk1NTMyWjA4MQswCQYDVQQGEwJ1czEMMAoGA1UEChMDc3VuMQ0wCwYDVQQLEwRlYXN0\n" +
+ "MQwwCgYDVQQLEwNiY24wggG1MIIBLAYHKoZIzjgEATCCAR8CgYEA/X9TgR11EilS30qcLuzk5/YR\n" +
+ "t1I870QAwx4/gLZRJmlFXUAiUftZPY1Y+r/F9bow9subVWzXgTuAHTRv8mZgt2uZUKWkn5/oBHsQ\n" +
+ "IsJPu6nX/rfGG/g7V+fGqKYVDwT7g/bTxR7DAjVUE1oWkTL2dfOuK2HXKu/yIgMZndFIAccCFQCX\n" +
+ "YFCPFSMLzLKSuYKi64QL8Fgc9QKBgQD34aCF1ps93su8q1w2uFe5eZSvu/o66oL5V0wLPQeCZ1FZ\n" +
+ "V4661FlP5nEHEIGAtEkWcSPoTCgWE7fPCTKMyKbhPBZ6i1R8jSjgo64eK7OmdZFuo38L+iE1YvH7\n" +
+ "YnoBJDvMpPG+qFGQiaiD3+Fa5Z8GkotmXoB7VSVkAUw7/s9JKgOBggACf2NHT/Yp5ZiiIf3al54/\n" +
+ "yrAXSY2KpwYNpniXOVkzcqKldNU67+Z8B9eOjtFmc5kUBJb1MdZy7tJT+JC188PxZLoansAK2pJI\n" +
+ "xdOEfkgJZtlRunRWWneKjJqc9oQSYRJR3MZPhJTsy3hRg4wgilN70rY231A1lR/LUFWLP/vid8uj\n" +
+ "EzARMA8GA1UdDwEB/wQFAwMHpAAwCwYHKoZIzjgEAwUAAy8AMCwCFFKAUissPQJmWLTc71ImcBtT\n" +
+ "yrN9AhRiA7KrPhgqZgm2ztQFpY6leg1VZzCCAvUwggKyoAMCAQICBDe8bXcwCwYHKoZIzjgEAwUA\n" +
+ "MEkxCzAJBgNVBAYTAnVzMQwwCgYDVQQKEwNzdW4xDTALBgNVBAsTBGVhc3QxDDAKBgNVBAsTA2Jj\n" +
+ "bjEPMA0GA1UEAxMGeWFzc2lyMB4XDTk5MDgxOTIwNDc1MVoXDTAwMDgxODIwNDc1MVowSTELMAkG\n" +
+ "A1UEBhMCdXMxDDAKBgNVBAoTA3N1bjENMAsGA1UECxMEZWFzdDEMMAoGA1UECxMDYmNuMQ8wDQYD\n" +
+ "VQQDEwZ5YXNzaXIwggG3MIIBLAYHKoZIzjgEATCCAR8CgYEA/X9TgR11EilS30qcLuzk5/YRt1I8\n" +
+ "70QAwx4/gLZRJmlFXUAiUftZPY1Y+r/F9bow9subVWzXgTuAHTRv8mZgt2uZUKWkn5/oBHsQIsJP\n" +
+ "u6nX/rfGG/g7V+fGqKYVDwT7g/bTxR7DAjVUE1oWkTL2dfOuK2HXKu/yIgMZndFIAccCFQCXYFCP\n" +
+ "FSMLzLKSuYKi64QL8Fgc9QKBgQD34aCF1ps93su8q1w2uFe5eZSvu/o66oL5V0wLPQeCZ1FZV466\n" +
+ "1FlP5nEHEIGAtEkWcSPoTCgWE7fPCTKMyKbhPBZ6i1R8jSjgo64eK7OmdZFuo38L+iE1YvH7YnoB\n" +
+ "JDvMpPG+qFGQiaiD3+Fa5Z8GkotmXoB7VSVkAUw7/s9JKgOBhAACgYAKzKTs1ohFwiRrDXjxgvNe\n" +
+ "PjFd+2TVBl45FvEKhdH/0aR0xeawupMc7mlRvjumZkRQtPBeDt2fCHH+oZEu1J5rssCCPJFsGLDZ\n" +
+ "vKNIkT+LWQFhAAKrIjG8fGwNn+2+M+ZcRJ5iMJX4bSLX5YVMsJhurczKO63L+vefNxP3yuIiuqMn\n" +
+ "MCUwDwYDVR0PAQH/BAUDAwekADASBgNVHRMBAf8ECDAGAQH/AgEFMAsGByqGSM44BAMFAAMwADAt\n" +
+ "AhQviEY3lJKyAgdbjXblgSOFf7yNuQIVAIvXQfoRx6snkl0KA5hWNkJf9R+dMQA=\n" +
+ "";
+
+ // Runs test of CertPath encoding and decoding.
+ public static void main(String[] args) throws Exception {
+ // Make the CertPath whose encoded form has already been stored
+ CertificateFactory certFac = CertificateFactory.getInstance("X509");
+
+ final List<Certificate> certs = new ArrayList<>();
+ certs.add(certFac.generateCertificate(new ByteArrayInputStream(cert1.getBytes())));
+ certs.add(certFac.generateCertificate(new ByteArrayInputStream(cert2.getBytes())));
+
+ CertPath cp = certFac.generateCertPath(certs);
+
+ // Get the encoded form of the CertPath we made
+ byte[] encoded = cp.getEncoded("PKCS7");
+
+ // check if it matches the encoded value
+ if (!Arrays.equals(encoded, Base64.getMimeDecoder().decode(pkcs7path.getBytes()))) {
+ throw new RuntimeException("PKCS#7 encoding doesn't match stored value");
+ }
+
+ // Generate a CertPath from the encoded value and check if it equals
+ // the CertPath generated from the certificates
+ CertPath decodedCP = certFac.generateCertPath(new ByteArrayInputStream(encoded), "PKCS7");
+ if (!decodedCP.equals(cp)) {
+ throw new RuntimeException("CertPath decoded from PKCS#7 isn't equal to original");
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/security/cert/X509CertSelectorTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,538 @@
+/*
+ * Copyright (c) 2000, 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.
+ */
+import static sun.security.x509.GeneralNameInterface.NAME_DIRECTORY;
+import static sun.security.x509.NameConstraintsExtension.EXCLUDED_SUBTREES;
+import static sun.security.x509.NameConstraintsExtension.PERMITTED_SUBTREES;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.math.BigInteger;
+import java.security.GeneralSecurityException;
+import java.security.KeyFactory;
+import java.security.PublicKey;
+import java.security.cert.CertificateException;
+import java.security.cert.CertificateFactory;
+import java.security.cert.X509CertSelector;
+import java.security.cert.X509Certificate;
+import java.security.spec.X509EncodedKeySpec;
+import java.util.Base64;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.HashSet;
+import java.util.Iterator;
+import java.util.List;
+import java.util.Set;
+
+import sun.security.util.DerInputStream;
+import sun.security.util.DerOutputStream;
+import sun.security.util.DerValue;
+import sun.security.util.ObjectIdentifier;
+import sun.security.x509.AlgorithmId;
+import sun.security.x509.AuthorityKeyIdentifierExtension;
+import sun.security.x509.CertificatePoliciesExtension;
+import sun.security.x509.DNSName;
+import sun.security.x509.GeneralName;
+import sun.security.x509.GeneralNameInterface;
+import sun.security.x509.GeneralNames;
+import sun.security.x509.GeneralSubtree;
+import sun.security.x509.GeneralSubtrees;
+import sun.security.x509.KeyIdentifier;
+import sun.security.x509.NameConstraintsExtension;
+import sun.security.x509.PolicyInformation;
+import sun.security.x509.PrivateKeyUsageExtension;
+import sun.security.x509.SubjectAlternativeNameExtension;
+import sun.security.x509.X500Name;
+
+/*
+ * @test
+ * @bug 8074931
+ * @summary This class tests the X509CertSelector. The tests check particular criteria
+ * by setting them to a value that should match our test certificate and
+ * ensuring that they do match, then setting them to a value that should not
+ * match our test certificate and ensuring that they do not match.
+ * @modules java.base/sun.security.x509
+ * java.base/sun.security.util
+ */
+public class X509CertSelectorTest {
+ /*
+ Certificate:
+ Data:
+ Version: 3 (0x2)
+ Serial Number: 954172088 (0x38df82b8)
+ Signature Algorithm: dsaWithSHA1
+ Issuer: C=us, O=sun, OU=testing
+ Validity
+ Not Before: Mar 27 15:48:08 2000 GMT
+ Not After : Jun 25 14:48:08 2000 GMT
+ Subject: C=us, O=sun, OU=testing, CN=mullan
+ Subject Public Key Info:
+ Public Key Algorithm: dsaEncryption
+ pub: 0
+ P: 0
+ Q: 0
+ G: 0
+ X509v3 extensions:
+ X509v3 Name Constraints: critical
+ 0D.B0@.>1.0...U....us1.0
+ ..U.
+ ..sun1.0...U....testing1.0
+ ..U....mullan
+ X509v3 Subject Key Identifier:
+ 56:E8:88:AE:9D:B5:3F:2B:CB:A0:4C:4B:E2:87:53:07:33:77:1B:DF
+ X509v3 Authority Key Identifier:
+ keyid:8E:DD:AF:6F:EE:02:12:F4:61:E9:2F:E3:64:1A:6F:71:32:25:20:C0
+
+ X509v3 Subject Alternative Name:
+ email:mullan@east.sun.com
+ X509v3 Private Key Usage Period:
+ Not Before: Jan 1 05:00:00 2000 GMT, Not After: Jan 1 05:00:00 2001 GMT
+ X509v3 Key Usage: critical
+ Digital Signature
+ X509v3 Certificate Policies:
+ 0$0\..*...0.0...+.......0..
+ Testing...
+ Signature Algorithm: dsaWithSHA1
+ r:
+ 44:c7:35:40:5d:6c:28:75:7f:73:b2:f8:0d:72:6c:
+ 09:65:b8:81:14
+ s:
+ 76:79:f5:c7:37:3b:0d:9b:db:70:2f:20:80:36:e3:
+ 80:e8:a6:c6:71
+ */
+ private static final String testCert =
+ "-----BEGIN CERTIFICATE-----\n" +
+ "MIICLjCCAeygAwIBAgIEON+CuDALBgcqhkjOOAQDBQAwLTELMAkGA1UEBhMCdXMx\n" +
+ "DDAKBgNVBAoTA3N1bjEQMA4GA1UECxMHdGVzdGluZzAeFw0wMDAzMjcxNTQ4MDha\n" +
+ "Fw0wMDA2MjUxNDQ4MDhaMD4xCzAJBgNVBAYTAnVzMQwwCgYDVQQKEwNzdW4xEDAO\n" +
+ "BgNVBAsTB3Rlc3RpbmcxDzANBgNVBAMTBm11bGxhbjAcMBQGByqGSM44BAEwCQIB\n" +
+ "AAIBAAIBAAMEAAIBAKOCASMwggEfMFAGA1UdHgEB/wRGMESgQjBApD4xCzAJBgNV\n" +
+ "BAYTAnVzMQwwCgYDVQQKEwNzdW4xEDAOBgNVBAsTB3Rlc3RpbmcxDzANBgNVBAMT\n" +
+ "Bm11bGxhbjAdBgNVHQ4EFgQUVuiIrp21PyvLoExL4odTBzN3G98wHwYDVR0jBBgw\n" +
+ "FoAUjt2vb+4CEvRh6S/jZBpvcTIlIMAwHgYDVR0RBBcwFYETbXVsbGFuQGVhc3Qu\n" +
+ "c3VuLmNvbTArBgNVHRAEJDAigA8yMDAwMDEwMTA1MDAwMFqBDzIwMDEwMTAxMDUw\n" +
+ "MDAwWjAPBgNVHQ8BAf8EBQMDB4AAMC0GA1UdIAQmMCQwIgYEKoSAADAaMBgGCCsG\n" +
+ "AQUFBwICMAwSClRlc3RpbmcuLi4wCwYHKoZIzjgEAwUAAy8AMCwCFETHNUBdbCh1\n" +
+ "f3Oy+A1ybAlluIEUAhR2efXHNzsNm9twLyCANuOA6KbGcQ==\n" +
+ "-----END CERTIFICATE-----\n" +
+ "";
+
+ private static final String testKey =
+ "MIIBtjCCASsGByqGSM44BAEwggEeAoGBAIVWPEkcxbxhQRCqVzg55tNqbP5j0K4kdu4bkmXvfqC5\n" +
+ "+qA75DvnfzsOJseb+9AuKXWk/DvCzFDmrY1YaU3scZC3OQEO9lEO3F4VDKOaudY6OT1SI22pAIwz\n" +
+ "j5pvq+i7zOp4xUqkQUeh/4iQSfxOT5UrFGjkcbnbpVkCXD/GxAz7AhUAjtnm3dVIddUUHl6wxpZ7\n" +
+ "GcA6gSsCgYAf/PXzQtemgIDjpFrNNSgTEKkLposBXKatAM+gUKlMUjf8SQvquqPxDtRrscGjXkoL\n" +
+ "oTkaR7/akULYFpBvUcFkeIFiCnJg8M9XhCWdLvn9MPt+jR2oxookvCb9xLtD6WvIM/wd/nZ1iK4u\n" +
+ "iY1+q85xvns/Awbtwl7oZDAwE2TUKAOBhAACgYBDc9UZ+3xsZubUZvRG5cpyJceYpJp2exOPVJXn\n" +
+ "jR4CcR+cT9bAJpFSxqE/8KtNHXxHdu4f3DU67IMOVDpugzihyzXJvNm3w2H9x+6xczHG2wjvAJeh\n" +
+ "X62EWbUatxPXFAoVKZWuUbaYaZzdWBDtNRrCuKKsLo0GFy8g2BZISuD3jw==\n" +
+ "";
+
+ // Certificate to run tests on
+ private final X509Certificate cert;
+
+ public static void main(String[] args) throws Exception {
+ X509CertSelectorTest test = new X509CertSelectorTest();
+ test.doTest();
+ }
+
+ public X509CertSelectorTest() throws CertificateException, IOException {
+ cert = (X509Certificate) CertificateFactory.getInstance("X.509")
+ .generateCertificate(new ByteArrayInputStream(testCert.getBytes()));
+ }
+
+ // Runs the test.
+ private void doTest() throws Exception {
+ System.out.println("START OF TESTS FOR " + "X509CertSelector");
+
+ testSerialNumber();
+ testIssuer();
+ testSubjectKeyIdentifier();
+ testAuthorityKeyIdentifier();
+ testCertificateValid();
+ testPrivateKeyValid();
+ testSubjectPublicKeyAlgID();
+ testKeyUsage();
+ testSubjectAltName();
+ testPolicy();
+ testPathToName();
+ testSubject();
+ testSubjectPublicKey();
+ testNameConstraints();
+ testBasicConstraints();
+ testCertificate();
+ }
+
+ // Tests matching on the serial number contained in the certificate.
+ private void testSerialNumber() {
+ System.out.println("X.509 Certificate Match on serialNumber");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ selector.setSerialNumber(new BigInteger("999999999"));
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setSerialNumber(cert.getSerialNumber());
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests matching on the issuer name contained in the certificate.
+ private void testIssuer() throws IOException {
+ System.out.println("X.509 Certificate Match on issuer");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ selector.setIssuer("ou=bogus,ou=east,o=sun,c=us");
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setIssuer((cert.getIssuerX500Principal()).getName("RFC2253"));
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the subject key identifier contained in the
+ * certificate.
+ */
+ private void testSubjectKeyIdentifier() throws IOException {
+ System.out.println("X.509 Certificate Match on subjectKeyIdentifier");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ byte[] b = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ selector.setSubjectKeyIdentifier(b);
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.14"));
+ byte[] encoded = in.getOctetString();
+ selector.setSubjectKeyIdentifier(encoded);
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the authority key identifier contained in the
+ * certificate.
+ */
+ private void testAuthorityKeyIdentifier() throws IOException {
+ System.out.println("X.509 Certificate Match on authorityKeyIdentifier");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ byte[] b = { 0, 1, 2, 3, 4, 5, 6, 7, 8, 9 };
+ AuthorityKeyIdentifierExtension a = new AuthorityKeyIdentifierExtension(new KeyIdentifier(b), null, null);
+ selector.setAuthorityKeyIdentifier(a.getExtensionValue());
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.35"));
+ byte[] encoded = in.getOctetString();
+ selector.setAuthorityKeyIdentifier(encoded);
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the certificate validity component contained in the
+ * certificate.
+ */
+ private void testCertificateValid() {
+ System.out.println("X.509 Certificate Match on certificateValid");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ Calendar cal = Calendar.getInstance();
+ cal.set(1968, 12, 31);
+ selector.setCertificateValid(cal.getTime());
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setCertificateValid(cert.getNotBefore());
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the private key validity component contained in the
+ * certificate.
+ */
+ private void testPrivateKeyValid() throws IOException, CertificateException {
+ System.out.println("X.509 Certificate Match on privateKeyValid");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ Calendar cal = Calendar.getInstance();
+ cal.set(1968, 12, 31);
+ selector.setPrivateKeyValid(cal.getTime());
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.16"));
+ byte[] encoded = in.getOctetString();
+ PrivateKeyUsageExtension ext = new PrivateKeyUsageExtension(false, encoded);
+ Date validDate = (Date) ext.get(PrivateKeyUsageExtension.NOT_BEFORE);
+ selector.setPrivateKeyValid(validDate);
+ checkMatch(selector, cert, true);
+
+ }
+
+ private ObjectIdentifier getCertPubKeyAlgOID(X509Certificate xcert) throws IOException {
+ byte[] encodedKey = xcert.getPublicKey().getEncoded();
+ DerValue val = new DerValue(encodedKey);
+ if (val.tag != DerValue.tag_Sequence) {
+ throw new RuntimeException("invalid key format");
+ }
+
+ return AlgorithmId.parse(val.data.getDerValue()).getOID();
+ }
+
+ /*
+ * Tests matching on the subject public key algorithm ID component contained
+ * in the certificate.
+ */
+ private void testSubjectPublicKeyAlgID() throws IOException {
+ System.out.println("X.509 Certificate Match on subjectPublicKeyAlgID");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ selector.setSubjectPublicKeyAlgID("2.5.29.14");
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setSubjectPublicKeyAlgID(getCertPubKeyAlgOID(cert).toString());
+ checkMatch(selector, cert, true);
+
+ }
+
+ // Tests matching on the key usage extension contained in the certificate.
+ private void testKeyUsage() {
+ System.out.println("X.509 Certificate Match on keyUsage");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ boolean[] keyUsage = { true, false, true, false, true, false, true, false };
+ selector.setKeyUsage(keyUsage);
+ System.out.println("Selector = " + selector.toString());
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setKeyUsage(cert.getKeyUsage());
+ System.out.println("Selector = " + selector.toString());
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the subject alternative name extension contained in the
+ * certificate.
+ */
+ private void testSubjectAltName() throws IOException {
+ System.out.println("X.509 Certificate Match on subjectAltName");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ GeneralNameInterface dnsName = new DNSName("foo.com");
+ DerOutputStream tmp = new DerOutputStream();
+ dnsName.encode(tmp);
+ selector.addSubjectAlternativeName(2, tmp.toByteArray());
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.17"));
+ byte[] encoded = in.getOctetString();
+ SubjectAlternativeNameExtension ext = new SubjectAlternativeNameExtension(false, encoded);
+ GeneralNames names = (GeneralNames) ext.get(SubjectAlternativeNameExtension.SUBJECT_NAME);
+ GeneralName name = (GeneralName) names.get(0);
+ selector.setSubjectAlternativeNames(null);
+ DerOutputStream tmp2 = new DerOutputStream();
+ name.getName().encode(tmp2);
+ selector.addSubjectAlternativeName(name.getType(), tmp2.toByteArray());
+ checkMatch(selector, cert, true);
+
+ // good match 2 (matches at least one)
+ selector.setMatchAllSubjectAltNames(false);
+ selector.addSubjectAlternativeName(2, "foo.com");
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the policy constraints extension contained in the
+ * certificate.
+ */
+ private void testPolicy() throws IOException {
+ System.out.println("X.509 Certificate Match on certificatePolicies");
+ // test encoding of CertificatePoliciesExtension because we wrote the
+ // code
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ Set<String> s = new HashSet<>();
+ s.add(new String("1.2.5.7.68"));
+ selector.setPolicy(s);
+ checkMatch(selector, cert, false);
+
+ // good match
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.32"));
+ CertificatePoliciesExtension ext = new CertificatePoliciesExtension(false, in.getOctetString());
+ List<PolicyInformation> policies = ext.get(CertificatePoliciesExtension.POLICIES);
+ // match on the first policy id
+ PolicyInformation policyInfo = (PolicyInformation) policies.get(0);
+ s.clear();
+ s.add(policyInfo.getPolicyIdentifier().getIdentifier().toString());
+ selector.setPolicy(s);
+ checkMatch(selector, cert, true);
+ }
+
+ /*
+ * Tests matching on the name constraints extension contained in the
+ * certificate.
+ */
+ private void testPathToName() throws IOException {
+ System.out.println("X.509 Certificate Match on pathToName");
+
+ X509CertSelector selector = null;
+ DerInputStream in = new DerInputStream(cert.getExtensionValue("2.5.29.30"));
+ byte[] encoded = in.getOctetString();
+ NameConstraintsExtension ext = new NameConstraintsExtension(false, encoded);
+ GeneralSubtrees permitted = (GeneralSubtrees) ext.get(PERMITTED_SUBTREES);
+ GeneralSubtrees excluded = (GeneralSubtrees) ext.get(EXCLUDED_SUBTREES);
+
+ // bad matches on pathToName within excluded subtrees
+ if (excluded != null) {
+ Iterator<GeneralSubtree> e = excluded.iterator();
+ while (e.hasNext()) {
+ GeneralSubtree tree = e.next();
+ if (tree.getName().getType() == NAME_DIRECTORY) {
+ X500Name excludedDN1 = new X500Name(tree.getName().toString());
+ X500Name excludedDN2 = new X500Name("CN=Bogus, " + tree.getName().toString());
+ DerOutputStream derDN1 = new DerOutputStream();
+ DerOutputStream derDN2 = new DerOutputStream();
+ excludedDN1.encode(derDN1);
+ excludedDN2.encode(derDN2);
+ selector = new X509CertSelector();
+ selector.addPathToName(NAME_DIRECTORY, derDN1.toByteArray());
+ checkMatch(selector, cert, false);
+ selector.setPathToNames(null);
+ selector.addPathToName(NAME_DIRECTORY, derDN2.toByteArray());
+ checkMatch(selector, cert, false);
+ }
+ }
+ }
+
+ // good matches on pathToName within permitted subtrees
+ if (permitted != null) {
+ Iterator<GeneralSubtree> e = permitted.iterator();
+ while (e.hasNext()) {
+ GeneralSubtree tree = e.next();
+ if (tree.getName().getType() == NAME_DIRECTORY) {
+ X500Name permittedDN1 = new X500Name(tree.getName().toString());
+ X500Name permittedDN2 = new X500Name("CN=good, " + tree.getName().toString());
+ DerOutputStream derDN1 = new DerOutputStream();
+ DerOutputStream derDN2 = new DerOutputStream();
+ permittedDN1.encode(derDN1);
+ permittedDN2.encode(derDN2);
+ selector = new X509CertSelector();
+ selector.addPathToName(NAME_DIRECTORY, derDN1.toByteArray());
+ checkMatch(selector, cert, true);
+ selector.setPathToNames(null);
+ selector.addPathToName(NAME_DIRECTORY, derDN2.toByteArray());
+ checkMatch(selector, cert, true);
+ }
+ }
+ }
+ }
+
+ // Tests matching on the subject name contained in the certificate.
+ private void testSubject() throws IOException {
+ System.out.println("X.509 Certificate Match on subject");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ selector.setSubject("ou=bogus,ou=east,o=sun,c=us");
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setSubject(cert.getSubjectX500Principal().getName("RFC2253"));
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests matching on the subject public key contained in the certificate.
+ private void testSubjectPublicKey() throws IOException, GeneralSecurityException {
+ System.out.println("X.509 Certificate Match on subject public key");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ X509EncodedKeySpec keySpec = new X509EncodedKeySpec(
+ Base64.getMimeDecoder().decode(testKey.getBytes()));
+ KeyFactory keyFactory = KeyFactory.getInstance("DSA");
+ PublicKey pubKey = keyFactory.generatePublic(keySpec);
+ selector.setSubjectPublicKey(pubKey);
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setSubjectPublicKey(cert.getPublicKey());
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests matching on the name constraints contained in the certificate.
+ private void testNameConstraints() throws IOException {
+ System.out.println("X.509 Certificate Match on name constraints");
+ // bad match
+ GeneralSubtrees subjectTree = new GeneralSubtrees();
+ subjectTree.add(getGeneralSubtree((X500Name) cert.getSubjectDN()));
+ NameConstraintsExtension ext = new NameConstraintsExtension((GeneralSubtrees) null, subjectTree);
+ X509CertSelector selector = new X509CertSelector();
+ selector.setNameConstraints(ext.getExtensionValue());
+ checkMatch(selector, cert, false);
+
+ // good match
+ ext = new NameConstraintsExtension(subjectTree, null);
+ selector.setNameConstraints(ext.getExtensionValue());
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests matching on basic constraints.
+ private void testBasicConstraints() {
+ System.out.println("X.509 Certificate Match on basic constraints");
+ // bad match
+ X509CertSelector selector = new X509CertSelector();
+ int mpl = cert.getBasicConstraints();
+ selector.setBasicConstraints(0);
+ checkMatch(selector, cert, false);
+
+ // good match
+ selector.setBasicConstraints(mpl);
+ checkMatch(selector, cert, true);
+ }
+
+ // Tests certificateEquals criterion
+ private void testCertificate() {
+ System.out.println("X.509 Certificate Match on certificateEquals criterion");
+
+ X509CertSelector selector = new X509CertSelector();
+ // good match
+ selector.setCertificate(cert);
+ checkMatch(selector, cert, true);
+ }
+
+ private void checkMatch(X509CertSelector selector, X509Certificate cert, boolean match) {
+ boolean result = selector.match(cert);
+ if (match != result)
+ throw new RuntimeException(selector + " match " + cert + " is " + result + ", but expect " + match);
+ }
+
+ private static GeneralSubtree getGeneralSubtree(GeneralNameInterface gni) {
+ // Create a new GeneralSubtree with the specified name, 0 base, and
+ // unlimited length
+ GeneralName gn = new GeneralName(gni);
+ GeneralSubtree subTree = new GeneralSubtree(gn, 0, -1);
+ return subTree;
+ }
+}
--- a/jdk/test/java/util/Arrays/ParallelPrefix.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Arrays/ParallelPrefix.java Thu Sep 17 09:19:40 2015 -0700
@@ -43,18 +43,18 @@
public class ParallelPrefix {
//Array size less than MIN_PARTITION
- private final static int SMALL_ARRAY_SIZE = 1 << 3;
+ private static final int SMALL_ARRAY_SIZE = 1 << 3;
//Array size equals MIN_PARTITION
- private final static int THRESHOLD_ARRAY_SIZE = 1 << 4;
+ private static final int THRESHOLD_ARRAY_SIZE = 1 << 4;
//Array size greater than MIN_PARTITION
- private final static int MEDIUM_ARRAY_SIZE = 1 << 8;
+ private static final int MEDIUM_ARRAY_SIZE = 1 << 8;
//Array size much greater than MIN_PARTITION
- private final static int LARGE_ARRAY_SIZE = 1 << 14;
+ private static final int LARGE_ARRAY_SIZE = 1 << 14;
- private final static int[] ARRAY_SIZE_COLLECTION = new int[]{
+ private static final int[] ARRAY_SIZE_COLLECTION = new int[]{
SMALL_ARRAY_SIZE,
THRESHOLD_ARRAY_SIZE,
MEDIUM_ARRAY_SIZE,
--- a/jdk/test/java/util/Calendar/Bug8007038.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Calendar/Bug8007038.java Thu Sep 17 09:19:40 2015 -0700
@@ -36,14 +36,14 @@
import sun.util.locale.provider.CalendarDataUtility;
public class Bug8007038 {
- private final static String[] calTypes = {
+ private static final String[] calTypes = {
"gregory",
"buddhist",
"japanese",
"roc",
"islamic",
};
- private final static int[][] eraMinMax = {
+ private static final int[][] eraMinMax = {
{GregorianCalendar.BC, GregorianCalendar.AD},
{0, 1},
{0, 4},
@@ -51,7 +51,7 @@
{0, 1},
{0, 1},
};
- private final static Locale[] testLocs = {
+ private static final Locale[] testLocs = {
Locale.ROOT,
Locale.forLanguageTag("ja-JP-u-ca-japanese"),
Locale.forLanguageTag("th-TH"),
--- a/jdk/test/java/util/Collection/BiggernYours.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Collection/BiggernYours.java Thu Sep 17 09:19:40 2015 -0700
@@ -82,9 +82,9 @@
s2.tailSet(Integer.MIN_VALUE));
}
- static abstract class MapFrobber { abstract void frob(Map m); }
- static abstract class SetFrobber { abstract void frob(Set s); }
- static abstract class ColFrobber { abstract void frob(Collection c); }
+ abstract static class MapFrobber { abstract void frob(Map m); }
+ abstract static class SetFrobber { abstract void frob(Set s); }
+ abstract static class ColFrobber { abstract void frob(Collection c); }
static ColFrobber adder(final int i) {
return new ColFrobber() {void frob(Collection c) { c.add(i); }};
@@ -236,7 +236,7 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class CheckedThread extends Thread {
+ private abstract static class CheckedThread extends Thread {
abstract void realRun() throws Throwable;
public void run() {
try {realRun();} catch (Throwable t) {unexpected(t);}}}
--- a/jdk/test/java/util/Collection/HotPotatoes.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Collection/HotPotatoes.java Thu Sep 17 09:19:40 2015 -0700
@@ -99,7 +99,7 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class CheckedThread extends Thread {
+ private abstract static class CheckedThread extends Thread {
public abstract void realRun() throws Throwable;
public void run() {
try { realRun(); } catch (Throwable t) { unexpected(t); }}}
--- a/jdk/test/java/util/Collections/AddAll.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Collections/AddAll.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,7 +32,7 @@
import java.util.*;
public class AddAll {
- final static int N = 100;
+ static final int N = 100;
public static void main(String args[]) {
test(new ArrayList<Integer>());
test(new LinkedList<Integer>());
--- a/jdk/test/java/util/Collections/Disjoint.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Collections/Disjoint.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,7 +32,7 @@
import java.util.*;
public class Disjoint {
- final static int N = 20;
+ static final int N = 20;
public static void main(String args[]) {
// Make an array of lists each of which shares a single element
--- a/jdk/test/java/util/Collections/Frequency.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Collections/Frequency.java Thu Sep 17 09:19:40 2015 -0700
@@ -31,7 +31,7 @@
import java.util.*;
public class Frequency {
- final static int N = 100;
+ static final int N = 100;
public static void main(String args[]) {
test(new ArrayList<Integer>());
test(new LinkedList<Integer>());
--- a/jdk/test/java/util/Collections/RacingCollections.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Collections/RacingCollections.java Thu Sep 17 09:19:40 2015 -0700
@@ -38,15 +38,15 @@
* Turn this up to some higher value like 1000 for stress testing:
* java -Dmillis=1000 RacingCollections
*/
- final static long defaultWorkTimeMillis = Long.getLong("millis", 10L);
+ static final long defaultWorkTimeMillis = Long.getLong("millis", 10L);
/**
* Whether to print debug information.
*/
- final static boolean debug = Boolean.getBoolean("debug");
+ static final boolean debug = Boolean.getBoolean("debug");
- final static Integer one = 1;
- final static Integer two = 2;
+ static final Integer one = 1;
+ static final Integer two = 2;
/**
* A thread that mutates an object forever, alternating between
@@ -340,7 +340,7 @@
try {realMain(args);} catch (Throwable t) {unexpected(t);}
System.out.printf("%nPassed = %d, failed = %d%n%n", passed, failed);
if (failed > 0) throw new AssertionError("Some tests failed");}
- private static abstract class CheckedThread extends Thread {
+ private abstract static class CheckedThread extends Thread {
abstract void realRun() throws Throwable;
public void run() {
try { realRun(); } catch (Throwable t) { unexpected(t); }}}
--- a/jdk/test/java/util/Collections/ReverseOrder2.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Collections/ReverseOrder2.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,7 +32,7 @@
import java.io.*;
public class ReverseOrder2 {
- final static int N = 100;
+ static final int N = 100;
static void realMain(String[] args) throws Throwable {
check(Collections.reverseOrder()
@@ -75,7 +75,7 @@
}
};
- private final static List<String> golden = new ArrayList<String>(N);
+ private static final List<String> golden = new ArrayList<String>(N);
static {
for (int i = N-1; i >= 0; i--)
golden.add(String.valueOf(i));
@@ -89,7 +89,7 @@
equal(list, golden2);
}
- private final static List<Integer> golden2 = new ArrayList<Integer>(N);
+ private static final List<Integer> golden2 = new ArrayList<Integer>(N);
static {
for (int i = N-1; i >= 0; i--)
golden2.add(i);
--- a/jdk/test/java/util/Deque/ChorusLine.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Deque/ChorusLine.java Thu Sep 17 09:19:40 2015 -0700
@@ -36,7 +36,7 @@
void run(Deque<Integer> deq);
}
- private final static Tweaker[] tweakers = {
+ private static final Tweaker[] tweakers = {
new Tweaker() { public void run(Deque<Integer> deq) {
for (int i = 0; i < 7; i++)
deq.addLast(i);
--- a/jdk/test/java/util/LinkedHashMap/Basic.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/LinkedHashMap/Basic.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,8 +32,8 @@
import java.io.*;
public class Basic {
- final static Random rnd = new Random(666);
- final static Integer nil = new Integer(0);
+ static final Random rnd = new Random(666);
+ static final Integer nil = new Integer(0);
public static void main(String[] args) throws Exception {
int numItr = 500;
--- a/jdk/test/java/util/Locale/tools/EquivMapsGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Locale/tools/EquivMapsGenerator.java Thu Sep 17 09:19:40 2015 -0700
@@ -205,7 +205,7 @@
System.out.println();
}
- private final static String headerText =
+ private static final String headerText =
"final class LocaleEquivalentMaps {\n\n"
+ " static final Map<String, String> singleEquivMap;\n"
+ " static final Map<String, String[]> multiEquivsMap;\n"
@@ -216,7 +216,7 @@
+ " regionVariantEquivMap = new HashMap<>();\n\n"
+ " // This is an auto-generated file and should not be manually edited.\n";
- private final static String footerText =
+ private static final String footerText =
" }\n\n"
+ "}";
--- a/jdk/test/java/util/Map/Collisions.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Map/Collisions.java Thu Sep 17 09:19:40 2015 -0700
@@ -39,7 +39,7 @@
*/
private static final int TEST_SIZE = 5000;
- final static class HashableInteger implements Comparable<HashableInteger> {
+ static final class HashableInteger implements Comparable<HashableInteger> {
final int value;
final int hashmask; //yes duplication
--- a/jdk/test/java/util/Map/FunctionalCMEs.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Map/FunctionalCMEs.java Thu Sep 17 09:19:40 2015 -0700
@@ -43,7 +43,7 @@
* @run testng FunctionalCMEs
*/
public class FunctionalCMEs {
- final static String KEY = "key";
+ static final String KEY = "key";
@DataProvider(name = "Maps", parallel = true)
private static Iterator<Object[]> makeMaps() {
--- a/jdk/test/java/util/Map/InPlaceOpsCollisions.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Map/InPlaceOpsCollisions.java Thu Sep 17 09:19:40 2015 -0700
@@ -38,7 +38,7 @@
*/
private static final int TEST_SIZE = 5000;
- final static class HashableInteger implements Comparable<HashableInteger> {
+ static final class HashableInteger implements Comparable<HashableInteger> {
final int value;
final int hashmask; //yes duplication
--- a/jdk/test/java/util/Map/MapBinToFromTreeTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Map/MapBinToFromTreeTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -186,7 +186,7 @@
}
}
- final static class HashCodeInteger implements Comparable<HashCodeInteger> {
+ static final class HashCodeInteger implements Comparable<HashCodeInteger> {
final int value;
final int hashcode;
--- a/jdk/test/java/util/NavigableMap/LockStep.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/NavigableMap/LockStep.java Thu Sep 17 09:19:40 2015 -0700
@@ -534,8 +534,8 @@
}
}
- static abstract class MapFrobber { abstract void frob(NavigableMap m); }
- static abstract class SetFrobber { abstract void frob(NavigableSet m); }
+ abstract static class MapFrobber { abstract void frob(NavigableMap m); }
+ abstract static class SetFrobber { abstract void frob(NavigableSet m); }
static MapFrobber randomAdder(NavigableMap m) {
final Integer k = unusedKey(m);
--- a/jdk/test/java/util/ResourceBundle/Bug6190861.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ResourceBundle/Bug6190861.java Thu Sep 17 09:19:40 2015 -0700
@@ -31,7 +31,7 @@
public class Bug6190861 {
- static public void main(String[] args) {
+ public static void main(String[] args) {
Locale reservedLocale = Locale.getDefault();
try {
Locale.setDefault(new Locale("en", "US"));
--- a/jdk/test/java/util/ResourceBundle/Bug6204853.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ResourceBundle/Bug6204853.java Thu Sep 17 09:19:40 2015 -0700
@@ -79,7 +79,7 @@
return keyValueArray;
}
- public final static void main(String[] args) {
+ public static final void main(String[] args) {
new Bug6204853();
}
}
--- a/jdk/test/java/util/ResourceBundle/Bug6355009.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ResourceBundle/Bug6355009.java Thu Sep 17 09:19:40 2015 -0700
@@ -32,7 +32,7 @@
public final strictfp class Bug6355009 {
private final ResourceBundle bundle = ResourceBundle.getBundle(Bug6355009.class.getName());
- public final static void main(String[] args) {
+ public static final void main(String[] args) {
try {
new Bug6355009();
} catch (MissingResourceException e) {
--- a/jdk/test/java/util/ResourceBundle/Bug6356571.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ResourceBundle/Bug6356571.java Thu Sep 17 09:19:40 2015 -0700
@@ -41,7 +41,7 @@
}
}
- public final static void main(String[] args) {
+ public static final void main(String[] args) {
new Bug6356571().check();
}
}
--- a/jdk/test/java/util/ResourceBundle/Control/StressTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ResourceBundle/Control/StressTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -51,7 +51,7 @@
"U.S.A.", // StressOut_en_CA.properties is empty.
"Korea"
};
- final static long startTime = System.currentTimeMillis();
+ static final long startTime = System.currentTimeMillis();
// increment each element when one getBundle call is done.
static AtomicIntegerArray counters;
--- a/jdk/test/java/util/ResourceBundle/Test4300693.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ResourceBundle/Test4300693.java Thu Sep 17 09:19:40 2015 -0700
@@ -37,9 +37,9 @@
public class Test4300693 {
- static private ResourceBundle rb = ResourceBundle.getBundle("Test4300693RB");
+ private static ResourceBundle rb = ResourceBundle.getBundle("Test4300693RB");
- static public void main(String[] args) {
+ public static void main(String[] args) {
System.out.println(rb.getString("test result"));
}
--- a/jdk/test/java/util/ResourceBundle/getBaseBundleName/TestGetBaseBundleName.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ResourceBundle/getBaseBundleName/TestGetBaseBundleName.java Thu Sep 17 09:19:40 2015 -0700
@@ -37,8 +37,8 @@
*/
public class TestGetBaseBundleName {
- final static String PROPERTY_BUNDLE_NAME = "resources/PropertyBundle";
- final static String LIST_BUNDLE_NAME = "resources.ListBundle";
+ static final String PROPERTY_BUNDLE_NAME = "resources/PropertyBundle";
+ static final String LIST_BUNDLE_NAME = "resources.ListBundle";
public static String getBaseName(ResourceBundle bundle) {
return bundle == null ? null : bundle.getBaseBundleName();
--- a/jdk/test/java/util/Scanner/ScanTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Scanner/ScanTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -24,25 +24,30 @@
/**
* @test
* @bug 4313885 4926319 4927634 5032610 5032622 5049968 5059533 6223711 6277261 6269946 6288823
+ * 8072722
* @summary Basic tests of java.util.Scanner methods
* @key randomness
* @run main/othervm ScanTest
*/
-import java.util.*;
+import java.io.*;
+import java.math.*;
+import java.nio.*;
import java.text.*;
-import java.io.*;
-import java.nio.*;
+import java.util.*;
+import java.util.function.Consumer;
import java.util.regex.*;
-import java.math.*;
+import java.util.stream.*;
public class ScanTest {
private static boolean failure = false;
private static int failCount = 0;
private static int NUM_SOURCE_TYPES = 2;
+ private static File inputFile = new File(System.getProperty("test.src", "."), "input.txt");
public static void main(String[] args) throws Exception {
+
Locale reservedLocale = Locale.getDefault();
String lang = reservedLocale.getLanguage();
try {
@@ -70,8 +75,10 @@
cacheTest2();
nonASCIITest();
resetTest();
+ streamCloseTest();
+ streamComodTest();
- for (int j=0; j<NUM_SOURCE_TYPES; j++) {
+ for (int j = 0; j < NUM_SOURCE_TYPES; j++) {
hasNextTest(j);
nextTest(j);
hasNextPatternTest(j);
@@ -115,149 +122,147 @@
}
public static void useCase1() throws Exception {
- File f = new File(System.getProperty("test.src", "."), "input.txt");
- Scanner sc = new Scanner(f);
- sc.findWithinHorizon("usage case 1", 0);
- String[] names = new String[4];
- for (int i=0; i<4; i++) {
- while(sc.hasNextFloat())
- sc.nextFloat();
- names[i] = sc.next();
- sc.nextLine();
+ try (Scanner sc = new Scanner(inputFile)) {
+ sc.findWithinHorizon("usage case 1", 0);
+ String[] names = new String[4];
+ for (int i=0; i<4; i++) {
+ while (sc.hasNextFloat())
+ sc.nextFloat();
+ names[i] = sc.next();
+ sc.nextLine();
+ }
+ if (!names[0].equals("Frank"))
+ failCount++;
+ if (!names[1].equals("Joe"))
+ failCount++;
+ if (!names[2].equals("Mary"))
+ failCount++;
+ if (!names[3].equals("Michelle"))
+ failCount++;
}
- if (!names[0].equals("Frank"))
- failCount++;
- if (!names[1].equals("Joe"))
- failCount++;
- if (!names[2].equals("Mary"))
- failCount++;
- if (!names[3].equals("Michelle"))
- failCount++;
- sc.close();
report("Use case 1");
}
public static void useCase2() throws Exception {
- File f = new File(System.getProperty("test.src", "."), "input.txt");
- Scanner sc = new Scanner(f).useDelimiter("-");
- String testDataTag = sc.findWithinHorizon("usage case 2\n", 0);
- if (!testDataTag.equals("usage case 2\n"))
- failCount++;
- if (!sc.next().equals("cat"))
- failCount++;
- if (sc.nextInt() != 9)
- failCount++;
- if (!sc.next().equals("dog"))
- failCount++;
- if (sc.nextInt() != 6)
- failCount++;
- if (!sc.next().equals("pig"))
- failCount++;
- if (sc.nextInt() != 2)
- failCount++;
- if (!sc.next().equals(""))
- failCount++;
- if (sc.nextInt() != 5)
- failCount++;
- sc.close();
+ try (Scanner sc = new Scanner(inputFile).useDelimiter("-")) {
+ String testDataTag = sc.findWithinHorizon("usage case 2\n", 0);
+ if (!testDataTag.equals("usage case 2\n"))
+ failCount++;
+ if (!sc.next().equals("cat"))
+ failCount++;
+ if (sc.nextInt() != 9)
+ failCount++;
+ if (!sc.next().equals("dog"))
+ failCount++;
+ if (sc.nextInt() != 6)
+ failCount++;
+ if (!sc.next().equals("pig"))
+ failCount++;
+ if (sc.nextInt() != 2)
+ failCount++;
+ if (!sc.next().equals(""))
+ failCount++;
+ if (sc.nextInt() != 5)
+ failCount++;
+ }
report("Use case 2");
}
public static void useCase3() throws Exception {
- File f = new File(System.getProperty("test.src", "."), "input.txt");
- Scanner sc = new Scanner(f);
- String testDataTag = sc.findWithinHorizon("usage case 3\n", 0);
- if (!testDataTag.equals("usage case 3\n"))
- failCount++;
- Pattern tagPattern = Pattern.compile("@[a-z]+");
- Pattern endPattern = Pattern.compile("\\*\\/");
- String tag;
- String end = sc.findInLine(endPattern);
+ try (Scanner sc = new Scanner(inputFile)) {
+ String testDataTag = sc.findWithinHorizon("usage case 3\n", 0);
+ if (!testDataTag.equals("usage case 3\n"))
+ failCount++;
+ Pattern tagPattern = Pattern.compile("@[a-z]+");
+ Pattern endPattern = Pattern.compile("\\*\\/");
+ String tag;
+ String end = sc.findInLine(endPattern);
- while (end == null) {
- if ((tag = sc.findInLine(tagPattern)) != null) {
- String text = sc.nextLine();
- text = text.substring(0, text.length() - 1);
- //System.out.println(text);
- } else {
- sc.nextLine();
+ while (end == null) {
+ if ((tag = sc.findInLine(tagPattern)) != null) {
+ String text = sc.nextLine();
+ text = text.substring(0, text.length() - 1);
+ //System.out.println(text);
+ } else {
+ sc.nextLine();
+ }
+ end = sc.findInLine(endPattern);
}
- end = sc.findInLine(endPattern);
}
report("Use case 3");
}
public static void useCase4() throws Exception {
- File f = new File(System.getProperty("test.src", "."), "input.txt");
- Scanner sc = new Scanner(f);
- String testDataTag = sc.findWithinHorizon("usage case 4\n", 0);
- if (!testDataTag.equals("usage case 4\n"))
- failCount++;
+ try (Scanner sc = new Scanner(inputFile)) {
+ String testDataTag = sc.findWithinHorizon("usage case 4\n", 0);
+ if (!testDataTag.equals("usage case 4\n"))
+ failCount++;
- // Read some text parts of four hrefs
- String[] expected = { "Diffs", "Sdiffs", "Old", "New" };
- for (int i=0; i<4; i++) {
- sc.findWithinHorizon("<a href", 1000);
- sc.useDelimiter("[<>\n]+");
- sc.next();
- String textOfRef = sc.next();
- if (!textOfRef.equals(expected[i]))
+ // Read some text parts of four hrefs
+ String[] expected = { "Diffs", "Sdiffs", "Old", "New" };
+ for (int i=0; i<4; i++) {
+ sc.findWithinHorizon("<a href", 1000);
+ sc.useDelimiter("[<>\n]+");
+ sc.next();
+ String textOfRef = sc.next();
+ if (!textOfRef.equals(expected[i]))
+ failCount++;
+ }
+ // Read some html tags using < and > as delimiters
+ if (!sc.next().equals("/a"))
failCount++;
- }
- // Read some html tags using < and > as delimiters
- if (!sc.next().equals("/a"))
- failCount++;
- if (!sc.next().equals("b"))
- failCount++;
+ if (!sc.next().equals("b"))
+ failCount++;
- // Scan some html tags using skip and next
- Pattern nonTagStart = Pattern.compile("[^<]+");
- Pattern tag = Pattern.compile("<[^>]+?>");
- Pattern spotAfterTag = Pattern.compile("(?<=>)");
- String[] expected2 = { "</b>", "<p>", "<ul>", "<li>" };
- sc.useDelimiter(spotAfterTag);
- int tagsFound = 0;
- while(tagsFound < 4) {
- if (!sc.hasNext(tag)) {
- // skip text between tags
- sc.skip(nonTagStart);
+ // Scan some html tags using skip and next
+ Pattern nonTagStart = Pattern.compile("[^<]+");
+ Pattern tag = Pattern.compile("<[^>]+?>");
+ Pattern spotAfterTag = Pattern.compile("(?<=>)");
+ String[] expected2 = { "</b>", "<p>", "<ul>", "<li>" };
+ sc.useDelimiter(spotAfterTag);
+ int tagsFound = 0;
+ while (tagsFound < 4) {
+ if (!sc.hasNext(tag)) {
+ // skip text between tags
+ sc.skip(nonTagStart);
+ }
+ String tagContents = sc.next(tag);
+ if (!tagContents.equals(expected2[tagsFound]))
+ failCount++;
+ tagsFound++;
}
- String tagContents = sc.next(tag);
- if (!tagContents.equals(expected2[tagsFound]))
- failCount++;
- tagsFound++;
}
report("Use case 4");
}
public static void useCase5() throws Exception {
- File f = new File(System.getProperty("test.src", "."), "input.txt");
- Scanner sc = new Scanner(f);
- String testDataTag = sc.findWithinHorizon("usage case 5\n", 0);
- if (!testDataTag.equals("usage case 5\n"))
- failCount++;
+ try (Scanner sc = new Scanner(inputFile)) {
+ String testDataTag = sc.findWithinHorizon("usage case 5\n", 0);
+ if (!testDataTag.equals("usage case 5\n"))
+ failCount++;
- sc.findWithinHorizon("Share Definitions", 0);
- sc.nextLine();
- sc.next("\\[([a-z]+)\\]");
- String shareName = sc.match().group(1);
- if (!shareName.equals("homes"))
- failCount++;
+ sc.findWithinHorizon("Share Definitions", 0);
+ sc.nextLine();
+ sc.next("\\[([a-z]+)\\]");
+ String shareName = sc.match().group(1);
+ if (!shareName.equals("homes"))
+ failCount++;
- String[] keys = { "comment", "browseable", "writable", "valid users" };
- String[] vals = { "Home Directories", "no", "yes", "%S" };
- for (int i=0; i<4; i++) {
- sc.useDelimiter("=");
- String key = sc.next().trim();
- if (!key.equals(keys[i]))
- failCount++;
- sc.skip("[ =]+");
- sc.useDelimiter("\n");
- String value = sc.next();
- if (!value.equals(vals[i]))
- failCount++;
- sc.nextLine();
+ String[] keys = { "comment", "browseable", "writable", "valid users" };
+ String[] vals = { "Home Directories", "no", "yes", "%S" };
+ for (int i=0; i<4; i++) {
+ sc.useDelimiter("=");
+ String key = sc.next().trim();
+ if (!key.equals(keys[i]))
+ failCount++;
+ sc.skip("[ =]+");
+ sc.useDelimiter("\n");
+ String value = sc.next();
+ if (!value.equals(vals[i]))
+ failCount++;
+ sc.nextLine();
+ }
}
report("Use case 5");
@@ -445,12 +450,12 @@
if (sc.hasNextLine()) failCount++;
// Go through all the lines in a file
- File f = new File(System.getProperty("test.src", "."), "input.txt");
- sc = new Scanner(f);
- String lastLine = "blah";
- while(sc.hasNextLine())
- lastLine = sc.nextLine();
- if (!lastLine.equals("# Data for usage case 6")) failCount++;
+ try (Scanner sc2 = new Scanner(inputFile)) {
+ String lastLine = "blah";
+ while (sc2.hasNextLine())
+ lastLine = sc2.nextLine();
+ if (!lastLine.equals("# Data for usage case 6")) failCount++;
+ }
report("Has next line test");
}
@@ -629,48 +634,47 @@
sc.delimiter();
sc.useDelimiter("blah");
sc.useDelimiter(Pattern.compile("blah"));
- for (int i=0; i<NUM_METHODS; i++) {
+
+ for (Consumer<Scanner> method : methodList) {
try {
- methodCall(sc, i);
+ method.accept(sc);
failCount++;
} catch (IllegalStateException ise) {
// Correct
}
}
+
report("Close test");
}
- private static int NUM_METHODS = 23;
-
- private static void methodCall(Scanner sc, int i) {
- switch(i) {
- case 0: sc.hasNext(); break;
- case 1: sc.next(); break;
- case 2: sc.hasNext(Pattern.compile("blah")); break;
- case 3: sc.next(Pattern.compile("blah")); break;
- case 4: sc.hasNextBoolean(); break;
- case 5: sc.nextBoolean(); break;
- case 6: sc.hasNextByte(); break;
- case 7: sc.nextByte(); break;
- case 8: sc.hasNextShort(); break;
- case 9: sc.nextShort(); break;
- case 10: sc.hasNextInt(); break;
- case 11: sc.nextInt(); break;
- case 12: sc.hasNextLong(); break;
- case 13: sc.nextLong(); break;
- case 14: sc.hasNextFloat(); break;
- case 15: sc.nextFloat(); break;
- case 16: sc.hasNextDouble(); break;
- case 17: sc.nextDouble(); break;
- case 18: sc.hasNextBigInteger(); break;
- case 19: sc.nextBigInteger(); break;
- case 20: sc.hasNextBigDecimal(); break;
- case 21: sc.nextBigDecimal(); break;
- case 22: sc.hasNextLine(); break;
- default:
- break;
- }
- }
+ static List<Consumer<Scanner>> methodList = Arrays.asList(
+ Scanner::hasNext,
+ Scanner::next,
+ sc -> sc.hasNext(Pattern.compile("blah")),
+ sc -> sc.next(Pattern.compile("blah")),
+ Scanner::hasNextBoolean,
+ Scanner::nextBoolean,
+ Scanner::hasNextByte,
+ Scanner::nextByte,
+ Scanner::hasNextShort,
+ Scanner::nextShort,
+ Scanner::hasNextInt,
+ Scanner::nextInt,
+ Scanner::hasNextLong,
+ Scanner::nextLong,
+ Scanner::hasNextFloat,
+ Scanner::nextFloat,
+ Scanner::hasNextDouble,
+ Scanner::nextDouble,
+ Scanner::hasNextBigInteger,
+ Scanner::nextBigInteger,
+ Scanner::hasNextBigDecimal,
+ Scanner::nextBigDecimal,
+ Scanner::hasNextLine,
+ Scanner::tokens,
+ sc -> sc.findAll(Pattern.compile("blah")),
+ sc -> sc.findAll("blah")
+ );
public static void removeTest() throws Exception {
Scanner sc = new Scanner("testing");
@@ -864,19 +868,20 @@
public static void fromFileTest() throws Exception {
File f = new File(System.getProperty("test.src", "."), "input.txt");
- Scanner sc = new Scanner(f).useDelimiter("\n+");
- String testDataTag = sc.findWithinHorizon("fromFileTest", 0);
- if (!testDataTag.equals("fromFileTest"))
- failCount++;
+ try (Scanner sc = new Scanner(f)) {
+ sc.useDelimiter("\n+");
+ String testDataTag = sc.findWithinHorizon("fromFileTest", 0);
+ if (!testDataTag.equals("fromFileTest"))
+ failCount++;
- int count = 0;
- while (sc.hasNextLong()) {
- long blah = sc.nextLong();
- count++;
+ int count = 0;
+ while (sc.hasNextLong()) {
+ long blah = sc.nextLong();
+ count++;
+ }
+ if (count != 7)
+ failCount++;
}
- if (count != 7)
- failCount++;
- sc.close();
report("From file");
}
@@ -884,7 +889,7 @@
Scanner s = new Scanner("1 fish 2 fish red fish blue fish");
s.useDelimiter("\\s*fish\\s*");
List <String> results = new ArrayList<String>();
- while(s.hasNext())
+ while (s.hasNext())
results.add(s.next());
System.out.println(results);
}
@@ -1472,14 +1477,112 @@
report("Reset test");
}
+ /*
+ * Test that closing the stream also closes the underlying Scanner.
+ * The cases of attempting to open streams on a closed Scanner are
+ * covered by closeTest().
+ */
+ public static void streamCloseTest() throws Exception {
+ Scanner sc;
+
+ Scanner sc1 = new Scanner("xyzzy");
+ sc1.tokens().close();
+ try {
+ sc1.hasNext();
+ failCount++;
+ } catch (IllegalStateException ise) {
+ // Correct result
+ }
+
+ Scanner sc2 = new Scanner("a b c d e f");
+ try {
+ sc2.tokens()
+ .peek(s -> sc2.close())
+ .count();
+ } catch (IllegalStateException ise) {
+ // Correct result
+ }
+
+ Scanner sc3 = new Scanner("xyzzy");
+ sc3.findAll("q").close();
+ try {
+ sc3.hasNext();
+ failCount++;
+ } catch (IllegalStateException ise) {
+ // Correct result
+ }
+
+ try (Scanner sc4 = new Scanner(inputFile)) {
+ sc4.findAll("[0-9]+")
+ .peek(s -> sc4.close())
+ .count();
+ failCount++;
+ } catch (IllegalStateException ise) {
+ // Correct result
+ }
+
+ report("Streams Close test");
+ }
+
+ /*
+ * Test ConcurrentModificationException
+ */
+ public static void streamComodTest() {
+ try {
+ Scanner sc = new Scanner("a b c d e f");
+ sc.tokens()
+ .peek(s -> sc.hasNext())
+ .count();
+ failCount++;
+ } catch (ConcurrentModificationException cme) {
+ // Correct result
+ }
+
+ try {
+ Scanner sc = new Scanner("a b c d e f");
+ Iterator<String> it = sc.tokens().iterator();
+ it.next();
+ sc.next();
+ it.next();
+ failCount++;
+ } catch (ConcurrentModificationException cme) {
+ // Correct result
+ }
+
+ try {
+ String input = IntStream.range(0, 100)
+ .mapToObj(String::valueOf)
+ .collect(Collectors.joining(" "));
+ Scanner sc = new Scanner(input);
+ sc.findAll("[0-9]+")
+ .peek(s -> sc.hasNext())
+ .count();
+ failCount++;
+ } catch (ConcurrentModificationException cme) {
+ // Correct result
+ }
+
+ try {
+ String input = IntStream.range(0, 100)
+ .mapToObj(String::valueOf)
+ .collect(Collectors.joining(" "));
+ Scanner sc = new Scanner(input);
+ Iterator<MatchResult> it = sc.findAll("[0-9]+").iterator();
+ it.next();
+ sc.next();
+ it.next();
+ failCount++;
+ } catch (ConcurrentModificationException cme) {
+ // Correct result
+ }
+
+ report("Streams Comod test");
+ }
+
private static void report(String testName) {
- int spacesToAdd = 30 - testName.length();
- StringBuffer paddedNameBuffer = new StringBuffer(testName);
- for (int i=0; i<spacesToAdd; i++)
- paddedNameBuffer.append(" ");
- String paddedName = paddedNameBuffer.toString();
- System.err.println(paddedName + ": " +
- (failCount==0 ? "Passed":"Failed("+failCount+")"));
+ System.err.printf("%-30s: %s%n", testName,
+ (failCount == 0) ? "Passed" : String.format("Failed(%d)", failCount));
+
if (failCount > 0)
failure = true;
failCount = 0;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/java/util/Scanner/ScannerStreamTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,125 @@
+/*
+ * 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.
+ */
+
+import org.testng.annotations.DataProvider;
+import org.testng.annotations.Test;
+
+import java.io.File;
+import java.io.IOException;
+import java.io.UncheckedIOException;
+
+import java.util.ArrayList;
+import java.util.List;
+import java.util.Scanner;
+import java.util.function.Consumer;
+import java.util.function.Supplier;
+import java.util.regex.MatchResult;
+import java.util.regex.Pattern;
+import java.util.stream.LambdaTestHelpers;
+import java.util.stream.OpTestCase;
+import java.util.stream.Stream;
+import java.util.stream.TestData;
+
+import static org.testng.Assert.*;
+
+/**
+ * @test
+ * @bug 8072722
+ * @summary Tests of stream support in java.util.Scanner
+ * @library ../stream/bootlib
+ * @build java.util.stream.OpTestCase
+ * @run testng/othervm ScannerStreamTest
+ */
+
+@Test
+public class ScannerStreamTest extends OpTestCase {
+
+ static File inputFile = new File(System.getProperty("test.src", "."), "input.txt");
+
+ @DataProvider(name = "Patterns")
+ public static Object[][] makeStreamTestData() {
+ // each inner array is [String description, String input, String delimiter]
+ // delimiter may be null
+ List<Object[]> data = new ArrayList<>();
+
+ data.add(new Object[] { "default delimiter", "abc def ghi", null });
+ data.add(new Object[] { "fixed delimiter", "abc,def,,ghi", "," });
+ data.add(new Object[] { "regexp delimiter", "###abc##def###ghi###j", "#+" });
+
+ return data.toArray(new Object[0][]);
+ }
+
+ Scanner makeScanner(String input, String delimiter) {
+ Scanner sc = new Scanner(input);
+ if (delimiter != null) {
+ sc.useDelimiter(delimiter);
+ }
+ return sc;
+ }
+
+ @Test(dataProvider = "Patterns")
+ public void tokensTest(String description, String input, String delimiter) {
+ // derive expected result by using conventional loop
+ Scanner sc = makeScanner(input, delimiter);
+ List<String> expected = new ArrayList<>();
+ while (sc.hasNext()) {
+ expected.add(sc.next());
+ }
+
+ Supplier<Stream<String>> ss = () -> makeScanner(input, delimiter).tokens();
+ withData(TestData.Factory.ofSupplier(description, ss))
+ .stream(LambdaTestHelpers.identity())
+ .expectedResult(expected)
+ .exercise();
+ }
+
+ Scanner makeFileScanner(File file) {
+ try {
+ return new Scanner(file, "UTF-8");
+ } catch (IOException ioe) {
+ throw new UncheckedIOException(ioe);
+ }
+ }
+
+ public void findAllTest() {
+ // derive expected result by using conventional loop
+ Pattern pat = Pattern.compile("[A-Z]{7,}");
+ List<String> expected = new ArrayList<>();
+
+ try (Scanner sc = makeFileScanner(inputFile)) {
+ String match;
+ while ((match = sc.findWithinHorizon(pat, 0)) != null) {
+ expected.add(match);
+ }
+ }
+
+ Supplier<Stream<String>> ss =
+ () -> makeFileScanner(inputFile).findAll(pat).map(MatchResult::group);
+
+ withData(TestData.Factory.ofSupplier("findAllTest", ss))
+ .stream(LambdaTestHelpers.identity())
+ .expectedResult(expected)
+ .exercise();
+ }
+
+}
--- a/jdk/test/java/util/ServiceLoader/Basic.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ServiceLoader/Basic.java Thu Sep 17 09:19:40 2015 -0700
@@ -44,7 +44,7 @@
eq, s1, s2));
}
- static abstract class TestLoader {
+ abstract static class TestLoader {
String name;
TestLoader(String name) { this.name = name; }
--- a/jdk/test/java/util/ServiceLoader/NPE.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/ServiceLoader/NPE.java Thu Sep 17 09:19:40 2015 -0700
@@ -30,7 +30,7 @@
import java.util.Arrays;
public final class NPE {
- static abstract class Test {
+ abstract static class Test {
String name;
Test(String name) { this.name = name; }
--- a/jdk/test/java/util/Spliterator/SpliteratorCollisions.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/Spliterator/SpliteratorCollisions.java Thu Sep 17 09:19:40 2015 -0700
@@ -165,7 +165,7 @@
return spliteratorDataProviderWithNull = data.toArray(new Object[0][]);
}
- final static class HashableInteger implements Comparable<HashableInteger> {
+ static final class HashableInteger implements Comparable<HashableInteger> {
final int value;
final int hashmask; //yes duplication
--- a/jdk/test/java/util/StringJoiner/MergeTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/StringJoiner/MergeTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -36,8 +36,8 @@
@Test
public class MergeTest {
- private final static String[] PREFIXES = {"", "{", "@#$%"};
- private final static String[] SUFFIXES = {"", "}", "*&%$"};
+ private static final String[] PREFIXES = {"", "{", "@#$%"};
+ private static final String[] SUFFIXES = {"", "}", "*&%$"};
private static class Fixes {
public String pre0, suf0;
--- a/jdk/test/java/util/TreeMap/ContainsValue.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/TreeMap/ContainsValue.java Thu Sep 17 09:19:40 2015 -0700
@@ -30,7 +30,7 @@
import java.util.*;
public class ContainsValue {
- static public void main (String[] args) {
+ public static void main (String[] args) {
Map map = new TreeMap();
if (map.containsValue ("gemutlichkeit"))
--- a/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/concurrent/BlockingQueue/OfferDrainToLoops.java Thu Sep 17 09:19:40 2015 -0700
@@ -93,7 +93,7 @@
protected boolean quittingTime(long i) {
return (i % 1024) == 0 && quittingTime();
}
- abstract protected void realRun();
+ protected abstract void realRun();
public void run() {
try { realRun(); } catch (Throwable t) { unexpected(t); }
}
--- a/jdk/test/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/concurrent/ConcurrentQueues/OfferRemoveLoops.java Thu Sep 17 09:19:40 2015 -0700
@@ -89,7 +89,7 @@
protected boolean quittingTime(long i) {
return (i % 1024) == 0 && quittingTime();
}
- abstract protected void realRun();
+ protected abstract void realRun();
public void run() {
try { realRun(); } catch (Throwable t) { unexpected(t); }
}
--- a/jdk/test/java/util/concurrent/FutureTask/DoneTimedGetLoops.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/concurrent/FutureTask/DoneTimedGetLoops.java Thu Sep 17 09:19:40 2015 -0700
@@ -44,7 +44,7 @@
final long testDurationMillis;
static class PublicFutureTask extends FutureTask<Boolean> {
- final static Runnable noop = new Runnable() { public void run() {} };
+ static final Runnable noop = new Runnable() { public void run() {} };
PublicFutureTask() { super(noop, null); }
public void set(Boolean v) { super.set(v); }
public void setException(Throwable t) { super.setException(t); }
@@ -81,7 +81,7 @@
protected boolean quittingTime(long i) {
return (i % 1024) == 0 && quittingTime();
}
- abstract protected void realRun() throws Exception;
+ protected abstract void realRun() throws Exception;
public void run() {
try { realRun(); } catch (Throwable t) { unexpected(t); }
}
--- a/jdk/test/java/util/concurrent/Phaser/Basic.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/concurrent/Phaser/Basic.java Thu Sep 17 09:19:40 2015 -0700
@@ -111,7 +111,7 @@
// Convenience methods for creating threads that call arrive,
// awaitAdvance, arriveAndAwaitAdvance, awaitAdvanceInterruptibly
//----------------------------------------------------------------
- private static abstract class Arriver extends Thread {
+ private abstract static class Arriver extends Thread {
static AtomicInteger count = new AtomicInteger(1);
Arriver() {
@@ -131,7 +131,7 @@
public int phase() { return this.phase; }
}
- private static abstract class Awaiter extends Arriver {
+ private abstract static class Awaiter extends Arriver {
Awaiter() { super("Awaiter"); }
Awaiter(String name) { super(name); }
}
--- a/jdk/test/java/util/concurrent/locks/StampedLock/Basic.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/concurrent/locks/StampedLock/Basic.java Thu Sep 17 09:19:40 2015 -0700
@@ -75,7 +75,7 @@
}
}
- static abstract class Locker extends Thread {
+ abstract static class Locker extends Thread {
static AtomicInteger count = new AtomicInteger(1);
private volatile Throwable thrown;
private volatile long stamp;;
@@ -94,7 +94,7 @@
}
}
- static abstract class Reader extends Locker {
+ abstract static class Reader extends Locker {
Reader() { super("Reader"); }
Reader(String name) { super(name); }
}
@@ -173,7 +173,7 @@
: interruptibleReader(sl, timeout, unit, gate);
}
- static abstract class Writer extends Locker {
+ abstract static class Writer extends Locker {
Writer() { super("Writer"); }
Writer(String name) { super(name); }
}
--- a/jdk/test/java/util/jar/JarEntry/GetMethodsReturnClones.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/jar/JarEntry/GetMethodsReturnClones.java Thu Sep 17 09:19:40 2015 -0700
@@ -36,7 +36,7 @@
public class GetMethodsReturnClones {
- private final static String BASE = System.getProperty("test.src", ".") +
+ private static final String BASE = System.getProperty("test.src", ".") +
System.getProperty("file.separator");
public static void main(String[] args) throws Exception {
--- a/jdk/test/java/util/jar/TestExtra.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/jar/TestExtra.java Thu Sep 17 09:19:40 2015 -0700
@@ -42,13 +42,13 @@
* TestJarExtra checks JAR files.
*/
public class TestExtra {
- final static int JAR_MAGIC = 0xcafe; // private IN JarOutputStream.java
- final static int TEST_HEADER = 0xbabe;
+ static final int JAR_MAGIC = 0xcafe; // private IN JarOutputStream.java
+ static final int TEST_HEADER = 0xbabe;
- final static Charset ascii = Charset.forName("ASCII");
+ static final Charset ascii = Charset.forName("ASCII");
// ZipEntry extra data
- final static byte[][] extra = new byte[][] {
+ static final byte[][] extra = new byte[][] {
ascii.encode("hello, world").array(),
ascii.encode("foo bar").array()
};
--- a/jdk/test/java/util/logging/AnonymousLogger/TestAnonymousLogger.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/AnonymousLogger/TestAnonymousLogger.java Thu Sep 17 09:19:40 2015 -0700
@@ -43,7 +43,7 @@
*/
public class TestAnonymousLogger {
- final public static class TestHandler extends Handler {
+ public static final class TestHandler extends Handler {
@Override
public void publish(LogRecord record) {
System.out.println(new SimpleFormatter().format(record));
@@ -58,14 +58,14 @@
}
}
- final public static class TestFilter implements Filter {
+ public static final class TestFilter implements Filter {
@Override
public boolean isLoggable(LogRecord record) {
return true;
}
}
- final public static class TestBundle extends ResourceBundle {
+ public static final class TestBundle extends ResourceBundle {
Set<String> keys = Collections.synchronizedSet(new LinkedHashSet<>());
@Override
protected Object handleGetObject(String key) {
--- a/jdk/test/java/util/logging/DrainFindDeadlockTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/DrainFindDeadlockTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -47,14 +47,14 @@
*/
public class DrainFindDeadlockTest {
private LogManager mgr = LogManager.getLogManager();
- private final static int MAX_ITERATIONS = 100;
+ private static final int MAX_ITERATIONS = 100;
// Get a ThreadMXBean so we can check for deadlock. N.B. this may
// not be supported on all platforms, which means we will have to
// resort to the traditional test timeout method. However, if
// we have the support we'll get the deadlock details if one
// is detected.
- private final static ThreadMXBean threadMXBean =
+ private static final ThreadMXBean threadMXBean =
ManagementFactory.getThreadMXBean();
private final boolean threadMXBeanDeadlockSupported =
threadMXBean.isSynchronizerUsageSupported();
--- a/jdk/test/java/util/logging/FileHandlerLongLimit.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/FileHandlerLongLimit.java Thu Sep 17 09:19:40 2015 -0700
@@ -441,7 +441,7 @@
}
- final static class PermissionsBuilder {
+ static final class PermissionsBuilder {
final Permissions perms;
public PermissionsBuilder() {
this(new Permissions());
--- a/jdk/test/java/util/logging/FileHandlerPath.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/FileHandlerPath.java Thu Sep 17 09:19:40 2015 -0700
@@ -77,11 +77,11 @@
// Use a random name provided by UUID to avoid collision with other tests
- final static String logFile = FileHandlerPath.class.getSimpleName() + "_"
+ static final String logFile = FileHandlerPath.class.getSimpleName() + "_"
+ UUID.randomUUID().toString() + ".log";
- final static String tmpLogFile;
- final static String userDir = System.getProperty("user.dir");
- final static String tmpDir = System.getProperty("java.io.tmpdir");
+ static final String tmpLogFile;
+ static final String userDir = System.getProperty("user.dir");
+ static final String tmpDir = System.getProperty("java.io.tmpdir");
private static final List<Properties> properties;
static {
tmpLogFile = new File(tmpDir, logFile).toString();
@@ -241,7 +241,7 @@
}
- final static class PermissionsBuilder {
+ static final class PermissionsBuilder {
final Permissions perms;
public PermissionsBuilder() {
this(new Permissions());
--- a/jdk/test/java/util/logging/FileHandlerPatternExceptions.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/FileHandlerPatternExceptions.java Thu Sep 17 09:19:40 2015 -0700
@@ -265,7 +265,7 @@
}
- final static class PermissionsBuilder {
+ static final class PermissionsBuilder {
final Permissions perms;
public PermissionsBuilder() {
this(new Permissions());
--- a/jdk/test/java/util/logging/HigherResolutionTimeStamps/SerializeLogRecord.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/HigherResolutionTimeStamps/SerializeLogRecord.java Thu Sep 17 09:19:40 2015 -0700
@@ -137,7 +137,7 @@
* different java version can be deserialized in the current java version.
* (see Jdk8SerializedLog and Jdk9SerializedLog below)
*/
- public static abstract class SerializedLog {
+ public abstract static class SerializedLog {
public abstract String getBase64();
public abstract String getString();
--- a/jdk/test/java/util/logging/HigherResolutionTimeStamps/XmlFormatterNanos.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/HigherResolutionTimeStamps/XmlFormatterNanos.java Thu Sep 17 09:19:40 2015 -0700
@@ -121,7 +121,7 @@
}
}
- final static List<Properties> properties;
+ static final List<Properties> properties;
static {
Properties props1 = new Properties();
props1.setProperty("test.name", "with XML nano element (default)");
--- a/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/LogManager/Configuration/ParentLoggerWithHandlerGC.java Thu Sep 17 09:19:40 2015 -0700
@@ -451,7 +451,7 @@
}
- final static class PermissionsBuilder {
+ static final class PermissionsBuilder {
final Permissions perms;
public PermissionsBuilder() {
this(new Permissions());
--- a/jdk/test/java/util/logging/LogManager/Configuration/TestConfigurationLock.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/LogManager/Configuration/TestConfigurationLock.java Thu Sep 17 09:19:40 2015 -0700
@@ -197,7 +197,7 @@
}
}
- final static class ResetConf extends Thread {
+ static final class ResetConf extends Thread {
public ResetConf() {
setDaemon(true);
@@ -228,7 +228,7 @@
}
}
- final static class ReadConf extends Thread {
+ static final class ReadConf extends Thread {
public ReadConf() {
setDaemon(true);
@@ -259,7 +259,7 @@
}
}
- final static class AddLogger extends Thread {
+ static final class AddLogger extends Thread {
public AddLogger() {
setDaemon(true);
@@ -293,7 +293,7 @@
}
}
- final static class DeadlockDetector extends Thread {
+ static final class DeadlockDetector extends Thread {
@Override
public void run() {
--- a/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/LogManagerAppContextDeadlock.java Thu Sep 17 09:19:40 2015 -0700
@@ -63,7 +63,7 @@
// Emulate AppContext
static class FakeAppContext {
- final static AtomicInteger numAppContexts = new AtomicInteger(0);
+ static final AtomicInteger numAppContexts = new AtomicInteger(0);
static final class FakeAppContextLock {}
static final FakeAppContextLock lock = new FakeAppContextLock();
static volatile FakeAppContext appContext;
@@ -220,7 +220,7 @@
}
// A thread that detect deadlocks.
- final static class DeadlockDetector extends Thread {
+ static final class DeadlockDetector extends Thread {
public DeadlockDetector() {
this.setDaemon(true);
@@ -302,7 +302,7 @@
}
// A Helper class to build a set of permissions.
- final static class PermissionsBuilder {
+ static final class PermissionsBuilder {
final Permissions perms;
public PermissionsBuilder() {
this(new Permissions());
--- a/jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/Logger/entering/LoggerEnteringWithParams.java Thu Sep 17 09:19:40 2015 -0700
@@ -43,7 +43,7 @@
*/
public class LoggerEnteringWithParams {
- final static Object[] data = {
+ static final Object[] data = {
"one", "two", "three", "four", "five", "six", "seven", "eight"
};
--- a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobal.java Thu Sep 17 09:19:40 2015 -0700
@@ -45,7 +45,7 @@
*/
public class TestGetGlobal {
- final static String[] messages = {
+ static final String[] messages = {
"1. This message should not appear on the console.",
"2. This message should appear on the console.",
"3. This message should now appear on the console too."
--- a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalByName.java Thu Sep 17 09:19:40 2015 -0700
@@ -45,7 +45,7 @@
*/
public class TestGetGlobalByName {
- final static String[] messages = {
+ static final String[] messages = {
"1. This message should not appear on the console.",
"2. This message should appear on the console.",
"3. This message should now appear on the console too."
--- a/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/Logger/getGlobal/TestGetGlobalConcurrent.java Thu Sep 17 09:19:40 2015 -0700
@@ -46,7 +46,7 @@
*/
public class TestGetGlobalConcurrent {
- final static String[] messages = {
+ static final String[] messages = {
"1. This message should not appear on the console.",
"2. This message should appear on the console.",
"3. This message should now appear on the console too.",
@@ -135,16 +135,16 @@
}
}
- final static class Run1 implements Runnable {
+ static final class Run1 implements Runnable {
public void run() { test1(); }
}
- final static class Run2 implements Runnable {
+ static final class Run2 implements Runnable {
public void run() { test2(); }
}
- final static class Run3 implements Runnable {
+ static final class Run3 implements Runnable {
public void run() { test3(); }
}
- final static class Run4 implements Runnable {
+ static final class Run4 implements Runnable {
public void run() { test4(); }
}
--- a/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/HandlerImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/Logger/getGlobal/testgetglobal/HandlerImpl.java Thu Sep 17 09:19:40 2015 -0700
@@ -33,7 +33,7 @@
*/
public class HandlerImpl extends ConsoleHandler {
- public final static List<String> received = new CopyOnWriteArrayList<>();
+ public static final List<String> received = new CopyOnWriteArrayList<>();
public HandlerImpl() {
}
--- a/jdk/test/java/util/logging/Logger/logrb/TestLogrbResourceBundle.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/Logger/logrb/TestLogrbResourceBundle.java Thu Sep 17 09:19:40 2015 -0700
@@ -40,8 +40,8 @@
*/
public class TestLogrbResourceBundle {
- final static String LIST_BUNDLE_NAME = "resources.ListBundle";
- final static String PROPERTY_BUNDLE_NAME = "resources.PropertyBundle";
+ static final String LIST_BUNDLE_NAME = "resources.ListBundle";
+ static final String PROPERTY_BUNDLE_NAME = "resources.PropertyBundle";
/**
* A dummy handler class that we can use to check the bundle/bundle name
--- a/jdk/test/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/Logger/setResourceBundle/TestSetResourceBundle.java Thu Sep 17 09:19:40 2015 -0700
@@ -49,8 +49,8 @@
*/
public class TestSetResourceBundle {
- final static String LIST_BUNDLE_NAME = "resources.ListBundle";
- final static String PROPERTY_BUNDLE_NAME = "resources.PropertyBundle";
+ static final String LIST_BUNDLE_NAME = "resources.ListBundle";
+ static final String PROPERTY_BUNDLE_NAME = "resources.PropertyBundle";
/**
* A dummy handler class that we can use to check the bundle/bundle name
--- a/jdk/test/java/util/logging/LoggerResourceBundleRace.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/LoggerResourceBundleRace.java Thu Sep 17 09:19:40 2015 -0700
@@ -38,17 +38,17 @@
public class LoggerResourceBundleRace extends RacingThreadsTest {
- private final static int N_LOOPS = 500000; // # of race loops
- private final static int N_SECS = 15; // # of secs to run test
+ private static final int N_LOOPS = 500000; // # of race loops
+ private static final int N_SECS = 15; // # of secs to run test
// # of parallel threads; must match number of MyResources inner classes
- private final static int N_THREADS = 3;
+ private static final int N_THREADS = 3;
- private final static String LOGGER_PREFIX = "myLogger-";
- private final static String RESOURCE_PREFIX
+ private static final String LOGGER_PREFIX = "myLogger-";
+ private static final String RESOURCE_PREFIX
= "LoggerResourceBundleRace$MyResources";
// these counters are AtomicInteger since any worker thread can increment
- private final static AtomicInteger iaeCnt = new AtomicInteger();
- private final static AtomicInteger worksCnt = new AtomicInteger();
+ private static final AtomicInteger iaeCnt = new AtomicInteger();
+ private static final AtomicInteger worksCnt = new AtomicInteger();
Logger dummy; // dummy Logger
@@ -156,7 +156,7 @@
// N_THREADS above must match number of MyResources inner classes
//
public static class MyResources0 extends ListResourceBundle {
- final static Object[][] contents = {
+ static final Object[][] contents = {
{"sample1", "translation #1 for sample1"},
{"sample2", "translation #1 for sample2"},
};
@@ -167,7 +167,7 @@
}
public static class MyResources1 extends ListResourceBundle {
- final static Object[][] contents = {
+ static final Object[][] contents = {
{"sample1", "translation #2 for sample1"},
{"sample2", "translation #2 for sample2"},
};
@@ -178,7 +178,7 @@
}
public static class MyResources2 extends ListResourceBundle {
- final static Object[][] contents = {
+ static final Object[][] contents = {
{"sample1", "translation #3 for sample1"},
{"sample2", "translation #3 for sample2"},
};
--- a/jdk/test/java/util/logging/RootLogger/RootLevelInConfigFile.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/RootLogger/RootLevelInConfigFile.java Thu Sep 17 09:19:40 2015 -0700
@@ -49,7 +49,7 @@
*/
public class RootLevelInConfigFile {
- public final static String CONFIG_FILE_KEY = "java.util.logging.config.file";
+ public static final String CONFIG_FILE_KEY = "java.util.logging.config.file";
public static void main(String[] args) throws IOException {
System.setProperty(CONFIG_FILE_KEY,
--- a/jdk/test/java/util/logging/TestAppletLoggerContext.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/TestAppletLoggerContext.java Thu Sep 17 09:19:40 2015 -0700
@@ -116,7 +116,7 @@
public Object getAppletContext() { return active ? exc : null; }
}
- final static JavaAWTAccessStub javaAwtAccess = new JavaAWTAccessStub();
+ static final JavaAWTAccessStub javaAwtAccess = new JavaAWTAccessStub();
public static void init() {
SharedSecrets.setJavaAWTAccess(javaAwtAccess);
if (System.getProperty("test.security", "on").equals("on")) {
--- a/jdk/test/java/util/logging/TestConfigurationListeners.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/TestConfigurationListeners.java Thu Sep 17 09:19:40 2015 -0700
@@ -429,7 +429,7 @@
}
- final static class PermissionsBuilder {
+ static final class PermissionsBuilder {
final Permissions perms;
public PermissionsBuilder() {
this(new Permissions());
--- a/jdk/test/java/util/logging/TestLogConfigurationDeadLock.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/TestLogConfigurationDeadLock.java Thu Sep 17 09:19:40 2015 -0700
@@ -148,7 +148,7 @@
}
- final static class ReadConf extends Thread {
+ static final class ReadConf extends Thread {
@Override
public void run() {
while (goOn) {
@@ -163,7 +163,7 @@
}
}
- final static class AddLogger extends Thread {
+ static final class AddLogger extends Thread {
@Override
public void run() {
try {
@@ -184,7 +184,7 @@
}
}
- final static class DeadlockDetector extends Thread {
+ static final class DeadlockDetector extends Thread {
@Override
public void run() {
--- a/jdk/test/java/util/logging/TestLogConfigurationDeadLockWithConf.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/TestLogConfigurationDeadLockWithConf.java Thu Sep 17 09:19:40 2015 -0700
@@ -219,7 +219,7 @@
}
}
- final static class ReadConf extends DaemonThread {
+ static final class ReadConf extends DaemonThread {
@Override
public void run() {
while (goOn) {
@@ -234,7 +234,7 @@
}
}
- final static class AddLogger extends DaemonThread {
+ static final class AddLogger extends DaemonThread {
@Override
public void run() {
try {
@@ -254,7 +254,7 @@
}
}
- final static class DeadlockDetector extends Thread {
+ static final class DeadlockDetector extends Thread {
final Set<Long> deadlocked = Collections.synchronizedSet(new HashSet<Long>());
--- a/jdk/test/java/util/logging/TestLoggerBundleSync.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/TestLoggerBundleSync.java Thu Sep 17 09:19:40 2015 -0700
@@ -192,7 +192,7 @@
}
- final static class GetRB extends Thread {
+ static final class GetRB extends Thread {
final class MyHandler extends Handler {
volatile ResourceBundle rb;
volatile String rbName;
@@ -327,10 +327,10 @@
}
}
- final static class SetRB extends Thread {
+ static final class SetRB extends Thread {
final Class<? extends ResourceBundle> type;
- final static ExecutorService executor = Executors.newSingleThreadExecutor();
- final static class CheckRBTask implements Callable<Exception> {
+ static final ExecutorService executor = Executors.newSingleThreadExecutor();
+ static final class CheckRBTask implements Callable<Exception> {
final Logger logger;
volatile String rbName;
volatile ResourceBundle rb;
@@ -431,11 +431,11 @@
}
}
- final static class SetRBName extends Thread {
+ static final class SetRBName extends Thread {
int nexti = 0;
final Class<? extends ResourceBundle> type;
- final static ExecutorService executor = Executors.newSingleThreadExecutor();
- final static class CheckRBNameTask implements Callable<Exception> {
+ static final ExecutorService executor = Executors.newSingleThreadExecutor();
+ static final class CheckRBNameTask implements Callable<Exception> {
final Logger logger;
volatile String rbName;
@@ -535,7 +535,7 @@
}
}
- final static class DeadlockDetector extends Thread {
+ static final class DeadlockDetector extends Thread {
@Override
public void run() {
--- a/jdk/test/java/util/logging/bundlesearch/IndirectlyLoadABundle.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/bundlesearch/IndirectlyLoadABundle.java Thu Sep 17 09:19:40 2015 -0700
@@ -38,7 +38,7 @@
*/
public class IndirectlyLoadABundle {
- private final static String rbName = "CallerSearchableResource";
+ private static final String rbName = "CallerSearchableResource";
public boolean loadAndTest() throws Throwable {
// Make sure we can find it via the URLClassLoader
--- a/jdk/test/java/util/logging/bundlesearch/LoadItUp2.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/bundlesearch/LoadItUp2.java Thu Sep 17 09:19:40 2015 -0700
@@ -34,7 +34,7 @@
*/
public class LoadItUp2 {
- private final static boolean DEBUG = false;
+ private static final boolean DEBUG = false;
public Boolean test(String rbName) throws Exception {
// we should not be able to find the resource in this directory via
--- a/jdk/test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/bundlesearch/ResourceBundleSearchTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -47,11 +47,11 @@
*/
public class ResourceBundleSearchTest {
- private final static boolean DEBUG = false;
- private final static String LOGGER_PREFIX = "myLogger.";
+ private static final boolean DEBUG = false;
+ private static final String LOGGER_PREFIX = "myLogger.";
private static int loggerNum = 0;
- private final static String PROP_RB_NAME = "ClassPathTestBundle";
- private final static String TCCL_TEST_BUNDLE = "ContextClassLoaderTestBundle";
+ private static final String PROP_RB_NAME = "ClassPathTestBundle";
+ private static final String TCCL_TEST_BUNDLE = "ContextClassLoaderTestBundle";
private static int numPass = 0;
private static int numFail = 0;
--- a/jdk/test/java/util/logging/bundlesearch/TwiceIndirectlyLoadABundle.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/logging/bundlesearch/TwiceIndirectlyLoadABundle.java Thu Sep 17 09:19:40 2015 -0700
@@ -37,7 +37,7 @@
*/
public class TwiceIndirectlyLoadABundle {
- private final static String rbName = "StackSearchableResource";
+ private static final String rbName = "StackSearchableResource";
public boolean loadAndTest() throws Throwable {
// Find out where we are running from so we can setup the URLClassLoader URLs
--- a/jdk/test/java/util/regex/POSIX_Unicode.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/regex/POSIX_Unicode.java Thu Sep 17 09:19:40 2015 -0700
@@ -24,7 +24,7 @@
import java.util.HashMap;
import java.util.Locale;
-final public class POSIX_Unicode {
+public final class POSIX_Unicode {
public static boolean isAlpha(int ch) {
return Character.isAlphabetic(ch);
--- a/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/CollectorsTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/stream/test/org/openjdk/tests/java/util/stream/CollectorsTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -77,7 +77,7 @@
*/
public class CollectorsTest extends OpTestCase {
- private static abstract class CollectorAssertion<T, U> {
+ private abstract static class CollectorAssertion<T, U> {
abstract void assertValue(U value,
Supplier<Stream<T>> source,
boolean ordered) throws ReflectiveOperationException;
--- a/jdk/test/java/util/zip/ChecksumBase.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/zip/ChecksumBase.java Thu Sep 17 09:19:40 2015 -0700
@@ -31,7 +31,7 @@
public class ChecksumBase {
- private final static byte[] BYTES_123456789 = "123456789".getBytes(StandardCharsets.US_ASCII);
+ private static final byte[] BYTES_123456789 = "123456789".getBytes(StandardCharsets.US_ASCII);
public static void testAll(Checksum checksum, long expected) {
testBytes(checksum, expected);
--- a/jdk/test/java/util/zip/FlaterCriticalArray.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/zip/FlaterCriticalArray.java Thu Sep 17 09:19:40 2015 -0700
@@ -71,7 +71,7 @@
/*
* Base class for individual test cases
*/
- abstract static private class TestCase {
+ private abstract static class TestCase {
protected String name; // For information in debug messages
protected byte data[]; // Data to be deflated and subsequently inflated
protected int level; // Compression level for deflater
@@ -110,9 +110,9 @@
debug(name, inOut, duration, length);
}
- abstract protected byte[] deflate(byte data[], int level) throws Throwable;
+ protected abstract byte[] deflate(byte data[], int level) throws Throwable;
- abstract protected byte[] inflate(byte deflated[]) throws Throwable;
+ protected abstract byte[] inflate(byte deflated[]) throws Throwable;
}
/*
--- a/jdk/test/java/util/zip/FlaterTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/zip/FlaterTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -92,7 +92,7 @@
new FlaterTest().go(numThreads);
}
- synchronized private void go(int numThreads) throws Throwable {
+ private synchronized void go(int numThreads) throws Throwable {
int deflatedLength = getDeflatedLength();
long time = System.currentTimeMillis();
--- a/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/java/util/zip/ZipFile/FinalizeZipFile.java Thu Sep 17 09:19:40 2015 -0700
@@ -34,7 +34,7 @@
public class FinalizeZipFile {
- private final static CountDownLatch finalizersDone = new CountDownLatch(3);
+ private static final CountDownLatch finalizersDone = new CountDownLatch(3);
private static class InstrumentedZipFile extends ZipFile {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/KrbTicket.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,146 @@
+/*
+ * 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.
+ */
+
+import java.nio.file.Files;
+import java.nio.file.Paths;
+import java.time.Instant;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
+import java.util.Set;
+import javax.security.auth.RefreshFailedException;
+import javax.security.auth.Subject;
+import javax.security.auth.kerberos.KerberosTicket;
+import javax.security.auth.login.LoginContext;
+
+/*
+ * @test
+ * @bug 6857795 8075299
+ * @summary Checks Kerberos ticket properties
+ * @run main/othervm KrbTicket
+ */
+public class KrbTicket {
+
+ private static final String REALM = "TEST.REALM";
+ private static final String HOST = "localhost";
+ private static final String USER = "TESTER";
+ private static final String USER_PRINCIPAL = USER + "@" + REALM;
+ private static final String PASSWORD = "password";
+ private static final String KRBTGT_PRINCIPAL = "krbtgt/" + REALM;
+ private static final String KRB5_CONF_FILENAME = "krb5.conf";
+ private static final String JAAS_CONF = "jaas.conf";
+ private static final long TICKET_LIFTETIME = 5 * 60 * 1000; // 5 mins
+
+ public static void main(String[] args) throws Exception {
+ // define principals
+ Map<String, String> principals = new HashMap<>();
+ principals.put(USER_PRINCIPAL, PASSWORD);
+ principals.put(KRBTGT_PRINCIPAL, null);
+
+ System.setProperty("java.security.krb5.conf", KRB5_CONF_FILENAME);
+
+ // start a local KDC instance
+ KDC kdc = KDC.startKDC(HOST, null, REALM, principals, null, null);
+ KDC.saveConfig(KRB5_CONF_FILENAME, kdc,
+ "forwardable = true", "proxiable = true");
+
+ // create JAAS config
+ Files.write(Paths.get(JAAS_CONF), Arrays.asList(
+ "Client {",
+ " com.sun.security.auth.module.Krb5LoginModule required;",
+ "};"
+ ));
+ System.setProperty("java.security.auth.login.config", JAAS_CONF);
+ System.setProperty("javax.security.auth.useSubjectCredsOnly", "false");
+
+ long startTime = Instant.now().getEpochSecond() * 1000;
+
+ LoginContext lc = new LoginContext("Client",
+ new Helper.UserPasswordHandler(USER, PASSWORD));
+ lc.login();
+
+ Subject subject = lc.getSubject();
+ System.out.println("subject: " + subject);
+
+ Set creds = subject.getPrivateCredentials(
+ KerberosTicket.class);
+
+ if (creds.size() > 1) {
+ throw new RuntimeException("Multiple credintials found");
+ }
+
+ Object o = creds.iterator().next();
+ if (!(o instanceof KerberosTicket)) {
+ throw new RuntimeException("Instance of KerberosTicket expected");
+ }
+ KerberosTicket krbTkt = (KerberosTicket) o;
+
+ System.out.println("forwardable = " + krbTkt.isForwardable());
+ System.out.println("proxiable = " + krbTkt.isProxiable());
+ System.out.println("renewable = " + krbTkt.isRenewable());
+ System.out.println("current = " + krbTkt.isCurrent());
+
+ if (!krbTkt.isForwardable()) {
+ throw new RuntimeException("Forwardable ticket expected");
+ }
+
+ if (!krbTkt.isProxiable()) {
+ throw new RuntimeException("Proxiable ticket expected");
+ }
+
+ if (!krbTkt.isCurrent()) {
+ throw new RuntimeException("Ticket is not current");
+ }
+
+ if (krbTkt.isRenewable()) {
+ throw new RuntimeException("Not renewable ticket expected");
+ }
+ try {
+ krbTkt.refresh();
+ throw new RuntimeException(
+ "Expected RefreshFailedException not thrown");
+ } catch(RefreshFailedException e) {
+ System.out.println("Expected exception: " + e);
+ }
+
+ if (!checkTime(krbTkt, startTime)) {
+ throw new RuntimeException("Wrong ticket life time");
+ }
+
+ krbTkt.destroy();
+ if (!krbTkt.isDestroyed()) {
+ throw new RuntimeException("Ticket not destroyed");
+ }
+
+ System.out.println("Test passed");
+ }
+
+ private static boolean checkTime(KerberosTicket krbTkt, long startTime) {
+ long ticketEndTime = krbTkt.getEndTime().getTime();
+ long roughLifeTime = ticketEndTime - startTime;
+ System.out.println("start time = " + startTime);
+ System.out.println("end time = " + ticketEndTime);
+ System.out.println("rough life time = " + roughLifeTime);
+ return roughLifeTime >= TICKET_LIFTETIME;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/krb5/auto/tools/KinitConfPlusProps.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,188 @@
+/*
+ * 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.
+ */
+
+import java.io.File;
+import java.net.PortUnreachableException;
+import java.util.HashMap;
+import java.util.Map;
+import jdk.testlibrary.ProcessTools;
+import jdk.testlibrary.OutputAnalyzer;
+
+/*
+ * @test
+ * @bug 6857795 8075299
+ * @summary Checks if kinit uses both krb5 conf file and system properties
+ * @requires os.family == "windows"
+ * @library /lib/testlibrary
+ * @library /sun/security/krb5/auto
+ * @run main/othervm KinitConfPlusProps
+ */
+public class KinitConfPlusProps {
+
+ private static final String KINIT = System.getProperty("java.home")
+ + File.separator + "bin" + File.separator + "kinit";
+ private static final String KLIST = System.getProperty("java.home")
+ + File.separator + "bin" + File.separator + "klist";
+ private static final String REALM = "REALM";
+ private static final String ANOTHER_REALM = "ANOTHER.REALM";
+ private static final String HOST = "localhost";
+ private static final String CC_FILENAME = "krb5cc_test";
+ private static final String USER = "TESTER";
+ private static final String USER_PRINCIPAL = USER + "@" + REALM;
+ private static final String KRBTGT_PRINCIPAL = "krbtgt/" + REALM;
+ private static final String KEYTAB_FILE = "test.keytab";
+ private static final String KRB5_CONF_FILENAME = "krb5.conf";
+
+ public static void main(String[] args) throws Exception {
+ // define principals
+ Map<String, String> principals = new HashMap<>();
+ principals.put(USER_PRINCIPAL, null);
+ principals.put(KRBTGT_PRINCIPAL, null);
+
+ System.setProperty("java.security.krb5.conf", KRB5_CONF_FILENAME);
+
+ // start a local KDC instance
+ KDC kdc = KDC.startKDC(HOST, null, REALM, principals, KEYTAB_FILE,
+ KDC.KtabMode.APPEND);
+ KDC.saveConfig(KRB5_CONF_FILENAME, kdc,
+ "forwardable = true", "proxiable = true");
+
+ boolean success = true;
+
+ /*
+ * kinit should fail since java.security.krb5.kdc
+ * and java.security.krb5.realm properties override correct values
+ * in krb5 conf file
+ */
+ String[] command = {KINIT, "-k",
+ "-J-Djava.security.krb5.realm=" + REALM,
+ "-J-Djava.security.krb5.kdc=" + HOST, // without port
+ "-J-Djava.security.krb5.conf=" + KRB5_CONF_FILENAME,
+ "-t", KEYTAB_FILE,
+ "-c", CC_FILENAME,
+ USER
+ };
+
+ try {
+ OutputAnalyzer out = ProcessTools.executeCommand(command);
+ out.shouldHaveExitValue(-1);
+ out.shouldContain(PortUnreachableException.class.getName());
+ } catch(Throwable e) {
+ System.out.println("Unexpected exception: " + e);
+ e.printStackTrace(System.out);
+ success = false;
+ }
+
+ /*
+ * kinit should succeed
+ * since realm should be picked up from principal name
+ */
+ command = new String[] {KINIT, "-k",
+ "-J-Djava.security.krb5.realm=" + ANOTHER_REALM,
+ "-J-Djava.security.krb5.kdc=" + HOST,
+ "-J-Djava.security.krb5.conf=" + KRB5_CONF_FILENAME,
+ "-t", KEYTAB_FILE,
+ "-c", CC_FILENAME,
+ USER_PRINCIPAL
+ };
+
+ try {
+ OutputAnalyzer out = ProcessTools.executeCommand(command);
+ out.shouldHaveExitValue(0);
+ out.shouldContain(CC_FILENAME);
+ } catch(Throwable e) {
+ System.out.println("Unexpected exception: " + e);
+ e.printStackTrace(System.out);
+ success = false;
+ }
+
+ success &= checkTicketFlags();
+
+ /*
+ * kinit should succeed
+ * since realm should be picked up from principal name,
+ * and other data should come from krb5 conf file
+ */
+ command = new String[] {KINIT, "-k",
+ "-J-Djava.security.krb5.conf=" + KRB5_CONF_FILENAME,
+ "-t", KEYTAB_FILE,
+ "-c", CC_FILENAME,
+ USER_PRINCIPAL
+ };
+
+ try {
+ OutputAnalyzer out = ProcessTools.executeCommand(command);
+ out.shouldHaveExitValue(0);
+ out.shouldContain(CC_FILENAME);
+ } catch(Throwable e) {
+ System.out.println("Unexpected exception: " + e);
+ e.printStackTrace(System.out);
+ success = false;
+ }
+
+ success &= checkTicketFlags();
+
+ // kinit should succeed even if a principal name doesn't have realm
+ command = new String[] {KINIT, "-k",
+ "-J-Djava.security.krb5.conf=" + KRB5_CONF_FILENAME,
+ "-t", KEYTAB_FILE,
+ "-c", CC_FILENAME,
+ USER
+ };
+
+ try {
+ OutputAnalyzer out = ProcessTools.executeCommand(command);
+ out.shouldHaveExitValue(0);
+ out.shouldContain(CC_FILENAME);
+ } catch(Throwable e) {
+ System.out.println("Unexpected exception: " + e);
+ e.printStackTrace(System.out);
+ success = false;
+ }
+
+ success &= checkTicketFlags();
+
+ if (!success) {
+ throw new RuntimeException("At least one test case failed");
+ }
+ System.out.println("Test passed");
+ }
+
+ // check if a ticket has forwardable and proxiable flags
+ private static boolean checkTicketFlags() {
+ String[] command = new String[] {KLIST, "-f", "-c", CC_FILENAME};
+
+ try {
+ OutputAnalyzer out = ProcessTools.executeCommand(command);
+ out.shouldHaveExitValue(0);
+ out.shouldContain("FORWARDABLE");
+ out.shouldContain("PROXIABLE");
+ } catch(Throwable e) {
+ System.out.println("Unexpected exception: " + e);
+ e.printStackTrace(System.out);
+ return false;
+ }
+
+ return true;
+ }
+}
--- a/jdk/test/sun/security/pkcs11/PKCS11Test.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/sun/security/pkcs11/PKCS11Test.java Thu Sep 17 09:19:40 2015 -0700
@@ -33,6 +33,8 @@
public abstract class PKCS11Test {
+ static final String PKCS11 = "PKCS11";
+
// directory of the test source
static final String BASE = System.getProperty("test.src", ".");
@@ -644,4 +646,12 @@
return "";
}
}
+
+ static byte[] generateData(int length) {
+ byte data[] = new byte[length];
+ for (int i=0; i<data.length; i++) {
+ data[i] = (byte) (i % 256);
+ }
+ return data;
+ }
}
--- a/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/sun/security/pkcs11/Secmod/AddPrivateKey.java Thu Sep 17 09:19:40 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2006, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2006, 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,7 +28,6 @@
* @author Andreas Sterbenz
* @library ..
* @run main/othervm AddPrivateKey
- * @key randomness
*/
import java.io.*;
@@ -43,6 +42,13 @@
// all providers.
public class AddPrivateKey extends SecmodTest {
+ private static final String ALIAS1 = "entry1";
+ private static final String ALIAS2 = "entry2";
+ private static final String ALIAS3 = "entry3";
+ private static final int MAX_LINE = 85;
+ private static final int DATA_LENGTH = 4096;
+ private static final byte[] DATA = generateData(DATA_LENGTH);
+
public static void main(String[] args) throws Exception {
if (initSecmod() == false) {
return;
@@ -57,7 +63,7 @@
System.out.println();
Security.addProvider(p);
- KeyStore ks = KeyStore.getInstance("PKCS11", p);
+ KeyStore ks = KeyStore.getInstance(PKCS11, p);
ks.load(null, password);
for (String alias : aliases(ks)) {
System.out.println("Deleting: " + alias);
@@ -65,25 +71,28 @@
}
KeyStore jks = KeyStore.getInstance("JKS");
- InputStream in = new FileInputStream(new File(BASE, "keystore.jks"));
- char[] jkspass = "passphrase".toCharArray();
- jks.load(in, jkspass);
- List<PrivateKeyEntry> entries = new ArrayList<PrivateKeyEntry>();
- for (String alias : Collections.list(jks.aliases())) {
- if (jks.entryInstanceOf(alias, PrivateKeyEntry.class)) {
- PrivateKeyEntry entry = (PrivateKeyEntry)jks.getEntry(alias, new PasswordProtection(jkspass));
- String algorithm = entry.getPrivateKey().getAlgorithm();
- System.out.println("-Entry " + alias + " (" + algorithm + ")");
- if ((supportsEC == false) && algorithm.equals("EC")) {
- System.out.println("EC not supported by provider, skipping");
- continue;
- }
- if ((supportsEC == false) && algorithm.equals("DSA")) {
- System.out.println("Provider does not appear to have CKA_NETSCAPE_DB fix, skipping");
- continue;
- }
- test(p, entry);
- } // else ignore
+ try (InputStream in = new FileInputStream(BASE + SEP + "keystore.jks")) {
+ char[] jkspass = "passphrase".toCharArray();
+ jks.load(in, jkspass);
+ for (String alias : Collections.list(jks.aliases())) {
+ if (jks.entryInstanceOf(alias, PrivateKeyEntry.class)) {
+ PrivateKeyEntry entry = (PrivateKeyEntry)jks.getEntry(alias,
+ new PasswordProtection(jkspass));
+ String algorithm = entry.getPrivateKey().getAlgorithm();
+ System.out.printf("-Entry %s (%s)%n", alias, algorithm);
+ if ((supportsEC == false) && algorithm.equals("EC")) {
+ System.out.println("EC not supported by provider, "
+ + "skipping");
+ continue;
+ }
+ if ((supportsEC == false) && algorithm.equals("DSA")) {
+ System.out.println("Provider does not appear to have "
+ + "CKA_NETSCAPE_DB fix, skipping");
+ continue;
+ }
+ test(p, entry);
+ } // else ignore
+ }
}
System.out.println("OK");
}
@@ -92,10 +101,6 @@
return Collections.list(ks.aliases());
}
- private final static String ALIAS1 = "entry1";
- private final static String ALIAS2 = "entry2";
- private final static String ALIAS3 = "entry3";
-
private static void test(Provider p, PrivateKeyEntry entry) throws Exception {
PrivateKey key = entry.getPrivateKey();
X509Certificate[] chain = (X509Certificate[])entry.getCertificateChain();
@@ -122,11 +127,8 @@
PrivateKey key2 = (PrivateKey)ks.getKey(ALIAS1, null);
System.out.println(toString(key2));
- X509Certificate[] chain2 = (X509Certificate[])ks.getCertificateChain(ALIAS1);
- // NSS makes token keys always sensitive, skip this check
-// if (key.equals(key2) == false) {
-// throw new Exception("key mismatch");
-// }
+ X509Certificate[] chain2 =
+ (X509Certificate[]) ks.getCertificateChain(ALIAS1);
if (Arrays.equals(chain, chain2) == false) {
throw new Exception("chain mismatch");
}
@@ -154,7 +156,8 @@
PrivateKey key4 = (PrivateKey)ks.getKey(ALIAS2, null);
System.out.println(toString(key4));
- X509Certificate[] chain4 = (X509Certificate[])ks.getCertificateChain(ALIAS2);
+ X509Certificate[] chain4 = (X509Certificate[])
+ ks.getCertificateChain(ALIAS2);
if (Arrays.equals(chain, chain4) == false) {
throw new Exception("chain mismatch");
}
@@ -172,7 +175,8 @@
PrivateKey key5 = (PrivateKey)ks.getKey(ALIAS3, null);
System.out.println(toString(key5));
- X509Certificate[] chain5 = (X509Certificate[])ks.getCertificateChain(ALIAS3);
+ X509Certificate[] chain5 = (X509Certificate[])
+ ks.getCertificateChain(ALIAS3);
if (Arrays.equals(chain, chain5) == false) {
throw new Exception("chain mismatch");
}
@@ -186,24 +190,22 @@
System.out.println("OK");
}
- private final static byte[] DATA = new byte[4096];
-
- static {
- Random random = new Random();
- random.nextBytes(DATA);
- }
-
- private static void sign(Provider p, PrivateKey privateKey, PublicKey publicKey) throws Exception {
+ private static void sign(Provider p, PrivateKey privateKey,
+ PublicKey publicKey) throws Exception {
String keyAlg = privateKey.getAlgorithm();
String alg;
- if (keyAlg.equals("RSA")) {
- alg = "SHA1withRSA";
- } else if (keyAlg.equals("DSA")) {
- alg = "SHA1withDSA";
- } else if (keyAlg.equals("EC")) {
- alg = "SHA1withECDSA";
- } else {
- throw new Exception("Unknown algorithm " + keyAlg);
+ switch (keyAlg) {
+ case "RSA":
+ alg = "SHA1withRSA";
+ break;
+ case "DSA":
+ alg = "SHA1withDSA";
+ break;
+ case "EC":
+ alg = "SHA1withECDSA";
+ break;
+ default:
+ throw new Exception("Unknown algorithm " + keyAlg);
}
Signature s = Signature.getInstance(alg, p);
s.initSign(privateKey);
@@ -217,8 +219,6 @@
}
}
- private final static int MAX_LINE = 85;
-
private static String toString(Object o) {
String s = String.valueOf(o).split("\n")[0];
return (s.length() <= MAX_LINE) ? s : s.substring(0, MAX_LINE);
--- a/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/sun/security/pkcs11/Secmod/AddTrustedCert.java Thu Sep 17 09:19:40 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -44,29 +44,47 @@
return;
}
- InputStream in = new FileInputStream(BASE + SEP + "anchor.cer");
- CertificateFactory factory = CertificateFactory.getInstance("X.509");
- X509Certificate cert = (X509Certificate)factory.generateCertificate(in);
- in.close();
-// System.out.println(cert);
+ X509Certificate cert;
+ try (InputStream in = new FileInputStream(BASE + SEP + "anchor.cer")) {
+ CertificateFactory factory =
+ CertificateFactory.getInstance("X.509");
+ cert = (X509Certificate)factory.generateCertificate(in);
+ }
String configName = BASE + SEP + "nss.cfg";
Provider p = getSunPKCS11(configName);
System.out.println(p);
Security.addProvider(p);
- KeyStore ks = KeyStore.getInstance("PKCS11", p);
+ KeyStore ks = KeyStore.getInstance(PKCS11, p);
ks.load(null, password);
- Collection<String> aliases = new TreeSet<String>(Collections.list(ks.aliases()));
+ Collection<String> aliases = new TreeSet<>(Collections.list(
+ ks.aliases()));
System.out.println("entries: " + aliases.size());
System.out.println(aliases);
int size1 = aliases.size();
String alias = "anchor";
- ks.setCertificateEntry(alias, cert);
+ if (ks.containsAlias(alias)) {
+ throw new Exception("Alias exists: " + alias);
+ }
+
ks.setCertificateEntry(alias, cert);
+ KeyStore.Entry first = ks.getEntry(alias, null);
+ System.out.println("first entry = " + first);
+ if (!ks.entryInstanceOf(alias, TrustedCertificateEntry.class)) {
+ throw new Exception("Unexpected first entry type: " + first);
+ }
- aliases = new TreeSet<String>(Collections.list(ks.aliases()));
+ ks.setCertificateEntry(alias, cert);
+ KeyStore.Entry second = ks.getEntry(alias, null);
+ System.out.println("second entry = " + second);
+ if (!ks.entryInstanceOf(alias, TrustedCertificateEntry.class)) {
+ throw new Exception("Unexpected second entry type: "
+ + second);
+ }
+
+ aliases = new TreeSet<>(Collections.list(ks.aliases()));
System.out.println("entries: " + aliases.size());
System.out.println(aliases);
int size2 = aliases.size();
@@ -79,8 +97,12 @@
throw new Exception("KeyStore returned incorrect certificate");
}
+ ks.deleteEntry(alias);
+ if (ks.containsAlias(alias)) {
+ throw new Exception("Alias still exists: " + alias);
+ }
+
System.out.println("OK");
-
}
}
--- a/jdk/test/sun/security/pkcs11/Secmod/Crypto.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/sun/security/pkcs11/Secmod/Crypto.java Thu Sep 17 09:19:40 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -28,11 +28,8 @@
* @author Andreas Sterbenz
* @library ..
* @run main/othervm Crypto
- * @key randomness
*/
-import java.util.*;
-
import java.security.*;
public class Crypto extends SecmodTest {
@@ -51,9 +48,7 @@
System.out.println(kp.getPublic());
System.out.println(kp.getPrivate());
- SecureRandom random = new SecureRandom();
- byte[] data = new byte[2048];
- random.nextBytes(data);
+ byte[] data = generateData(2048);
Signature sig = Signature.getInstance("SHA1withRSA", p);
sig.initSign(kp.getPrivate());
--- a/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/sun/security/pkcs11/Secmod/GetPrivateKey.java Thu Sep 17 09:19:40 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2011, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -24,11 +24,11 @@
/**
* @test
* @bug 6273877 6322208 6275523
- * @summary make sure we can access the NSS softtoken KeyStore and use a private key
+ * @summary make sure we can access the NSS softtoken KeyStore
+ * and use a private key
* @author Andreas Sterbenz
* @library ..
* @run main/othervm GetPrivateKey
- * @key randomness
*/
import java.util.*;
@@ -49,18 +49,17 @@
System.out.println(p);
Security.addProvider(p);
- KeyStore ks = KeyStore.getInstance("PKCS11", p);
+ KeyStore ks = KeyStore.getInstance(PKCS11, p);
ks.load(null, password);
- Collection<String> aliases = new TreeSet<String>(Collections.list(ks.aliases()));
+ Collection<String> aliases = new TreeSet<>(
+ Collections.list(ks.aliases()));
System.out.println("entries: " + aliases.size());
System.out.println(aliases);
PrivateKey privateKey = (PrivateKey)ks.getKey(keyAlias, password);
System.out.println(privateKey);
- byte[] data = new byte[1024];
- Random random = new Random();
- random.nextBytes(data);
+ byte[] data = generateData(1024);
System.out.println("Signing...");
Signature signature = Signature.getInstance("MD5withRSA");
@@ -68,7 +67,8 @@
signature.update(data);
byte[] sig = signature.sign();
- X509Certificate[] chain = (X509Certificate[])ks.getCertificateChain(keyAlias);
+ X509Certificate[] chain =
+ (X509Certificate[]) ks.getCertificateChain(keyAlias);
signature.initVerify(chain[0].getPublicKey());
signature.update(data);
boolean ok = signature.verify(sig);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/pkcs11/Secmod/LoadKeystore.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,94 @@
+/*
+ * 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.
+ */
+
+import java.io.IOException;
+import java.security.KeyStore;
+import java.security.KeyStoreException;
+import java.security.Provider;
+import java.security.Security;
+import java.security.UnrecoverableKeyException;
+import java.util.Collections;
+
+/*
+ * @test
+ * @bug 8048622 8134232
+ * @summary Checks that PKCS#11 keystore can't be loaded with wrong password
+ * @library ../
+ * @run main/othervm LoadKeystore
+ */
+public class LoadKeystore extends SecmodTest {
+
+ public static void main(String[] args) throws Exception {
+ if (!initSecmod()) {
+ return;
+ }
+
+ String configName = BASE + SEP + "nss.cfg";
+ Provider p = getSunPKCS11(configName);
+
+ System.out.println("Add provider " + p);
+ System.out.println();
+ Security.addProvider(p);
+
+ try {
+ System.out.println("Load keystore with wrong type");
+ KeyStore.getInstance("unknown", p);
+ throw new RuntimeException("Expected exception not thrown");
+ } catch(KeyStoreException e) {
+ System.out.println("Expected exception: " + e);
+ }
+
+ KeyStore ks = KeyStore.getInstance("PKCS11", p);
+ if (!"PKCS11".equals(ks.getType())) {
+ throw new RuntimeException("Unexpected keystore type: "
+ + ks.getType());
+ }
+ if (!p.equals(ks.getProvider())) {
+ throw new RuntimeException("Unexpected keystore provider: "
+ + ks.getProvider());
+ }
+
+ try {
+ System.out.println("Load keystore with wrong password");
+ ks.load(null, "wrong".toCharArray());
+ throw new RuntimeException("Expected exception not thrown");
+ } catch(IOException e) {
+ System.out.println("Expected exception: " + e);
+ Throwable cause = e.getCause();
+ if (!(cause instanceof UnrecoverableKeyException)) {
+ e.printStackTrace(System.out);
+ throw new RuntimeException("Unexpected cause: " + cause);
+ }
+ System.out.println("Expected cause: " + cause);
+ }
+
+ System.out.println("Load keystore with correct password");
+ ks.load(null, password);
+ for (String alias : Collections.list(ks.aliases())) {
+ System.out.println("Alias: " + alias);
+ }
+
+ System.out.println("Test passed");
+ }
+
+}
--- a/jdk/test/sun/security/provider/KeyStore/DKSTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/jdk/test/sun/security/provider/KeyStore/DKSTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -60,8 +60,38 @@
new KeyStore.PasswordProtection("passphrase".toCharArray()));
}};
+ private static final Map<String, KeyStore.ProtectionParameter>
+ WRONG_PASSWORDS = new HashMap<String, KeyStore.ProtectionParameter>() {{
+ put("policy_keystore",
+ new KeyStore.PasswordProtection(
+ "wrong".toCharArray()));
+ put("pw_keystore",
+ new KeyStore.PasswordProtection("wrong".toCharArray()));
+ put("eckeystore1",
+ new KeyStore.PasswordProtection("wrong".toCharArray()));
+ put("eckeystore2",
+ new KeyStore.PasswordProtection("wrong".toCharArray()));
+ }};
+
public static void main(String[] args) throws Exception {
/*
+ * domain keystore: keystores with wrong passwords
+ */
+ try {
+ URI config = new URI(CONFIG + "#keystores");
+ KeyStore ks = KeyStore.getInstance("DKS");
+ ks.load(new DomainLoadStoreParameter(config, WRONG_PASSWORDS));
+ throw new RuntimeException("Expected exception not thrown");
+ } catch (IOException e) {
+ System.out.println("Expected exception: " + e);
+ if (!causedBy(e, UnrecoverableKeyException.class)) {
+ e.printStackTrace(System.out);
+ throw new RuntimeException("Unexpected cause");
+ }
+ System.out.println("Expected cause: " + e);
+ }
+
+ /*
* domain keystore: system
*/
URI config = new URI(CONFIG + "#system");
@@ -182,4 +212,15 @@
return factory.generateCertificate(certStream);
}
}
+
+ // checks if an exception was caused by specified exception class
+ private static boolean causedBy(Exception e, Class klass) {
+ Throwable cause = e;
+ while ((cause = cause.getCause()) != null) {
+ if (cause.getClass().equals(klass)) {
+ return true;
+ }
+ }
+ return false;
+ }
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/jdk/test/sun/security/tools/jarsigner/warning.sh Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,117 @@
+#
+# Copyright (c) 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.
+#
+# 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.
+#
+
+# @test
+# @bug 8024302
+# @bug 8026037
+# @summary Clarify jar verifications
+#
+
+if [ "${TESTJAVA}" = "" ] ; then
+ JAVAC_CMD=`which javac`
+ TESTJAVA=`dirname $JAVAC_CMD`/..
+fi
+
+# set platform-dependent variables
+OS=`uname -s`
+case "$OS" in
+ Windows_* )
+ FS="\\"
+ ;;
+ * )
+ FS="/"
+ ;;
+esac
+
+KS=warnings.jks
+JFILE=warnings.jar
+
+KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit \
+ -keystore $KS"
+JAR="$TESTJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS}"
+JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -keystore $KS -storepass changeit"
+
+rm $KS 2> /dev/null
+
+LANG=C
+export LANG
+
+echo 12345 > file
+
+ERR=""
+
+# Normal signer expiring on 2100-01-01
+$KT -alias s1 -dname CN=s1 -genkey -startdate 2000/01/01 -validity 36525 || ERR="$ERR keytool s1,"
+# Cert expiring soon, informational warning
+$KT -alias s2 -dname CN=s2 -genkey -validity 100 || ERR="$ERR keytool s2,"
+# Cert expired, severe warning
+$KT -alias s3 -dname CN=s3 -genkey -startdate -200d -validity 100 || ERR="$ERR keytool s3,"
+
+# noTimestamp is informatiional warning and includes a date
+$JAR cvf $JFILE file
+$JARSIGNER $JFILE s1 > output1 || ERR="$ERR jarsigner s1,"
+$JARSIGNER -strict $JFILE s1 >> output1 || ERR="$ERR jarsigner s1 strict,"
+$JARSIGNER -verify $JFILE s1 >> output1 || ERR="$ERR jarsigner s1,"
+$JARSIGNER -verify -strict $JFILE s1 >> output1 || ERR="$ERR jarsigner s1 strict,"
+
+cat output1 | grep Warning || ERR="$ERR s1 warning,"
+cat output1 | grep Error && ERR="$ERR s1 error,"
+cat output1 | grep timestamp | grep 2100-01-01 || ERR="$ERR s1 timestamp,"
+cat output1 | grep "with signer errors" && ERR="$ERR s1 err,"
+
+# hasExpiringCert is informatiional warning
+$JAR cvf $JFILE file
+$JARSIGNER $JFILE s2 > output2 || ERR="$ERR jarsigner s2,"
+$JARSIGNER -strict $JFILE s2 >> output2 || ERR="$ERR jarsigner s2 strict,"
+$JARSIGNER -verify $JFILE s2 >> output2 || ERR="$ERR jarsigner s2,"
+$JARSIGNER -verify -strict $JFILE s2 >> output2 || ERR="$ERR jarsigner s2 strict,"
+
+cat output2 | grep Warning || ERR="$ERR s2 warning,"
+cat output2 | grep Error && ERR="$ERR s2 error,"
+cat output2 | grep timestamp || ERR="$ERR s2 timestamp,"
+cat output2 | grep "will expire" || ERR="$ERR s2 expiring,"
+cat output2 | grep "with signer errors" && ERR="$ERR s2 err,"
+
+# hasExpiredCert is severe warning
+$JAR cvf $JFILE file
+$JARSIGNER $JFILE s3 > output3 || ERR="$ERR jarsigner s3,"
+$JARSIGNER -strict $JFILE s3 > output3s && ERR="$ERR jarsigner s3 strict,"
+$JARSIGNER -verify $JFILE s3 >> output3 || ERR="$ERR jarsigner s3,"
+$JARSIGNER -verify -strict $JFILE s3 >> output3s && ERR="$ERR jarsigner s3 strict,"
+
+# warning without -strict
+cat output3 | grep Warning || ERR="$ERR s3 warning,"
+cat output3 | grep Error && ERR="$ERR s3 error,"
+cat output3 | grep "with signer errors" && ERR="$ERR s3 err,"
+
+# error with -strict
+cat output3s | grep Warning || ERR="$ERR s3s warning,"
+cat output3s | grep Error || ERR="$ERR s3s error,"
+cat output3s | grep "with signer errors" || ERR="$ERR s3 err,"
+
+if [ "$ERR" = "" ]; then
+ exit 0
+else
+ echo "ERR is $ERR"
+ exit 1
+fi
--- a/jdk/test/sun/security/tools/jarsigner/warnings.sh Tue Sep 15 15:49:30 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,117 +0,0 @@
-#
-# Copyright (c) 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.
-#
-# 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.
-#
-
-# @test
-# @bug 8024302
-# @bug 8026037
-# @summary Clarify jar verifications
-#
-
-if [ "${TESTJAVA}" = "" ] ; then
- JAVAC_CMD=`which javac`
- TESTJAVA=`dirname $JAVAC_CMD`/..
-fi
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- Windows_* )
- FS="\\"
- ;;
- * )
- FS="/"
- ;;
-esac
-
-KS=warnings.jks
-JFILE=warnings.jar
-
-KT="$TESTJAVA${FS}bin${FS}keytool ${TESTTOOLVMOPTS} -storepass changeit -keypass changeit \
- -keystore $KS"
-JAR="$TESTJAVA${FS}bin${FS}jar ${TESTTOOLVMOPTS}"
-JARSIGNER="$TESTJAVA${FS}bin${FS}jarsigner ${TESTTOOLVMOPTS} -keystore $KS -storepass changeit"
-
-rm $KS 2> /dev/null
-
-LANG=C
-export LANG
-
-echo 12345 > file
-
-ERR=""
-
-# Normal signer expiring on 2100-01-01
-$KT -alias s1 -dname CN=s1 -genkey -startdate 2000/01/01 -validity 36525 || ERR="$ERR keytool s1,"
-# Cert expiring soon, informational warning
-$KT -alias s2 -dname CN=s2 -genkey -validity 100 || ERR="$ERR keytool s2,"
-# Cert expired, severe warning
-$KT -alias s3 -dname CN=s3 -genkey -startdate -200d -validity 100 || ERR="$ERR keytool s3,"
-
-# noTimestamp is informatiional warning and includes a date
-$JAR cvf $JFILE file
-$JARSIGNER $JFILE s1 > output1 || ERR="$ERR jarsigner s1,"
-$JARSIGNER -strict $JFILE s1 >> output1 || ERR="$ERR jarsigner s1 strict,"
-$JARSIGNER -verify $JFILE s1 >> output1 || ERR="$ERR jarsigner s1,"
-$JARSIGNER -verify -strict $JFILE s1 >> output1 || ERR="$ERR jarsigner s1 strict,"
-
-cat output1 | grep Warning || ERR="$ERR s1 warning,"
-cat output1 | grep Error && ERR="$ERR s1 error,"
-cat output1 | grep timestamp | grep 2100-01-01 || ERR="$ERR s1 timestamp,"
-cat output1 | grep "with signer errors" && ERR="$ERR s1 err,"
-
-# hasExpiringCert is informatiional warning
-$JAR cvf $JFILE file
-$JARSIGNER $JFILE s2 > output2 || ERR="$ERR jarsigner s2,"
-$JARSIGNER -strict $JFILE s2 >> output2 || ERR="$ERR jarsigner s2 strict,"
-$JARSIGNER -verify $JFILE s2 >> output2 || ERR="$ERR jarsigner s2,"
-$JARSIGNER -verify -strict $JFILE s2 >> output2 || ERR="$ERR jarsigner s2 strict,"
-
-cat output2 | grep Warning || ERR="$ERR s2 warning,"
-cat output2 | grep Error && ERR="$ERR s2 error,"
-cat output2 | grep timestamp || ERR="$ERR s2 timestamp,"
-cat output2 | grep "will expire" || ERR="$ERR s2 expiring,"
-cat output2 | grep "with signer errors" && ERR="$ERR s2 err,"
-
-# hasExpiredCert is severe warning
-$JAR cvf $JFILE file
-$JARSIGNER $JFILE s3 > output3 || ERR="$ERR jarsigner s3,"
-$JARSIGNER -strict $JFILE s3 > output3s && ERR="$ERR jarsigner s3 strict,"
-$JARSIGNER -verify $JFILE s3 >> output3 || ERR="$ERR jarsigner s3,"
-$JARSIGNER -verify -strict $JFILE s3 >> output3s && ERR="$ERR jarsigner s3 strict,"
-
-# warning without -strict
-cat output3 | grep Warning || ERR="$ERR s3 warning,"
-cat output3 | grep Error && ERR="$ERR s3 error,"
-cat output3 | grep "with signer errors" && ERR="$ERR s3 err,"
-
-# error with -strict
-cat output3s | grep Warning || ERR="$ERR s3s warning,"
-cat output3s | grep Error || ERR="$ERR s3s error,"
-cat output3s | grep "with signer errors" || ERR="$ERR s3 err,"
-
-if [ "$ERR" = "" ]; then
- exit 0
-else
- echo "ERR is $ERR"
- exit 1
-fi
--- a/langtools/.hgtags Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/.hgtags Thu Sep 17 09:19:40 2015 -0700
@@ -323,3 +323,4 @@
7fd155b7041c8aba7084f03e2fd1d6f74cceda75 jdk9-b78
eaab8a16dcfb807acacdb6d133f3ecd502667a8c jdk9-b79
c5671e662392df372b2005b75afa6cfdc0eebce7 jdk9-b80
+ead8b7192f00417185f0e64d0cb332f0f8ad4ae1 jdk9-b81
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/javac/comp/Resolve.java Thu Sep 17 09:19:40 2015 -0700
@@ -1436,6 +1436,7 @@
}
Assert.check(!sym.kind.isResolutionError());
try {
+ types.noWarnings.clear();
Type mt = rawInstantiate(env, site, sym, null, argtypes, typeargtypes,
allowBoxing, useVarargs, types.noWarnings);
currentResolutionContext.addApplicableCandidate(sym, mt);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/AutoFlushWriter.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,62 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.sjavac;
+
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+public class AutoFlushWriter extends FilterWriter {
+
+ public AutoFlushWriter(Writer out) {
+ super(out);
+ }
+
+ @Override
+ public void write(int c) throws IOException {
+ super.write(c);
+ if (c == '\n' || c == '\r')
+ flush();
+ }
+
+ @Override
+ public void write(String str, int off, int len) throws IOException {
+ super.write(str, off, len);
+ if (str.contains("\n") || str.contains("\r"))
+ flush();
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ super.write(cbuf, off, len);
+ for (char c : cbuf) {
+ if (c == '\n' || c == '\r') {
+ flush();
+ break;
+ }
+ }
+ }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CleanProperties.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CleanProperties.java Thu Sep 17 09:19:40 2015 -0700
@@ -31,7 +31,6 @@
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStreamWriter;
-import java.io.PrintStream;
import java.io.Writer;
import java.net.URI;
import java.util.ArrayList;
@@ -78,8 +77,8 @@
int debugLevel,
boolean incremental,
int numCores,
- PrintStream out,
- PrintStream err) {
+ Writer out,
+ Writer err) {
boolean rc = true;
for (String pkgName : pkgSrcs.keySet()) {
String pkgNameF = pkgName.replace('.',File.separatorChar);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileJavaPackages.java Thu Sep 17 09:19:40 2015 -0700
@@ -26,14 +26,22 @@
package com.sun.tools.sjavac;
import java.io.File;
-import java.io.PrintStream;
+import java.io.IOException;
+import java.io.Writer;
import java.net.URI;
+import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
+import java.util.List;
import java.util.Map;
import java.util.Random;
import java.util.Set;
+import java.util.concurrent.Callable;
+import java.util.concurrent.ExecutionException;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+import java.util.concurrent.Future;
import com.sun.tools.sjavac.comp.CompilationService;
import com.sun.tools.sjavac.options.Options;
@@ -83,8 +91,8 @@
int debugLevel,
boolean incremental,
int numCores,
- final PrintStream out,
- final PrintStream err) {
+ final Writer out,
+ final Writer err) {
Log.debug("Performing CompileJavaPackages transform...");
@@ -200,102 +208,83 @@
}
}
- // The return values for each chunked compile.
- final CompilationSubResult[] rn = new CompilationSubResult[numCompiles];
- // The requets, might or might not run as a background thread.
- final Thread[] requests = new Thread[numCompiles];
-
long start = System.currentTimeMillis();
- for (int i=0; i<numCompiles; ++i) {
- final int ii = i;
- final CompileChunk cc = compileChunks[i];
-
- // Pass the num_cores and the id (appended with the chunk number) to the server.
- Object lock = new Object();
- requests[i] = new Thread() {
- @Override
- public void run() {
- rn[ii] = sjavac.compile("n/a",
- id + "-" + ii,
- args.prepJavacArgs(),
- Collections.<File>emptyList(),
- cc.srcs,
- visibleSources);
- // In the code below we have to keep in mind that two
- // different compilation results may include results for
- // the same package.
- synchronized (lock) {
-
- for (String pkg : rn[ii].packageArtifacts.keySet()) {
- Set<URI> pkgArtifacts = rn[ii].packageArtifacts.get(pkg);
- packageArtifacts.merge(pkg, pkgArtifacts, Util::union);
- }
-
- for (String pkg : rn[ii].packageDependencies.keySet()) {
- packageDependencies.putIfAbsent(pkg, new HashMap<>());
- packageDependencies.get(pkg).putAll(rn[ii].packageDependencies.get(pkg));
- }
-
- for (String pkg : rn[ii].packageCpDependencies.keySet()) {
- packageCpDependencies.putIfAbsent(pkg, new HashMap<>());
- packageCpDependencies.get(pkg).putAll(rn[ii].packageCpDependencies.get(pkg));
- }
+ // Prepare compilation calls
+ List<Callable<CompilationSubResult>> compilationCalls = new ArrayList<>();
+ final Object lock = new Object();
+ for (int i = 0; i < numCompiles; i++) {
+ CompileChunk cc = compileChunks[i];
+ if (cc.srcs.isEmpty()) {
+ continue;
+ }
- for (String pkg : rn[ii].packagePubapis.keySet()) {
- packagePubapis.merge(pkg, rn[ii].packagePubapis.get(pkg), PubApi::mergeTypes);
- }
-
- for (String pkg : rn[ii].dependencyPubapis.keySet()) {
- dependencyPubapis.merge(pkg, rn[ii].dependencyPubapis.get(pkg), PubApi::mergeTypes);
- }
- }
+ String chunkId = id + "-" + String.valueOf(i);
+ compilationCalls.add(() -> {
+ CompilationSubResult result = sjavac.compile("n/a",
+ chunkId,
+ args.prepJavacArgs(),
+ Collections.<File>emptyList(),
+ cc.srcs,
+ visibleSources);
+ synchronized (lock) {
+ safeWrite(result.stdout, out);
+ safeWrite(result.stderr, err);
}
- };
+ return result;
+ });
+ }
- if (cc.srcs.size() > 0) {
- String numdeps = "";
- if (cc.numDependents > 0) numdeps = "(with "+cc.numDependents+" dependents) ";
- if (!incremental || cc.numPackages > 16) {
- String info = "("+cc.pkgFromTos+")";
- if (info.equals("( to )")) {
- info = "";
- }
- Log.info("Compiling "+cc.srcs.size()+" files "+numdeps+"in "+cc.numPackages+" packages "+info);
- } else {
- Log.info("Compiling "+cc.pkgNames+numdeps);
- }
- if (concurrentCompiles) {
- requests[ii].start();
- }
- else {
- requests[ii].run();
- // If there was an error, then stop early when running single threaded.
- if (rn[i].returnCode != 0) {
- Log.info(rn[i].stdout);
- Log.error(rn[i].stderr);
- return false;
- }
- }
+ // Perform compilations and collect results
+ List<CompilationSubResult> subResults = new ArrayList<>();
+ List<Future<CompilationSubResult>> futs = new ArrayList<>();
+ ExecutorService exec = Executors.newFixedThreadPool(concurrentCompiles ? compilationCalls.size() : 1);
+ for (Callable<CompilationSubResult> compilationCall : compilationCalls) {
+ futs.add(exec.submit(compilationCall));
+ }
+ for (Future<CompilationSubResult> fut : futs) {
+ try {
+ subResults.add(fut.get());
+ } catch (ExecutionException ee) {
+ Log.error("Compilation failed: " + ee.getMessage());
+ } catch (InterruptedException ee) {
+ Log.error("Compilation interrupted: " + ee.getMessage());
+ Thread.currentThread().interrupt();
}
}
- if (concurrentCompiles) {
- // If there are background threads for the concurrent compiles, then join them.
- for (int i=0; i<numCompiles; ++i) {
- try { requests[i].join(); } catch (InterruptedException e) { }
+ exec.shutdownNow();
+
+ // Process each sub result
+ for (CompilationSubResult subResult : subResults) {
+ for (String pkg : subResult.packageArtifacts.keySet()) {
+ Set<URI> pkgArtifacts = subResult.packageArtifacts.get(pkg);
+ packageArtifacts.merge(pkg, pkgArtifacts, Util::union);
+ }
+
+ for (String pkg : subResult.packageDependencies.keySet()) {
+ packageDependencies.putIfAbsent(pkg, new HashMap<>());
+ packageDependencies.get(pkg).putAll(subResult.packageDependencies.get(pkg));
+ }
+
+ for (String pkg : subResult.packageCpDependencies.keySet()) {
+ packageCpDependencies.putIfAbsent(pkg, new HashMap<>());
+ packageCpDependencies.get(pkg).putAll(subResult.packageCpDependencies.get(pkg));
+ }
+
+ for (String pkg : subResult.packagePubapis.keySet()) {
+ packagePubapis.merge(pkg, subResult.packagePubapis.get(pkg), PubApi::mergeTypes);
+ }
+
+ for (String pkg : subResult.dependencyPubapis.keySet()) {
+ dependencyPubapis.merge(pkg, subResult.dependencyPubapis.get(pkg), PubApi::mergeTypes);
+ }
+
+ // Check the return values.
+ if (subResult.returnCode != 0) {
+ rc = false;
}
}
- // Check the return values.
- for (int i=0; i<numCompiles; ++i) {
- if (compileChunks[i].srcs.size() > 0) {
- if (rn[i].returnCode != 0) {
- Log.info(rn[i].stdout);
- Log.error(rn[i].stderr);
- rc = false;
- }
- }
- }
long duration = System.currentTimeMillis() - start;
long minutes = duration/60000;
long seconds = (duration-minutes*60000)/1000;
@@ -304,6 +293,16 @@
return rc;
}
+ private void safeWrite(String str, Writer w) {
+ if (str.length() > 0) {
+ try {
+ w.write(str);
+ } catch (IOException e) {
+ Log.error("Could not print compilation output.");
+ }
+ }
+ }
+
/**
* Split up the sources into compile chunks. If old package dependents information
* is available, sort the order of the chunks into the most dependent first!
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileProperties.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CompileProperties.java Thu Sep 17 09:19:40 2015 -0700
@@ -85,8 +85,8 @@
int debugLevel,
boolean incremental,
int numCores,
- PrintStream out,
- PrintStream err) {
+ Writer out,
+ Writer err) {
boolean rc = true;
for (String pkgName : pkgSrcs.keySet()) {
String pkgNameF = Util.toFileSystemPath(pkgName);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CopyFile.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/CopyFile.java Thu Sep 17 09:19:40 2015 -0700
@@ -31,7 +31,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
-import java.io.PrintStream;
+import java.io.Writer;
import java.net.URI;
import java.util.HashSet;
import java.util.Map;
@@ -72,8 +72,8 @@
int debugLevel,
boolean incremental,
int numCores,
- PrintStream out,
- PrintStream err)
+ Writer out,
+ Writer err)
{
boolean rc = true;
String dest_filename;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/JavacState.java Thu Sep 17 09:19:40 2015 -0700
@@ -31,7 +31,7 @@
import java.io.FileReader;
import java.io.FileWriter;
import java.io.IOException;
-import java.io.PrintStream;
+import java.io.Writer;
import java.net.URI;
import java.nio.file.NoSuchFileException;
import java.text.SimpleDateFormat;
@@ -131,12 +131,12 @@
private CompileJavaPackages compileJavaPackages = new CompileJavaPackages();
// Where to send stdout and stderr.
- private PrintStream out, err;
+ private Writer out, err;
// Command line options.
private Options options;
- JavacState(Options op, boolean removeJavacState, PrintStream o, PrintStream e) {
+ JavacState(Options op, boolean removeJavacState, Writer o, Writer e) {
options = op;
out = o;
err = e;
@@ -311,7 +311,7 @@
/**
* Load a javac_state file.
*/
- public static JavacState load(Options options, PrintStream out, PrintStream err) {
+ public static JavacState load(Options options, Writer out, Writer err) {
JavacState db = new JavacState(options, false, out, err);
Module lastModule = null;
Package lastPackage = null;
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Log.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Log.java Thu Sep 17 09:19:40 2015 -0700
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 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,7 +25,8 @@
package com.sun.tools.sjavac;
-import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.Writer;
/**
* Utility class only for sjavac logging.
@@ -37,7 +38,7 @@
* deletion without notice.</b>
*/
public class Log {
- private static PrintStream out, err;
+ private static PrintWriter out, err;
public final static int WARN = 1;
public final static int INFO = 2;
@@ -71,9 +72,9 @@
err.println(msg);
}
- static public void initializeLog(PrintStream o, PrintStream e) {
- out = o;
- err = e;
+ static public void initializeLog(Writer o, Writer e) {
+ out = new PrintWriter(o);
+ err = new PrintWriter(e);
}
static public void setLogLevel(String l) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Transformer.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/Transformer.java Thu Sep 17 09:19:40 2015 -0700
@@ -25,7 +25,7 @@
package com.sun.tools.sjavac;
-import java.io.PrintStream;
+import java.io.Writer;
import java.net.URI;
import java.util.Map;
import java.util.Set;
@@ -97,8 +97,8 @@
int debugLevel,
boolean incremental,
int numCores,
- PrintStream out,
- PrintStream err);
+ Writer out,
+ Writer err);
void setExtra(String e);
void setExtra(Options args);
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/ClientMain.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/ClientMain.java Thu Sep 17 09:19:40 2015 -0700
@@ -25,13 +25,14 @@
package com.sun.tools.sjavac.client;
-import java.io.PrintStream;
+import java.io.OutputStreamWriter;
+import java.io.Writer;
+import com.sun.tools.sjavac.AutoFlushWriter;
import com.sun.tools.sjavac.Log;
import com.sun.tools.sjavac.Util;
import com.sun.tools.sjavac.comp.SjavacImpl;
import com.sun.tools.sjavac.options.Options;
-import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.Sjavac;
/**
@@ -43,10 +44,12 @@
public class ClientMain {
public static int run(String[] args) {
- return run(args, System.out, System.err);
+ return run(args,
+ new AutoFlushWriter(new OutputStreamWriter(System.out)),
+ new AutoFlushWriter(new OutputStreamWriter(System.err)));
}
- public static int run(String[] args, PrintStream out, PrintStream err) {
+ public static int run(String[] args, Writer out, Writer err) {
Log.initializeLog(out, err);
@@ -78,14 +81,11 @@
sjavac = new SjavacImpl();
}
- CompilationResult cr = sjavac.compile(args);
-
- out.print(cr.stdout);
- err.print(cr.stderr);
+ int rc = sjavac.compile(args, out, err);
if (!background)
sjavac.shutdown();
- return cr.returnCode;
+ return rc;
}
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/client/SjavacClient.java Thu Sep 17 09:19:40 2015 -0700
@@ -25,11 +25,14 @@
package com.sun.tools.sjavac.client;
+import java.io.BufferedReader;
import java.io.File;
import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStreamWriter;
import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.Writer;
import java.net.InetAddress;
import java.net.InetSocketAddress;
import java.net.Socket;
@@ -43,7 +46,6 @@
import com.sun.tools.sjavac.options.OptionHelper;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.server.CompilationSubResult;
-import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.PortFile;
import com.sun.tools.sjavac.server.Sjavac;
import com.sun.tools.sjavac.server.SjavacServer;
@@ -119,29 +121,47 @@
}
@Override
- public CompilationResult compile(String[] args) {
- CompilationResult result;
+ public int compile(String[] args, Writer stdout, Writer stderr) {
+ int result = -1;
try (Socket socket = tryConnect()) {
- // The ObjectInputStream constructor will block until the
- // corresponding ObjectOutputStream has written and flushed the
- // header, so it is important that the ObjectOutputStreams on server
- // and client are opened before the ObjectInputStreams.
- ObjectOutputStream oos = new ObjectOutputStream(socket.getOutputStream());
- ObjectInputStream ois = new ObjectInputStream(socket.getInputStream());
- oos.writeObject(id);
- oos.writeObject(SjavacServer.CMD_COMPILE);
- oos.writeObject(args);
- oos.flush();
- result = (CompilationResult) ois.readObject();
- } catch (IOException | ClassNotFoundException ex) {
- Log.error("[CLIENT] Exception caught: " + ex);
- result = new CompilationResult(CompilationSubResult.ERROR_FATAL);
- result.stderr = Util.getStackTrace(ex);
+ PrintWriter out = new PrintWriter(new OutputStreamWriter(socket.getOutputStream()));
+ BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+
+ // Send args array to server
+ out.println(args.length);
+ for (String arg : args)
+ out.println(arg);
+ out.flush();
+
+ // Read server response line by line
+ String line;
+ while (null != (line = in.readLine())) {
+ String[] typeAndContent = line.split(":", 2);
+ String type = typeAndContent[0];
+ String content = typeAndContent[1];
+ switch (type) {
+ case SjavacServer.LINE_TYPE_STDOUT:
+ stdout.write(content);
+ stdout.write('\n');
+ break;
+ case SjavacServer.LINE_TYPE_STDERR:
+ stderr.write(content);
+ stderr.write('\n');
+ break;
+ case SjavacServer.LINE_TYPE_RC:
+ result = Integer.parseInt(content);
+ break;
+ }
+ }
+ } catch (IOException ioe) {
+ Log.error("[CLIENT] Exception caught: " + ioe);
+ result = CompilationSubResult.ERROR_FATAL;
+ ioe.printStackTrace(new PrintWriter(stderr));
} catch (InterruptedException ie) {
Thread.currentThread().interrupt(); // Restore interrupt
Log.error("[CLIENT] compile interrupted.");
- result = new CompilationResult(CompilationSubResult.ERROR_FATAL);
- result.stderr = Util.getStackTrace(ie);
+ result = CompilationSubResult.ERROR_FATAL;
+ ie.printStackTrace(new PrintWriter(stderr));
}
return result;
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PooledSjavac.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/PooledSjavac.java Thu Sep 17 09:19:40 2015 -0700
@@ -24,13 +24,13 @@
*/
package com.sun.tools.sjavac.comp;
+import java.io.Writer;
import java.util.Objects;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
import java.util.concurrent.TimeUnit;
import com.sun.tools.sjavac.Log;
-import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.Sjavac;
/**
@@ -54,10 +54,10 @@
}
@Override
- public CompilationResult compile(String[] args) {
+ public int compile(String[] args, Writer out, Writer err) {
try {
return pool.submit(() -> {
- return delegate.compile(args);
+ return delegate.compile(args, out, err);
}).get();
} catch (Exception e) {
e.printStackTrace();
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/comp/SjavacImpl.java Thu Sep 17 09:19:40 2015 -0700
@@ -24,12 +24,9 @@
*/
package com.sun.tools.sjavac.comp;
-import static com.sun.tools.sjavac.server.CompilationResult.ERROR_FATAL;
-import static java.nio.charset.StandardCharsets.UTF_8;
-
-import java.io.ByteArrayOutputStream;
import java.io.IOException;
-import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.Writer;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
@@ -49,7 +46,6 @@
import com.sun.tools.sjavac.Util;
import com.sun.tools.sjavac.options.Options;
import com.sun.tools.sjavac.options.SourceLocation;
-import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.Sjavac;
/**
@@ -64,39 +60,33 @@
public class SjavacImpl implements Sjavac {
@Override
- public CompilationResult compile(String[] args) {
-
- ByteArrayOutputStream outBaos = new ByteArrayOutputStream();
- ByteArrayOutputStream errBaos = new ByteArrayOutputStream();
- PrintStream out = new PrintStream(outBaos);
- PrintStream err = new PrintStream(errBaos);
-
+ public int compile(String[] args, Writer out, Writer err) {
Options options;
try {
options = Options.parseArgs(args);
} catch (IllegalArgumentException e) {
Log.error(e.getMessage());
- return new CompilationResult(ERROR_FATAL);
+ return RC_FATAL;
}
Log.setLogLevel(options.getLogLevel());
if (!validateOptions(options))
- return new CompilationResult(ERROR_FATAL);
+ return RC_FATAL;
if (!createIfMissing(options.getDestDir()))
- return new CompilationResult(ERROR_FATAL);
+ return RC_FATAL;
if (!createIfMissing(options.getStateDir()))
- return new CompilationResult(ERROR_FATAL);
+ return RC_FATAL;
Path gensrc = options.getGenSrcDir();
if (gensrc != null && !createIfMissing(gensrc))
- return new CompilationResult(ERROR_FATAL);
+ return RC_FATAL;
Path hdrdir = options.getHeaderDir();
if (hdrdir != null && !createIfMissing(hdrdir))
- return new CompilationResult(ERROR_FATAL);
+ return RC_FATAL;
// Load the prev build state database.
JavacState javac_state = JavacState.load(options, out, err);
@@ -132,9 +122,7 @@
if (sources.isEmpty()) {
Log.error("Found nothing to compile!");
- return new CompilationResult(CompilationResult.ERROR_FATAL,
- new String(outBaos.toByteArray(), UTF_8),
- new String(errBaos.toByteArray(), UTF_8));
+ return RC_FATAL;
}
@@ -251,19 +239,13 @@
javac_state.removeSuperfluousArtifacts(recently_compiled);
}
- return new CompilationResult(rc[0] ? 0 : ERROR_FATAL,
- new String(outBaos.toByteArray(), UTF_8),
- new String(errBaos.toByteArray(), UTF_8));
+ return rc[0] ? RC_OK : RC_FATAL;
} catch (ProblemException e) {
Log.error(e.getMessage());
- return new CompilationResult(ERROR_FATAL,
- new String(outBaos.toByteArray(), UTF_8),
- new String(errBaos.toByteArray(), UTF_8));
+ return RC_FATAL;
} catch (Exception e) {
- e.printStackTrace(err);
- return new CompilationResult(ERROR_FATAL,
- new String(outBaos.toByteArray(), UTF_8),
- new String(errBaos.toByteArray(), UTF_8));
+ e.printStackTrace(new PrintWriter(err));
+ return RC_FATAL;
}
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/CompilationResult.java Tue Sep 15 15:49:30 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,60 +0,0 @@
-/*
- * 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
- * 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.tools.sjavac.server;
-
-import java.io.Serializable;
-
-/**
- * <p><b>This is NOT part of any supported API.
- * If you write code that depends on this, you do so at your own risk.
- * This code and its internal interfaces are subject to change or
- * deletion without notice.</b>
- */
-public class CompilationResult implements Serializable {
-
- static final long serialVersionUID = 46739181113L;
-
- // Return code constants
- public final static int ERROR_FATAL = -1;
-
- public String stdout;
- public String stderr;
- public int returnCode;
-
- public CompilationResult(int returnCode) {
- this(returnCode, "", "");
- }
-
- public CompilationResult(int returnCode, String stdout, String stderr) {
- this.returnCode = returnCode;
- this.stdout = stdout;
- this.stderr = stderr;
- }
-
- public void setReturnCode(int returnCode) {
- this.returnCode = returnCode;
- }
-}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/IdleResetSjavac.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/IdleResetSjavac.java Thu Sep 17 09:19:40 2015 -0700
@@ -24,6 +24,7 @@
*/
package com.sun.tools.sjavac.server;
+import java.io.Writer;
import java.util.Timer;
import java.util.TimerTask;
@@ -60,10 +61,10 @@
}
@Override
- public CompilationResult compile(String[] args) {
+ public int compile(String[] args, Writer out, Writer err) {
startCall();
try {
- return delegate.compile(args);
+ return delegate.compile(args, out, err);
} finally {
endCall();
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/LinePrefixFilterWriter.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,77 @@
+/*
+ * 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.
+ */
+
+package com.sun.tools.sjavac.server;
+
+import java.io.FilterWriter;
+import java.io.IOException;
+import java.io.Writer;
+
+/**
+ * Inserts {@literal prefix} in front of each line written.
+ *
+ * A line is considered to be terminated by any one of a line feed, a carriage
+ * return, or a carriage return followed immediately by a line feed.
+ */
+public class LinePrefixFilterWriter extends FilterWriter {
+
+ private final String prefix;
+ private boolean atBeginningOfLine = true;
+ private char lastChar = '\0';
+
+ protected LinePrefixFilterWriter(Writer out, String prefix) {
+ super(out);
+ this.prefix = prefix;
+ }
+
+ @Override
+ public void write(String str, int off, int len) throws IOException {
+ for (int i = 0; i < len; i++) {
+ write(str.charAt(off + i));
+ }
+ }
+
+ @Override
+ public void write(char[] cbuf, int off, int len) throws IOException {
+ for (int i = 0; i < len; i++) {
+ write(cbuf[off + i]);
+ }
+ }
+
+ @Override
+ public void write(int c) throws IOException {
+ if (lastChar == '\r' && c == '\n') {
+ // Second character of CR+LF sequence.
+ // Do nothing. We already started a new line on last character.
+ } else {
+ if (atBeginningOfLine) {
+ super.write(prefix, 0, prefix.length());
+ }
+ super.write(c);
+ atBeginningOfLine = c == '\r' || c == '\n';
+ }
+ lastChar = (char) c;
+ }
+}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/RequestHandler.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/RequestHandler.java Thu Sep 17 09:19:40 2015 -0700
@@ -24,15 +24,21 @@
*/
package com.sun.tools.sjavac.server;
-import java.io.IOException;
-import java.io.ObjectInputStream;
-import java.io.ObjectOutputStream;
+import static com.sun.tools.sjavac.server.SjavacServer.LINE_TYPE_RC;
+import static com.sun.tools.sjavac.server.SjavacServer.LINE_TYPE_STDERR;
+import static com.sun.tools.sjavac.server.SjavacServer.LINE_TYPE_STDOUT;
+
+import java.io.BufferedReader;
+import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.io.StringWriter;
+import java.io.Writer;
import java.net.Socket;
+import com.sun.tools.sjavac.AutoFlushWriter;
import com.sun.tools.sjavac.Log;
+
/**
* A RequestHandler handles requests performed over a socket. Specifically it
* - Reads the command string specifying which method is to be invoked
@@ -61,15 +67,26 @@
@Override
public void run() {
- try (ObjectOutputStream oout = new ObjectOutputStream(socket.getOutputStream());
- ObjectInputStream oin = new ObjectInputStream(socket.getInputStream())) {
- String id = (String) oin.readObject();
- String cmd = (String) oin.readObject();
- Log.info("Handling request, id: " + id + " cmd: " + cmd);
- switch (cmd) {
- case SjavacServer.CMD_COMPILE: handleCompileRequest(oin, oout); break;
- default: Log.error("Unknown command: " + cmd);
+ try (BufferedReader in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
+ PrintWriter out = new PrintWriter(socket.getOutputStream(), true)) {
+
+ // Read argument array
+ int n = Integer.parseInt(in.readLine());
+ String[] args = new String[n];
+ for (int i = 0; i < n; i++) {
+ args[i] = in.readLine();
}
+
+ // Perform compilation
+ Writer stdout = new LinePrefixFilterWriter(new AutoFlushWriter(out), LINE_TYPE_STDOUT + ":");
+ Writer stderr = new LinePrefixFilterWriter(new AutoFlushWriter(out), LINE_TYPE_STDERR + ":");
+ int rc = sjavac.compile(args, stdout, stderr);
+ stdout.flush();
+ stderr.flush();
+
+ // Send return code back to client
+ out.println(LINE_TYPE_RC + ":" + rc);
+
} catch (Exception ex) {
// Not much to be done at this point. The client side request
// code will most likely throw an IOException and the
@@ -79,21 +96,4 @@
Log.error(sw.toString());
}
}
-
- private void handleCompileRequest(ObjectInputStream oin,
- ObjectOutputStream oout) throws IOException {
- try {
- // Read request arguments
- String[] args = (String[]) oin.readObject();
-
- // Perform compilation
- CompilationResult cr = sjavac.compile(args);
-
- // Write request response
- oout.writeObject(cr);
- oout.flush();
- } catch (ClassNotFoundException cnfe) {
- throw new IOException(cnfe);
- }
- }
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/ServerMain.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/ServerMain.java Thu Sep 17 09:19:40 2015 -0700
@@ -26,6 +26,7 @@
package com.sun.tools.sjavac.server;
import java.io.IOException;
+import java.io.OutputStreamWriter;
import com.sun.tools.sjavac.Log;
@@ -38,7 +39,8 @@
public class ServerMain {
public static int run(String[] args) {
- Log.initializeLog(System.out, System.err);
+ Log.initializeLog(new OutputStreamWriter(System.out),
+ new OutputStreamWriter(System.err));
// Any options other than --startserver?
if (args.length > 1) {
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/Sjavac.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/Sjavac.java Thu Sep 17 09:19:40 2015 -0700
@@ -24,6 +24,8 @@
*/
package com.sun.tools.sjavac.server;
+import java.io.Writer;
+
/**
* Interface of the SjavacImpl, the sjavac client and all wrappers such as
@@ -35,6 +37,10 @@
* deletion without notice.</b>
*/
public interface Sjavac {
- CompilationResult compile(String[] args);
+
+ final static int RC_FATAL = -1;
+ final static int RC_OK = 0;
+
+ int compile(String[] args, Writer stdout, Writer stderr);
void shutdown();
}
--- a/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/src/jdk.compiler/share/classes/com/sun/tools/sjavac/server/SjavacServer.java Thu Sep 17 09:19:40 2015 -0700
@@ -53,8 +53,10 @@
*/
public class SjavacServer implements Terminable {
- // Used in protocol to indicate which method to invoke
- public final static String CMD_COMPILE = "compile";
+ // Used in protocol to tell the content of each line
+ public final static String LINE_TYPE_RC = "RC";
+ public final static String LINE_TYPE_STDOUT = "STDOUT";
+ public final static String LINE_TYPE_STDERR = "STDERR";
final private String portfilename;
final private String logfile;
--- a/langtools/test/tools/javac/lib/combo/ReusableContext.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/test/tools/javac/lib/combo/ReusableContext.java Thu Sep 17 09:19:40 2015 -0700
@@ -31,8 +31,12 @@
import com.sun.source.util.TaskListener;
import com.sun.source.util.TreeScanner;
import com.sun.tools.javac.api.MultiTaskListener;
+import com.sun.tools.javac.code.Kinds;
import com.sun.tools.javac.code.Symbol;
import com.sun.tools.javac.code.Symtab;
+import com.sun.tools.javac.code.Type;
+import com.sun.tools.javac.code.Type.ClassType;
+import com.sun.tools.javac.code.TypeTag;
import com.sun.tools.javac.code.Types;
import com.sun.tools.javac.comp.Check;
import com.sun.tools.javac.comp.CompileStates;
@@ -93,23 +97,46 @@
//find if any of the roots have redefined java.* classes
Symtab syms = Symtab.instance(this);
- new TreeScanner<Void, Void>() {
- @Override
- public Void visitClass(ClassTree node, Void aVoid) {
- Symbol sym = ((JCClassDecl)node).sym;
- if (sym != null) {
- syms.classes.remove(sym.flatName());
- if (sym.flatName().toString().startsWith("java.")) {
- polluted = true;
- }
- }
- return super.visitClass(node, aVoid);
- }
- }.scan(roots, null);
+ pollutionScanner.scan(roots, syms);
roots.clear();
}
}
+ /**
+ * This scanner detects as to whether the shared context has been polluted. This happens
+ * whenever a compiled program redefines a core class (in 'java.*' package) or when
+ * (typically because of cyclic inheritance) the symbol kind of a core class has been touched.
+ */
+ TreeScanner<Void, Symtab> pollutionScanner = new TreeScanner<Void, Symtab>() {
+ @Override
+ public Void visitClass(ClassTree node, Symtab syms) {
+ Symbol sym = ((JCClassDecl)node).sym;
+ if (sym != null) {
+ syms.classes.remove(sym.flatName());
+ Type sup = supertype(sym);
+ if (isCoreClass(sym) ||
+ (sup != null && isCoreClass(sup.tsym) && sup.tsym.kind != Kinds.Kind.TYP)) {
+ polluted = true;
+ }
+ }
+ return super.visitClass(node, syms);
+ }
+
+ private boolean isCoreClass(Symbol s) {
+ return s.flatName().toString().startsWith("java.");
+ }
+
+ private Type supertype(Symbol s) {
+ if (s.type == null ||
+ !s.type.hasTag(TypeTag.CLASS)) {
+ return null;
+ } else {
+ ClassType ct = (ClassType)s.type;
+ return ct.supertype_field;
+ }
+ }
+ };
+
@Override
public void finished(TaskEvent e) {
if (e.getKind() == Kind.PARSE) {
--- a/langtools/test/tools/javac/sym/ElementStructureTest.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/test/tools/javac/sym/ElementStructureTest.java Thu Sep 17 09:19:40 2015 -0700
@@ -56,6 +56,7 @@
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.ServiceLoader;
import java.util.Set;
import java.util.TreeMap;
import java.util.TreeSet;
@@ -76,6 +77,7 @@
import javax.lang.model.element.VariableElement;
import javax.lang.model.type.TypeMirror;
import javax.tools.FileObject;
+import javax.tools.JavaCompiler;
import javax.tools.JavaFileManager;
import javax.tools.JavaFileObject;
import javax.tools.JavaFileObject.Kind;
@@ -88,7 +90,6 @@
import com.sun.tools.javac.api.JavacTaskImpl;
import com.sun.tools.javac.code.Symbol.CompletionFailure;
import com.sun.tools.javac.platform.PlatformProvider;
-import com.sun.tools.javac.util.ServiceLoader;
/**To generate the hash values for version N, invoke this class like:
*
@@ -243,7 +244,11 @@
}
void run(Writer output, String version) throws Exception {
- JavacTaskImpl task = (JavacTaskImpl) ToolProvider.getSystemJavaCompiler().getTask(null, null, null, Arrays.asList("-release", version), null, Arrays.asList(new ToolBox.JavaSource("Test", "")));
+ List<String> options = Arrays.asList("-release", version, "-classpath", "");
+ List<ToolBox.JavaSource> files = Arrays.asList(new ToolBox.JavaSource("Test", ""));
+ JavaCompiler compiler = ToolProvider.getSystemJavaCompiler();
+ JavacTaskImpl task = (JavacTaskImpl) compiler.getTask(null, null, null, options, null, files);
+
task.parse();
JavaFileManager fm = task.getContext().get(JavaFileManager.class);
--- a/langtools/test/tools/sjavac/IdleShutdown.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/test/tools/sjavac/IdleShutdown.java Thu Sep 17 09:19:40 2015 -0700
@@ -29,9 +29,9 @@
* @build Wrapper
* @run main Wrapper IdleShutdown
*/
+import java.io.Writer;
import java.util.concurrent.atomic.AtomicLong;
-import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.IdleResetSjavac;
import com.sun.tools.sjavac.server.Sjavac;
import com.sun.tools.sjavac.server.Terminable;
@@ -65,11 +65,11 @@
// Use Sjavac object and wait less than TIMEOUT_MS in between calls
Thread.sleep(TIMEOUT_MS - 1000);
log("Compiling");
- service.compile(new String[0]);
+ service.compile(new String[0], null, null);
Thread.sleep(TIMEOUT_MS - 1000);
log("Compiling");
- service.compile(new String[0]);
+ service.compile(new String[0], null, null);
if (timeoutTimestamp.get() != -1)
throw new AssertionError("Premature timeout detected.");
@@ -103,13 +103,13 @@
public void shutdown() {
}
@Override
- public CompilationResult compile(String[] args) {
+ public int compile(String[] args, Writer out, Writer err) {
// Attempt to trigger idle timeout during a call by sleeping
try {
Thread.sleep(TIMEOUT_MS + 1000);
} catch (InterruptedException e) {
}
- return null;
+ return 0;
}
}
}
--- a/langtools/test/tools/sjavac/PooledExecution.java Tue Sep 15 15:49:30 2015 +0200
+++ b/langtools/test/tools/sjavac/PooledExecution.java Thu Sep 17 09:19:40 2015 -0700
@@ -30,11 +30,11 @@
* @build Wrapper
* @run main Wrapper PooledExecution
*/
+import java.io.Writer;
import java.util.concurrent.CountDownLatch;
import java.util.concurrent.atomic.AtomicInteger;
import com.sun.tools.sjavac.comp.PooledSjavac;
-import com.sun.tools.sjavac.server.CompilationResult;
import com.sun.tools.sjavac.server.Sjavac;
@@ -67,7 +67,7 @@
for (int i = 0; i < NUM_REQUESTS; i++) {
tasks[i] = new Thread() {
public void run() {
- service.compile(new String[0]);
+ service.compile(new String[0], null, null);
tasksFinished.incrementAndGet();
}
};
@@ -109,7 +109,7 @@
AtomicInteger activeRequests = new AtomicInteger(0);
@Override
- public CompilationResult compile(String[] args) {
+ public int compile(String[] args, Writer out, Writer err) {
leftToStart.countDown();
int numActiveRequests = activeRequests.incrementAndGet();
System.out.printf("Left to start: %2d / Currently active: %2d%n",
@@ -123,7 +123,7 @@
}
activeRequests.decrementAndGet();
System.out.println("Task completed");
- return null;
+ return 0;
}
@Override
--- a/make/CompileJavaModules.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/make/CompileJavaModules.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -534,8 +534,7 @@
## Service types are required in the classpath when compiing module-info
$1_CLASSPATH := $$($1_CLASSPATH) $$(addprefix $(JDK_OUTPUTDIR)/modules/,jdk.hotspot.agent)
endif
- $1_CLASSPATH := $$(subst $$(SPACE),$$(PATH_SEP),$$($1_CLASSPATH))
- $1_JAVAC_FLAGS := -bootclasspath $(EMPTY_DIR) -extdirs $(EMPTY_DIR) -endorseddirs $(EMPTY_DIR) -classpath "$$($1_CLASSPATH)" $$($1_ADD_JAVAC_FLAGS)
+ $1_JAVAC_FLAGS := -bootclasspath $(EMPTY_DIR) -extdirs $(EMPTY_DIR) -endorseddirs $(EMPTY_DIR) $$($1_ADD_JAVAC_FLAGS)
$$(eval $$(call SetupJavaCompilation,$1, \
SETUP := $$(if $$($1_SETUP), $$($1_SETUP), GENERATE_JDKBYTECODE), \
@@ -543,6 +542,7 @@
INCLUDES := $(JDK_USER_DEFINED_FILTER),\
BIN := $$(if $$($1_BIN), $$($1_BIN), $(JDK_OUTPUTDIR)/modules/$1), \
HEADERS := $(SUPPORT_OUTPUTDIR)/headers/$1, \
+ CLASSPATH := $$($1_CLASSPATH), \
ADD_JAVAC_FLAGS := $$($1_ADD_JAVAC_FLAGS) $$($1_JAVAC_FLAGS)))
$1: $$($1) $$($1_COPY_EXTRA)
--- a/make/Init.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/make/Init.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -50,7 +50,7 @@
include $(topdir)/make/Help.gmk
# Targets provided by Init.gmk.
- ALL_INIT_TARGETS := print-modules print-targets reconfigure
+ ALL_INIT_TARGETS := print-modules print-targets print-configuration reconfigure
# CALLED_TARGETS is the list of targets that the user provided,
# or "default" if unspecified.
@@ -228,6 +228,9 @@
$(MAKE) $(MAKE_ARGS) -j 1 -f make/Main.gmk $(USER_MAKE_VARS) \
NO_RECIPES=true print-targets )
+ print-configuration:
+ $(ECHO) $(CONFIGURE_COMMAND_LINE)
+
reconfigure:
ifneq ($(CONFIGURE_COMMAND_LINE), )
$(ECHO) "Re-running configure using arguments '$(CONFIGURE_COMMAND_LINE)'"
--- a/make/common/JavaCompilation.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/make/common/JavaCompilation.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -403,6 +403,7 @@
# SRC:=one or more directories to search for sources. The order of the source roots
# is significant. The first found file of a certain name has priority.
# BIN:=store classes here
+# CLASSPATH:=a list of additional entries to set as classpath to javac
# INCLUDES:=myapp.foo means will only compile java files in myapp.foo or any of its sub-packages.
# EXCLUDES:=myapp.foo means will do not compile java files in myapp.foo or any of its sub-packages.
# COPY:=.prp means copy all prp files to the corresponding package in BIN.
@@ -428,6 +429,9 @@
$1_JVM := $$($$($1_SETUP)_JVM)
$1_JAVAC := $$($$($1_SETUP)_JAVAC)
$1_FLAGS := $$($$($1_SETUP)_FLAGS) $(JAVAC_FLAGS) $$($1_ADD_JAVAC_FLAGS)
+ ifneq ($$($1_CLASSPATH), )
+ $1_FLAGS += -cp $$(call PathList, $$($1_CLASSPATH))
+ endif
ifeq ($$($1_JAVAC),)
$$(error The Java compilation $1 refers to a non-existant java compiler setup $$($1_SETUP))
endif
@@ -482,7 +486,7 @@
$$(addprefix -i ,$$(addsuffix /*,$$($1_INCLUDES))) \
$$(addprefix -xf *,$$(strip $$($1_EXCLUDE_FILES) $$($1_SJAVAC_EXCLUDE_FILES))) \
$$(addprefix -if *,$$(strip $$($1_INCLUDE_FILES))) \
- -src "$$(subst $$(SPACE),$$(PATH_SEP),$$(strip $$($1_SRC)))"
+ -src $$(call PathList, $$($1_SRC))
# All files below META-INF are always copied.
$1_ALL_COPIES := $$(filter $$(addsuffix /META-INF%,$$($1_SRC)),$$($1_ALL_SRCS))
--- a/make/common/MakeBase.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/make/common/MakeBase.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -41,6 +41,29 @@
# next make invocation.
.DELETE_ON_ERROR:
+################################################################################
+# Definitions for special characters
+################################################################################
+
+# When calling macros, the spaces between arguments are
+# often semantically important! Sometimes we need to subst
+# spaces and commas, therefore we need the following macros.
+X:=
+SPACE:=$(X) $(X)
+COMMA:=,
+DOLLAR:=$$
+HASH:=\#
+LEFT_PAREN:=(
+RIGHT_PAREN:=)
+SQUOTE:='
+#'
+DQUOTE:="
+#"
+define NEWLINE
+
+
+endef
+
##############################
# Functions
##############################
@@ -780,6 +803,14 @@
endif
################################################################################
+# Return a string suitable for use after a -classpath option. It will correct and safe to use
+# on all platforms. Arguments are given as space separate classpath entries.
+# param 1 : A space separated list of classpath entries
+# The surrounding strip is needed to keep additional whitespace out
+PathList = \
+ "$(subst $(SPACE),$(PATH_SEP),$(strip $1))"
+
+################################################################################
# Hook to include the corresponding custom file, if present.
$(eval $(call IncludeCustomExtension, , common/MakeBase.gmk))
--- a/make/common/NativeCompilation.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/make/common/NativeCompilation.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -624,28 +624,7 @@
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).pdb \
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).map
- else ifeq ($(OPENJDK_TARGET_OS), solaris)
- $1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
- # Setup the command line creating debuginfo files, to be run after linking.
- # It cannot be run separately since it updates the original target file
- #
- # gobjcopy crashes on "empty" section headers with the SHF_ALLOC flag set.
- # Use $(FIX_EMPTY_SEC_HDR_FLAGS) to clear the SHF_ALLOC flag (if set) from
- # empty section headers until a fixed $(OBJCOPY) is available.
- # An empty section header has sh_addr == 0 and sh_size == 0.
- # This problem has only been seen on Solaris X64, but we call this tool
- # on all Solaris builds just in case.
- #
- # $(OBJCOPY) --add-gnu-debuglink=... corrupts SUNW_* sections.
- # Use $(ADD_GNU_DEBUGLINK) until a fixed $(OBJCOPY) is available.
- $1_CREATE_DEBUGINFO_CMDS := \
- $(FIX_EMPTY_SEC_HDR_FLAGS) $(LOG_INFO) $$($1_TARGET) $$(NEWLINE) \
- $(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
- $(CD) $$($1_OUTPUT_DIR) && \
- $(ADD_GNU_DEBUGLINK) $(LOG_INFO) $$($1_DEBUGINFO_FILES) $$($1_TARGET)
- $1_DEBUGINFO_EXTRA_DEPS := $(FIX_EMPTY_SEC_HDR_FLAGS) $(ADD_GNU_DEBUGLINK)
-
- else ifeq ($(OPENJDK_TARGET_OS), linux)
+ else ifneq ($(findstring $(OPENJDK_TARGET_OS), linux solaris), )
$1_DEBUGINFO_FILES := $$($1_OBJECT_DIR)/$$($1_NOSUFFIX).debuginfo
# Setup the command line creating debuginfo files, to be run after linking.
# It cannot be run separately since it updates the original target file
@@ -653,7 +632,6 @@
$(OBJCOPY) --only-keep-debug $$($1_TARGET) $$($1_DEBUGINFO_FILES) $$(NEWLINE) \
$(CD) $$($1_OUTPUT_DIR) && \
$(OBJCOPY) --add-gnu-debuglink=$$($1_DEBUGINFO_FILES) $$($1_TARGET)
-
endif # No MacOS X support
# This dependency dance ensures that debug info files get rebuilt
@@ -694,7 +672,7 @@
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
$$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_REAL_MAPFILE) \
- $$($1_DEBUGINFO_EXTRA_DEPS) $$($1_VARDEPS_FILE)
+ $$($1_VARDEPS_FILE)
$(ECHO) $(LOG_INFO) "Linking $$($1_BASENAME)"
$(call LogFailures, $$($1_OBJECT_DIR)/$1_link.log, $1_link, \
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
@@ -735,7 +713,7 @@
$$($1_OBJECT_DIR)/$$($1_NOSUFFIX).vardeps)
$$($1_TARGET): $$($1_EXPECTED_OBJS) $$($1_RES) $$($1_MANIFEST) \
- $$($1_DEBUGINFO_EXTRA_DEPS) $$($1_VARDEPS_FILE)
+ $$($1_VARDEPS_FILE)
$(ECHO) $(LOG_INFO) "Linking executable $$($1_BASENAME)"
$(call LogFailures, $$($1_OBJECT_DIR)/$1_link.log, $1_link, \
$$($1_LD) $$($1_LDFLAGS) $$($1_EXTRA_LDFLAGS) $$($1_SYSROOT_LDFLAGS) \
--- a/make/common/SetupJavaCompilers.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/make/common/SetupJavaCompilers.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -78,7 +78,7 @@
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
-JDK_BOOTCLASSPATH := $(subst $(SPACE),$(PATH_SEP),\
+JDK_BOOTCLASSPATH := $(call PathList, \
$(filter-out $(JDK_OUTPUTDIR)/modules/_%, $(wildcard $(JDK_OUTPUTDIR)/modules/*)))
# After the jdk is built, we want to build demos using only the recently
@@ -88,7 +88,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_USINGJDKBYTECODE, \
JVM := $(JAVA_SMALL), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -bootclasspath "$(JDK_BOOTCLASSPATH)" $(DISABLE_WARNINGS), \
+ FLAGS := -bootclasspath $(JDK_BOOTCLASSPATH) $(DISABLE_WARNINGS), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
--- a/make/common/TestFilesCompilation.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/make/common/TestFilesCompilation.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -32,8 +32,6 @@
include NativeCompilation.gmk
-# FIXME: This is a bad fix currently needed due to JDK-8064808 not being resolved.
-include $(JDK_TOPDIR)/make/Tools.gmk
# Setup make rules for creating a set of native test files (libraries or
# executables). This will locate native files matching a certain pattern,
--- a/nashorn/.hgtags Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/.hgtags Thu Sep 17 09:19:40 2015 -0700
@@ -314,3 +314,4 @@
6f634e84387e97b2421d5e776e46935784156d1c jdk9-b78
9b3eca69b88b2d1bebce92d58280ae66fc0b6091 jdk9-b79
61b401b23fc28208930977d46b690423911173c6 jdk9-b80
+42d8ed4651b62572b39e6fed3fafcb7ee93f9dc2 jdk9-b81
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ClassGenerator.java Thu Sep 17 09:19:40 2015 -0700
@@ -54,10 +54,9 @@
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_NEWMAP;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_NEWMAP_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROPERTYMAP_TYPE;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_MAKEFUNCTION;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_MAKEFUNCTION_DESC;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_MAKEFUNCTION_SPECS_DESC;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_CREATEBUILTIN;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_CREATEBUILTIN_DESC;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_CREATEBUILTIN_SPECS_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_TYPE;
@@ -282,9 +281,9 @@
assert specs != null;
if (!specs.isEmpty()) {
mi.memberInfoArray(className, specs);
- mi.invokeStatic(SCRIPTFUNCTIONIMPL_TYPE, SCRIPTFUNCTIONIMPL_MAKEFUNCTION, SCRIPTFUNCTIONIMPL_MAKEFUNCTION_SPECS_DESC);
+ mi.invokeStatic(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_CREATEBUILTIN, SCRIPTFUNCTION_CREATEBUILTIN_SPECS_DESC);
} else {
- mi.invokeStatic(SCRIPTFUNCTIONIMPL_TYPE, SCRIPTFUNCTIONIMPL_MAKEFUNCTION, SCRIPTFUNCTIONIMPL_MAKEFUNCTION_DESC);
+ mi.invokeStatic(SCRIPTFUNCTION_TYPE, SCRIPTFUNCTION_CREATEBUILTIN, SCRIPTFUNCTION_CREATEBUILTIN_DESC);
}
if (arityFound) {
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/ConstructorGenerator.java Thu Sep 17 09:19:40 2015 -0700
@@ -38,9 +38,8 @@
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_SETCONSTRUCTOR_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.PROTOTYPEOBJECT_TYPE;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_INIT_DESC3;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_INIT_DESC4;
-import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTIONIMPL_TYPE;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_INIT_DESC3;
+import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_INIT_DESC4;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETARITY_DESC;
import static jdk.nashorn.internal.tools.nasgen.StringConstants.SCRIPTFUNCTION_SETPROTOTYPE;
@@ -76,7 +75,7 @@
byte[] getClassBytes() {
// new class extending from ScriptObject
- final String superClass = (constructor != null)? SCRIPTFUNCTIONIMPL_TYPE : SCRIPTOBJECT_TYPE;
+ final String superClass = (constructor != null)? SCRIPTFUNCTION_TYPE : SCRIPTOBJECT_TYPE;
cw.visit(V1_7, ACC_FINAL, className, null, superClass, null);
if (memberCount > 0) {
// add fields
@@ -182,8 +181,8 @@
loadMap(mi);
} else {
// call Function.<init>
- superClass = SCRIPTFUNCTIONIMPL_TYPE;
- superDesc = (memberCount > 0) ? SCRIPTFUNCTIONIMPL_INIT_DESC4 : SCRIPTFUNCTIONIMPL_INIT_DESC3;
+ superClass = SCRIPTFUNCTION_TYPE;
+ superDesc = (memberCount > 0) ? SCRIPTFUNCTION_INIT_DESC4 : SCRIPTFUNCTION_INIT_DESC3;
mi.loadLiteral(constructor.getName());
mi.visitLdcInsn(new Handle(H_INVOKESTATIC, scriptClassInfo.getJavaName(), constructor.getJavaName(), constructor.getJavaDesc()));
loadMap(mi);
--- a/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/buildtools/nasgen/src/jdk/nashorn/internal/tools/nasgen/StringConstants.java Thu Sep 17 09:19:40 2015 -0700
@@ -31,10 +31,9 @@
import java.util.Collections;
import java.util.List;
import jdk.internal.org.objectweb.asm.Type;
-import jdk.nashorn.internal.objects.PrototypeObject;
-import jdk.nashorn.internal.objects.ScriptFunctionImpl;
import jdk.nashorn.internal.runtime.AccessorProperty;
import jdk.nashorn.internal.runtime.PropertyMap;
+import jdk.nashorn.internal.runtime.PrototypeObject;
import jdk.nashorn.internal.runtime.ScriptFunction;
import jdk.nashorn.internal.runtime.ScriptObject;
import jdk.nashorn.internal.runtime.Specialization;
@@ -88,7 +87,6 @@
static final Type TYPE_PROPERTYMAP = Type.getType(PropertyMap.class);
static final Type TYPE_PROTOTYPEOBJECT = Type.getType(PrototypeObject.class);
static final Type TYPE_SCRIPTFUNCTION = Type.getType(ScriptFunction.class);
- static final Type TYPE_SCRIPTFUNCTIONIMPL = Type.getType(ScriptFunctionImpl.class);
static final Type TYPE_SCRIPTOBJECT = Type.getType(ScriptObject.class);
static final String PROTOTYPE_SUFFIX = "$Prototype";
@@ -122,17 +120,14 @@
static final String SCRIPTFUNCTION_SETARITY_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, Type.INT_TYPE);
static final String SCRIPTFUNCTION_SETPROTOTYPE = "setPrototype";
static final String SCRIPTFUNCTION_SETPROTOTYPE_DESC = Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_OBJECT);
-
- // ScriptFunctionImpl
- static final String SCRIPTFUNCTIONIMPL_TYPE = TYPE_SCRIPTFUNCTIONIMPL.getInternalName();
- static final String SCRIPTFUNCTIONIMPL_MAKEFUNCTION = "makeFunction";
- static final String SCRIPTFUNCTIONIMPL_MAKEFUNCTION_DESC =
+ static final String SCRIPTFUNCTION_CREATEBUILTIN = "createBuiltin";
+ static final String SCRIPTFUNCTION_CREATEBUILTIN_DESC =
Type.getMethodDescriptor(TYPE_SCRIPTFUNCTION, TYPE_STRING, TYPE_METHODHANDLE);
- static final String SCRIPTFUNCTIONIMPL_MAKEFUNCTION_SPECS_DESC =
+ static final String SCRIPTFUNCTION_CREATEBUILTIN_SPECS_DESC =
Type.getMethodDescriptor(TYPE_SCRIPTFUNCTION, TYPE_STRING, TYPE_METHODHANDLE, TYPE_SPECIALIZATION_ARRAY);
- static final String SCRIPTFUNCTIONIMPL_INIT_DESC3 =
+ static final String SCRIPTFUNCTION_INIT_DESC3 =
Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_SPECIALIZATION_ARRAY);
- static final String SCRIPTFUNCTIONIMPL_INIT_DESC4 =
+ static final String SCRIPTFUNCTION_INIT_DESC4 =
Type.getMethodDescriptor(Type.VOID_TYPE, TYPE_STRING, TYPE_METHODHANDLE, TYPE_PROPERTYMAP, TYPE_SPECIALIZATION_ARRAY);
// ScriptObject
--- a/nashorn/make/BuildNashorn.gmk Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/make/BuildNashorn.gmk Thu Sep 17 09:19:40 2015 -0700
@@ -31,7 +31,7 @@
include JavaCompilation.gmk
include SetupJavaCompilers.gmk
-JDK_CLASSES := $(subst $(SPACE),$(PATH_SEP),$(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
+JDK_CLASSES := $(call PathList, $(strip $(addprefix $(JDK_OUTPUTDIR)/modules/, \
java.base java.logging java.scripting)))
NASHORN_JAR := $(IMAGES_OUTPUTDIR)/nashorn.jar
@@ -48,7 +48,7 @@
$(eval $(call SetupJavaCompiler,GENERATE_NEWBYTECODE_DEBUG, \
JVM := $(JAVA), \
JAVAC := $(NEW_JAVAC), \
- FLAGS := -g -source 8 -target 8 -bootclasspath "$(JDK_CLASSES)", \
+ FLAGS := -g -source 8 -target 8 -bootclasspath $(JDK_CLASSES), \
SERVER_DIR := $(SJAVAC_SERVER_DIR), \
SERVER_JVM := $(SJAVAC_SERVER_JAVA)))
@@ -86,7 +86,8 @@
$(RM) -rf $(@D)/jdk $(@D)/netscape
$(CP) -R -p $(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/classes/* $(@D)/
$(FIXPATH) $(JAVA) \
- -Xbootclasspath/p:"$(BUILDTOOLS_OUTPUTDIR)/nasgen_classes$(PATH_SEP)$(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/classes" \
+ -Xbootclasspath/p:$(call PathList, $(BUILDTOOLS_OUTPUTDIR)/nasgen_classes \
+ $(SUPPORT_OUTPUTDIR)/special_classes/jdk.scripting.nashorn/classes) \
jdk.nashorn.internal.tools.nasgen.Main $(@D) jdk.nashorn.internal.objects $(@D)
$(TOUCH) $@
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/EvalWithArbitraryThis.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.script.*;
+import jdk.nashorn.api.scripting.*;
+
+// Simple nashorn demo that evals a script with arbitrary script
+// object bound as "this" for the evaluated script.
+
+public class EvalWithArbitraryThis {
+ public static void main(String[] args) throws Exception {
+ ScriptEngineManager m = new ScriptEngineManager();
+ ScriptEngine e = m.getEngineByName("nashorn");
+ Object sobj = e.eval("( { foo: 343, bar: 'hello' } )");
+
+ // "this" bound to sobj in this eval.
+ // so it prints sobj.foo and sobj.bar.
+ ((ScriptObjectMirror)sobj).eval("print(this.foo); print(this.bar)");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/EvalWithArbitraryThis.java.orig Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.script.*;
+import jdk.nashorn.api.scripting.*;
+
+// Simple nashorn demo that evals a script with arbitrary script
+// object bound as "this" for the evaluated script.
+
+public class EvalWithArbitraryThis {
+ public static void main(String[] args) throws Exception {
+ ScriptEngineManager m = new ScriptEngineManager();
+ ScriptEngine e = m.getEngineByName("nashorn");
+ Object sobj = e.eval("( { foo: 343, bar: 'hello' } )");
+
+ // "this" bound to sobj in this eval.
+ // so it prints sobj.foo and sobj.bar.
+ ((ScriptObjectMirror)sobj).eval("print(this.foo); print(this.bar)");
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/LambdaAsFunc.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.script.*;
+import java.util.function.*;
+
+// example demonstrating that arbitrary Lambda can be called as function from script
+
+public class LambdaAsFunc {
+ public static void main(String[] args) throws Exception {
+ ScriptEngineManager m = new ScriptEngineManager();
+ ScriptEngine e = m.getEngineByName("nashorn");
+
+ // expose a lambda as top-level script function
+ e.put("upper", (Function<String, String>) String::toUpperCase);
+
+ // call lambda as though it is a normal script function
+ System.out.println(e.eval("upper('hello')"));
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/Main.asm Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,103 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Simple sample to demonstrate openjdk asmtools assembler with
+// nashorn dynalink linker in a invokedynamic instruction.
+//
+// To assemble this file, use the following command:
+//
+// java -cp <asmtools.jar> org.openjdk.asmtools.Main jasm Main.asm
+//
+// See also: https://wiki.openjdk.java.net/display/CodeTools/asmtools
+//
+// NOTE: Uses nashorn internals and so *may* break with later nashorn!
+
+super public class Main
+ version 52:0
+{
+
+
+public Method "<init>":"()V"
+ stack 1 locals 1
+{
+ aload_0;
+ invokespecial Method java/lang/Object."<init>":"()V";
+ return;
+}
+
+public static Method main:"([Ljava/lang/String;)V"
+ stack 2 locals 2
+{
+ // List l = new ArrayList();
+ new class java/util/ArrayList;
+ dup;
+ invokespecial Method java/util/ArrayList."<init>":"()V";
+ astore_1;
+ aload_1;
+
+ // l.add("hello");
+ ldc String "hello";
+ invokeinterface InterfaceMethod java/util/List.add:"(Ljava/lang/Object;)Z", 2;
+ pop;
+
+ // l.add("world");
+ aload_1;
+ ldc String "world";
+ invokeinterface InterfaceMethod java/util/List.add:"(Ljava/lang/Object;)Z", 2;
+ pop;
+
+ // printLength(l);
+ aload_1;
+ invokestatic Method printLength:"(Ljava/lang/Object;)V";
+
+ // printLength(args); // args is argument of main method
+ aload_0;
+ invokestatic Method printLength:"(Ljava/lang/Object;)V";
+ return;
+}
+
+private static Method printLength:"(Ljava/lang/Object;)V"
+ stack 2 locals 1
+{
+ getstatic Field java/lang/System.out:"Ljava/io/PrintStream;";
+ aload_0;
+
+ // Using nashorn embedded dynalink linker with the following invokedynamic
+ // 'length' property on a bean - arrays, lists supported
+
+ invokedynamic InvokeDynamic REF_invokeStatic:jdk/nashorn/internal/runtime/linker/Bootstrap.bootstrap:"(Ljava/lang/invoke/MethodHandles$Lookup;Ljava/lang/String;Ljava/lang/invoke/MethodType;I)Ljava/lang/invoke/CallSite;":"dyn:getProp|getElem|getMethod:length":"(Ljava/lang/Object;)Ljava/lang/Object;" int 0;
+
+ // print 'length' value
+ invokevirtual Method java/io/PrintStream.println:"(Ljava/lang/Object;)V";
+ return;
+}
+
+} // end Class Main
Binary file nashorn/samples/Main.class has changed
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/PrintToString.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+import javax.script.*;
+import java.io.StringWriter;
+
+// simple example demonstrating capturing of "print" output
+// from script execution as a String via script engine API.
+
+public class PrintToString {
+ public static void main(String[] args) throws ScriptException {
+ ScriptEngineManager m = new ScriptEngineManager();
+ ScriptEngine e = m.getEngineByName("nashorn");
+ StringWriter sw = new StringWriter();
+ e.getContext().setWriter(sw);
+ e.eval("print('hello world')");
+ System.out.println(sw.toString());
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/array_removeif.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Sample for Collection.removeIf and Java.to
+// See http://docs.oracle.com/javase/8/docs/api/java/util/Collection.html#removeIf-java.util.function.Predicate-
+
+var langs = [
+ "java", "javascript",
+ "C", "C#", "C++",
+ "Erlang", "Haskell"
+];
+
+// convert script array to a Java List
+function asList(array) {
+ return Java.to(array, java.util.List);
+}
+
+// remove elements that satisfy a predicate
+// using Collection.removeIf(Predicate)
+asList(langs).removeIf(
+ function(s) s.startsWith("C"));
+
+// print modified array
+print(langs);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/bind_on_java.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// sample to demonstrate calling Function.prototype.bind on Java methods.
+
+var DoubleStream = java.util.stream.DoubleStream;
+var r = new java.util.Random();
+
+// bind "this" for nextGaussian method of Random class
+var next = Function.bind.call(r.nextGaussian, r);
+
+// next is used as no argument "function"
+DoubleStream
+ .generate(function() next())
+ .limit(100)
+ .forEach(print);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/call_bind_java.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Sample demonstrating calling Java methods like normal
+// functions. Bound instance methods, static methods can be
+// called like normal script functions.
+
+// Java types used
+var Files = Java.type("java.nio.file.Files");
+var FileSystems = Java.type("java.nio.file.FileSystems");
+var System = Java.type("java.lang.System");
+
+var fs = FileSystems.default;
+var bind = Function.prototype.bind;
+
+// Java methods as "functions"
+
+// Java method with bound "this"
+var Path = bind.call(fs.getPath, fs);
+// Java static method
+var Property = System.getProperty;
+
+// call Java static methods and bound instance methods
+// like normal script functions.
+
+var root = Path("/");
+// print URI for root dir
+print(root.toUri());
+var home = Path(Property("user.home"));
+// list home directory
+Files.walk(home).forEach(print);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/check_nashorn.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// check if script is being run using nashorn script engine
+function isNashorn() {
+ try {
+ // "engine" variable is of type javax.script.ScriptEngine is defined
+ // by nashorn jsr-223 engine. Check the name of the engine from
+ // javax.script.ScriptEngineFactory associated
+
+ return engine.factory.engineName.contains("Nashorn");
+ } catch (e) {
+ // if engine or any of the properties are undefined
+ // then script is not being run using nashorn.
+ return false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/datetime.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,73 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// converting b/w JavaScript Date and Java LocalDateTime
+
+// JavaScript Date with current time
+var d = new Date();
+print(d);
+
+// Java 8 java.time classes used
+var Instant = java.time.Instant;
+var LocalDateTime = java.time.LocalDateTime;
+var ZoneId = java.time.ZoneId;
+
+// Date.prototype.getTime
+
+// getTime() method returns the numeric value corresponding to the time
+// for the specified date according to universal time. The value returned
+// by the getTime() method is the number of milliseconds since 1 January 1970 00:00:00 UTC.
+// See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/getTime
+
+// Java Instant.ofEpochMilli to convert time in milliseconds to Instant object
+// https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html#ofEpochMilli-long-
+
+var instant = Instant.ofEpochMilli(d.getTime());
+
+// Instant to LocalDateTime using LocalDateTime.ofInstant
+// https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html#ofInstant-java.time.Instant-java.time.ZoneId-
+
+var ldt = LocalDateTime.ofInstant(instant, ZoneId.systemDefault());
+print(ldt);
+
+// converting a LocalDateTime to JavaScript Date
+// convert LocalDateTime to Instant first
+// https://docs.oracle.com/javase/8/docs/api/java/time/LocalDateTime.html#atZone-java.time.ZoneId-
+
+var instant = ldt.atZone(ZoneId.systemDefault()).toInstant();
+
+// instant to to epoch milliseconds
+// https://docs.oracle.com/javase/8/docs/api/java/time/Instant.html#toEpochMilli--
+// and then to JavaScript Date from time in milliseconds
+// https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Global_Objects/Date
+
+var d1 = new Date(instant.toEpochMilli());
+print(d1);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/defaults.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// print default methods of a Java class
+
+if (arguments.length == 0) {
+ print("Usage: jjs defaults.js -- <java class name>");
+ exit(1);
+}
+
+var jclass = Java.type(arguments[0]).class;
+for each (m in jclass.methods) {
+ // http://docs.oracle.com/javase/8/docs/api/java/lang/reflect/Method.html#isDefault--
+ if (m.default) print(m);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/find_max_lines.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Find the file with maximum number of lines
+
+var Files = Java.type("java.nio.file.Files");
+var Integer = Java.type("java.lang.Integer");
+var Paths = Java.type("java.nio.file.Paths");
+
+var file = arguments.length == 0? "." : arguments[0];
+var ext = arguments.length > 1? arguments[1] : ".java";
+var path = Paths.get(file);
+
+// return number of lines in given Path (that represents a file)
+function lines(p) {
+ var strm = Files.lines(p);
+ try {
+ return strm.count();
+ } finally {
+ strm.close();
+ }
+}
+
+// walk files, map to file and lines, find the max
+var obj = Files.find(path, Integer.MAX_VALUE,
+ function(p, a) !p.toFile().isDirectory() && p.toString().endsWith(ext)).
+map(function(p) ({ path : p, lines: lines(p) })).
+max(function(x, y) x.lines - y.lines).get();
+
+// print path and lines of the max line file
+print(obj.path, obj.lines);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/fixed_point.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,69 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Simple sample demonstrating "fixed point" computation with Streams
+
+// See also https://mitpress.mit.edu/sicp/chapter1/node21.html#secprocgeneralmethods
+var Stream = Java.type("java.util.stream.Stream");
+
+// generic fixed point procedure
+function fixed_point(f, init_guess) {
+ var tolerance = 0.00001;
+ function close_enough(v1, v2) Math.abs(v1 - v2) < tolerance;
+
+ var prev;
+ return Stream.iterate(init_guess, f)
+ .filter(function(x) {
+ try {
+ return prev == undefined? false : close_enough(prev, x);
+ } finally {
+ prev = x;
+ }
+ })
+ .findFirst()
+ .get();
+}
+
+// solution to x = cos(x)
+print(fixed_point(Math.cos, 1.0))
+
+// solution to x = sin(x) + cos(x)
+print(fixed_point(function(x) Math.sin(x) + Math.cos(x), 1.0));
+
+// square root by Newton's method
+// http://en.wikipedia.org/wiki/Newton's_method
+function sqrt(n)
+ fixed_point(function(x) (x + n/x) / 2, 2.0);
+
+print(sqrt(2))
+print(sqrt(3))
+
+
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/importstatic.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Java like "import static class_name.*" for nashorn
+
+function importStatic(clazz) {
+ // make sure the argument is a Java type
+ if (! Java.isType(clazz)) {
+ throw new TypeError(clazz + " is not a Java type");
+ }
+
+ // bind properties of clazz to an object
+ var obj = Object.bindProperties({}, clazz);
+
+ // copy properties to global to "import" those
+ for (var i in obj) {
+ this[i] = obj[i];
+ }
+}
+
+importStatic(java.time.Instant);
+print(now());
+print(ofEpochSecond(1));
+print(parse("2007-12-03T10:15:30.00Z"));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/java_completion.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,41 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Simple sample demonstrating the use of JShell API with nashorn
+
+// display source code completion suggestions for a Java snippet using JShell's API
+// See http://openjdk.java.net/projects/kulla/
+
+var repl = Java.type("jdk.jshell.JShell").create()
+var analysis = repl.sourceCodeAnalysis()
+var code = "System."
+var suggestions = analysis.completionSuggestions(code, code.length, [0])
+suggestions.forEach(function(s) print(s.continuation))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/jrtlist.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,37 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// list contents of "jrt" file system in Java 9
+
+with(new JavaImporter(java.nio.file, java.net)) {
+ var fs = FileSystems.getFileSystem(URI.create("jrt:/"))
+ Files.walk(fs.getPath("/")).forEach(print);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/mothers_day.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,56 @@
+# compute Mothers day of the given the year
+
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// print "Mother's day" of the given year using Java Time API
+
+if (arguments.length == 0) {
+ print("Usage: jjs mothers_day.js -- year");
+ exit(1);
+}
+
+// java classes used
+var DayOfWeek = java.time.DayOfWeek;
+var LocalDate = java.time.LocalDate;
+var TemporalAdjusters = java.time.temporal.TemporalAdjusters;
+
+var year = parseInt(arguments[0]);
+
+// See: https://en.wikipedia.org/?title=Mother%27s_Day
+// We need second Sunday of May. Make April 30 of the given
+// year adjust and adjust to next Sunday from there twice. To adjust a Date
+// we use a common TemporalAdjuster provided in JDK8.
+// https://docs.oracle.com/javase/8/docs/api/java/time/temporal/TemporalAdjusters.html
+
+print(LocalDate.of(year, 4, 30).
+ with(TemporalAdjusters.next(DayOfWeek.SUNDAY)).
+ with(TemporalAdjusters.next(DayOfWeek.SUNDAY)));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/passwordgen.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,49 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Simple password generator using SecureRandom + stream API
+
+// accept optional password length from command line
+var len = arguments.length? parseInt(arguments[0]) : 8;
+
+// Java types used
+var Collectors = Java.type("java.util.stream.Collectors");
+var SecureRandom = Java.type("java.security.SecureRandom");
+
+// allowed password chars
+var chars =
+ "!@#$%ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
+
+// generated and print password
+print(new SecureRandom().
+ ints(len, 0, chars.length).
+ mapToObj(function(i) chars[i]).
+ collect(Collectors.joining("")));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/print_symlinks.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Print all symbolic links in user's home directory
+
+// JavaImporter and "with" to simulate "import" statements in Java.
+// See https://wiki.openjdk.java.net/display/Nashorn/Nashorn+extensions
+
+with (new JavaImporter(java.nio.file, java.lang)) {
+
+ var userDir = System.getProperty("user.dir")
+ var home = FileSystems.default.getPath(userDir);
+
+ // JS functions can be passed where Java lambdas are required.
+ // Also, using "Expression closure" extension here.
+ // See https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Operators/Expression_Closures
+
+ Files.walk(home).
+ filter(function(p) Files.isSymbolicLink(p)).
+ forEach(function(p)
+ print(p, '->', Files.readSymbolicLink(p)));
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/sort_by_java8.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// Simple sorting with Java8 APIs
+
+// Separation key-extraction from key ordering
+
+// Simple demo for Comparator.comparing
+// http://docs.oracle.com/javase/8/docs/api/java/util/Comparator.html#comparing-java.util.function.Function-
+
+// data to be sorted
+var cards = [
+ { name: "hello", email: "foo@hello.com" },
+ { name: "world", email: "bar@world.com" },
+ { name: "see", email: "see@dontsee.com" },
+];
+
+var Collections = java.util.Collections;
+var Comparator = java.util.Comparator;
+
+// sort records name in reverse order of names
+Collections.sort(cards,
+ Comparator.comparing(function(a) a.name).reversed());
+
+print(JSON.stringify(cards))
+
+// sort records by email
+Collections.sort(cards,
+ Comparator.comparing(function(a) a.email));
+
+print(JSON.stringify(cards))
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/samples/this_for_eval.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ * - Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ *
+ * - Redistributions in binary form must reproduce the above copyright
+ * notice, this list of conditions and the following disclaimer in the
+ * documentation and/or other materials provided with the distribution.
+ *
+ * - Neither the name of Oracle nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
+ * IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
+ * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+ * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR
+ * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+ * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+ * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+ * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+ * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+ * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+ * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+// how to pass arbitrary "this" object for eval'ed script?
+
+var obj = { foo: 44 };
+
+// the following won't work. eval.apply is indirect eval call
+// and so 'this' will be global object always! So, this
+// line will print 'undefined'
+eval.apply(obj, [ " print(this.foo)" ]);
+
+obj.myEval = eval;
+
+// still won't work - still indirect 'eval' call!
+// still undefined is printed!
+obj.myEval("print(this.foo)");
+
+function func(code) {
+ eval(code);
+}
+
+// eval called inside func and so get's func's "this" as it's "this"!
+// So, 44 is printed
+
+func.apply(obj, [ "print(this.foo)" ]);
--- a/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn.shell/share/classes/jdk/nashorn/tools/jjs/Console.java Thu Sep 17 09:19:40 2015 -0700
@@ -49,9 +49,9 @@
Console(final InputStream cmdin, final PrintStream cmdout, final File historyFile,
final Completer completer) throws IOException {
+ TerminalFactory.registerFlavor(Flavor.WINDOWS, isCygwin()? JJSUnixTerminal::new : JJSWindowsTerminal::new);
+ TerminalFactory.registerFlavor(Flavor.UNIX, JJSUnixTerminal::new);
in = new ConsoleReader(cmdin, cmdout);
- TerminalFactory.registerFlavor(Flavor.WINDOWS, JJSWindowsTerminal :: new);
- TerminalFactory.registerFlavor(Flavor.UNIX, JJSUnixTerminal :: new);
in.setExpandEvents(false);
in.setHandleUserInterrupt(true);
in.setBellEnabled(true);
@@ -134,4 +134,8 @@
setAnsiSupported(false);
}
}
+
+ private static boolean isCygwin() {
+ return System.getenv("SHELL") != null;
+ }
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/DynamicLinker.java Thu Sep 17 09:19:40 2015 -0700
@@ -117,7 +117,7 @@
* return factory.createLinker();
* }
*
- * public static CallSite bootstrap(MethodHandles.Lookup caller, String name, MethodType type) {
+ * public static CallSite bootstrap(MethodHandles.Lookup lookup, String name, MethodType type) {
* return dynamicLinker.link(new MonomorphicCallSite(CallSiteDescriptorFactory.create(lookup, name, type)));
* }
* }
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/FacetIntrospector.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/FacetIntrospector.java Thu Sep 17 09:19:40 2015 -0700
@@ -152,7 +152,7 @@
boolean isAccessible(final Member m) {
final Class<?> declaring = m.getDeclaringClass();
// (declaring == clazz) is just an optimization - we're calling this only from code that operates on a
- // non-restriced class, so if the declaring class is identical to the class being inspected, then forego
+ // non-restricted class, so if the declaring class is identical to the class being inspected, then forego
// a potentially expensive restricted-package check.
return declaring == clazz || !CheckRestrictedPackage.isRestrictedClass(declaring);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/SingleDynamicMethod.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/beans/SingleDynamicMethod.java Thu Sep 17 09:19:40 2015 -0700
@@ -98,7 +98,6 @@
* target method to a call site type (including mapping variable arity methods to a call site signature with different
* arity).
* @author Attila Szegedi
- * @version $Id: $
*/
abstract class SingleDynamicMethod extends DynamicMethod {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedInvocation.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedInvocation.java Thu Sep 17 09:19:40 2015 -0700
@@ -353,7 +353,7 @@
/**
* Applies argument filters to both the invocation and the guard (if there is one).
- * @param pos the position of the first argumen being filtered
+ * @param pos the position of the first argument being filtered
* @param filters the argument filters
* @return a filtered invocation
*/
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedTypeConversion.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/internal/dynalink/linker/GuardedTypeConversion.java Thu Sep 17 09:19:40 2015 -0700
@@ -110,7 +110,7 @@
/**
* Check if invocation is cacheable
- * @return true if cachable, false otherwise
+ * @return true if cacheable, false otherwise
*/
public boolean isCacheable() {
return cacheable;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptUtils.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/ScriptUtils.java Thu Sep 17 09:19:40 2015 -0700
@@ -77,7 +77,7 @@
* @return a synchronizing wrapper function
*/
public static Object makeSynchronizedFunction(final ScriptFunction func, final Object sync) {
- return func.makeSynchronizedFunction(unwrap(sync));
+ return func.createSynchronized(unwrap(sync));
}
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/URLReader.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/scripting/URLReader.java Thu Sep 17 09:19:40 2015 -0700
@@ -103,7 +103,7 @@
/**
* Charset used by this reader
*
- * @return the Chartset used to convert bytes to chars
+ * @return the Charset used to convert bytes to chars
*/
public Charset getCharset() {
return cs;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/Parser.java Thu Sep 17 09:19:40 2015 -0700
@@ -80,7 +80,7 @@
public CompilationUnitTree parse(final URL url, final DiagnosticListener listener) throws IOException, NashornException;
/**
- * Parses the readerand returns compilation unit tree
+ * Parses the reader and returns compilation unit tree
*
* @param name name of the source file to parse
* @param reader from which source is read
@@ -133,7 +133,7 @@
* <dt>"-strict"</dt><dd>enable ECMAScript strict mode</dd>
* </dl>
*
- * @throws NullPointerException if options arrry or any of it's element is null
+ * @throws NullPointerException if options array or any of its element is null
* @throws IllegalArgumentException on unsupported option value.
* @return a new Parser instance.
*/
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/api/tree/RegExpLiteralTree.java Thu Sep 17 09:19:40 2015 -0700
@@ -35,7 +35,7 @@
/**
* Regular expression pattern to match.
*
- * @return regular expression patten
+ * @return regular expression pattern
*/
public String getPattern();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ApplySpecialization.java Thu Sep 17 09:19:40 2015 -0700
@@ -298,7 +298,28 @@
@Override
public boolean enterFunctionNode(final FunctionNode functionNode) {
- if (!USE_APPLY2CALL) {
+ // Cheap tests first
+ if (!(
+ // is the transform globally enabled?
+ USE_APPLY2CALL
+
+ // Are we compiling lazily? We can't known the number and types of the actual parameters at
+ // the caller when compiling eagerly, so this only works with on-demand compilation.
+ && compiler.isOnDemandCompilation()
+
+ // Does the function even reference the "arguments" identifier (without redefining it)? If not,
+ // it trivially can't have an expression of form "f.apply(self, arguments)" that this transform
+ // is targeting.
+ && functionNode.needsArguments()
+
+ // Does the function have eval? If so, it can arbitrarily modify arguments so we can't touch it.
+ && !functionNode.hasEval()
+
+ // Finally, does the function declare any parameters explicitly? We don't support that. It could
+ // be done, but has some complications. Therefore only a function with no explicit parameters
+ // is considered.
+ && functionNode.getNumOfParams() == 0))
+ {
return false;
}
@@ -308,18 +329,6 @@
return false;
}
- if (!compiler.isOnDemandCompilation()) {
- return false;
- }
-
- if (functionNode.getNumOfParams() != 0) {
- return false;
- }
-
- if (functionNode.hasEval()) {
- return false;
- }
-
if (!hasApplies(functionNode)) {
return false;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/AssignSymbols.java Thu Sep 17 09:19:40 2015 -0700
@@ -244,7 +244,7 @@
/**
* Creates a synthetic initializer for a variable (a var statement that doesn't occur in the source code). Typically
- * used to create assignmnent of {@code :callee} to the function name symbol in self-referential function
+ * used to create assignment of {@code :callee} to the function name symbol in self-referential function
* expressions as well as for assignment of {@code :arguments} to {@code arguments}.
*
* @param name the ident node identifying the variable to initialize
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CodeGenerator.java Thu Sep 17 09:19:40 2015 -0700
@@ -132,7 +132,6 @@
import jdk.nashorn.internal.ir.visitor.NodeOperatorVisitor;
import jdk.nashorn.internal.ir.visitor.NodeVisitor;
import jdk.nashorn.internal.objects.Global;
-import jdk.nashorn.internal.objects.ScriptFunctionImpl;
import jdk.nashorn.internal.parser.Lexer.RegexToken;
import jdk.nashorn.internal.parser.TokenType;
import jdk.nashorn.internal.runtime.Context;
@@ -195,9 +194,9 @@
private static final Call ENSURE_NUMBER = CompilerConstants.staticCallNoLookup(OptimisticReturnFilters.class,
"ensureNumber", double.class, Object.class, int.class);
- private static final Call CREATE_FUNCTION_OBJECT = CompilerConstants.staticCallNoLookup(ScriptFunctionImpl.class,
+ private static final Call CREATE_FUNCTION_OBJECT = CompilerConstants.staticCallNoLookup(ScriptFunction.class,
"create", ScriptFunction.class, Object[].class, int.class, ScriptObject.class);
- private static final Call CREATE_FUNCTION_OBJECT_NO_SCOPE = CompilerConstants.staticCallNoLookup(ScriptFunctionImpl.class,
+ private static final Call CREATE_FUNCTION_OBJECT_NO_SCOPE = CompilerConstants.staticCallNoLookup(ScriptFunction.class,
"create", ScriptFunction.class, Object[].class, int.class);
private static final Call TO_NUMBER_FOR_EQ = CompilerConstants.staticCallNoLookup(JSType.class,
@@ -1495,7 +1494,7 @@
int argsCount;
@Override
void loadStack() {
- /**
+ /*
* We want to load 'eval' to check if it is indeed global builtin eval.
* If this eval call is inside a 'with' statement, dyn:getMethod|getProp|getElem
* would be generated if ident is a "isFunction". But, that would result in a
@@ -4330,7 +4329,7 @@
}
private void prologue() {
- /**
+ /*
* This loads the parts of the target, e.g base and index. they are kept
* on the stack throughout the store and used at the end to execute it
*/
@@ -4798,7 +4797,7 @@
* conversion has no side effects.
* @param name the name of the property being get
* @param flags call site flags
- * @param isMethod whether we're preferrably retrieving a function
+ * @param isMethod whether we're preferably retrieving a function
* @return the current method emitter
*/
MethodEmitter dynamicGet(final String name, final int flags, final boolean isMethod, final boolean isIndex) {
@@ -5230,7 +5229,7 @@
private Type returnValueType;
// If we are in the middle of an object literal initialization, we need to update the map
private PropertyMap objectLiteralMap;
- // Object literal stack depth for object literal - not necessarly top if property is a tree
+ // Object literal stack depth for object literal - not necessarily top if property is a tree
private int objectLiteralStackDepth = -1;
// The line number at the continuation point
private int lineNumber;
@@ -5395,7 +5394,7 @@
method.load(lvarTypes.get(slot), slot);
method.convert(stackTypes[i]);
// stack: s0=object literal being initialized
- // change map of s0 so that the property we are initilizing when we failed
+ // change map of s0 so that the property we are initializing when we failed
// is now ci.returnValueType
if (i == objectLiteralStackDepth) {
method.dup();
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilationPhase.java Thu Sep 17 09:19:40 2015 -0700
@@ -591,8 +591,8 @@
Class<?> rootClass = null;
long length = 0L;
- final CodeInstaller<ScriptEnvironment> codeInstaller = compiler.getCodeInstaller();
- final Map<String, byte[]> bytecode = compiler.getBytecode();
+ final CodeInstaller codeInstaller = compiler.getCodeInstaller();
+ final Map<String, byte[]> bytecode = compiler.getBytecode();
for (final Entry<String, byte[]> entry : bytecode.entrySet()) {
final String className = entry.getKey();
@@ -745,7 +745,7 @@
abstract FunctionNode transform(final Compiler compiler, final CompilationPhases phases, final FunctionNode functionNode) throws CompilationException;
/**
- * Apply a transform to a function node, returning the transfored function node. If the transform is not
+ * Apply a transform to a function node, returning the transformed function node. If the transform is not
* applicable, an exception is thrown. Every transform requires the function to have a certain number of
* states to operate. It can have more states set, but not fewer. The state list, i.e. the constructor
* arguments to any of the CompilationPhase enum entries, is a set of REQUIRED states.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Compiler.java Thu Sep 17 09:19:40 2015 -0700
@@ -101,7 +101,7 @@
private final ConstantData constantData;
- private final CodeInstaller<ScriptEnvironment> installer;
+ private final CodeInstaller installer;
/** logger for compiler, trampolines and related code generation events
* that affect classes */
@@ -352,47 +352,83 @@
private static final AtomicInteger COMPILATION_ID = new AtomicInteger(0);
/**
- * Constructor
+ * Creates a new compiler instance for initial compilation of a script.
*
- * @param context context
- * @param env script environment
* @param installer code installer
* @param source source to compile
* @param errors error manager
* @param isStrict is this a strict compilation
+ * @return a new compiler
*/
- public Compiler(
- final Context context,
- final ScriptEnvironment env,
- final CodeInstaller<ScriptEnvironment> installer,
+ public static Compiler forInitialCompilation(
+ final CodeInstaller installer,
final Source source,
final ErrorManager errors,
final boolean isStrict) {
- this(context, env, installer, source, errors, isStrict, false, null, null, null, null, null, null);
+ return new Compiler(installer.getContext(), installer, source, errors, isStrict);
}
/**
- * Constructor
+ * Creates a compiler without a code installer. It can only be used to compile code, not install the
+ * generated classes and as such it is useful only for implementation of {@code --compile-only} command
+ * line option.
+ * @param context the current context
+ * @param source source to compile
+ * @param isStrict is this a strict compilation
+ * @return a new compiler
+ */
+ public static Compiler forNoInstallerCompilation(
+ final Context context,
+ final Source source,
+ final boolean isStrict) {
+ return new Compiler(context, null, source, context.getErrorManager(), isStrict);
+ }
+
+ /**
+ * Creates a compiler for an on-demand compilation job.
*
- * @param context context
- * @param env script environment
* @param installer code installer
* @param source source to compile
- * @param errors error manager
* @param isStrict is this a strict compilation
- * @param isOnDemand is this an on demand compilation
* @param compiledFunction compiled function, if any
* @param types parameter and return value type information, if any is known
* @param invalidatedProgramPoints invalidated program points for recompilation
* @param typeInformationFile descriptor of the location where type information is persisted
* @param continuationEntryPoints continuation entry points for restof method
* @param runtimeScope runtime scope for recompilation type lookup in {@code TypeEvaluator}
+ * @return a new compiler
*/
- @SuppressWarnings("unused")
- public Compiler(
+ public static Compiler forOnDemandCompilation(
+ final CodeInstaller installer,
+ final Source source,
+ final boolean isStrict,
+ final RecompilableScriptFunctionData compiledFunction,
+ final TypeMap types,
+ final Map<Integer, Type> invalidatedProgramPoints,
+ final Object typeInformationFile,
+ final int[] continuationEntryPoints,
+ final ScriptObject runtimeScope) {
+ final Context context = installer.getContext();
+ return new Compiler(context, installer, source, context.getErrorManager(), isStrict, true,
+ compiledFunction, types, invalidatedProgramPoints, typeInformationFile,
+ continuationEntryPoints, runtimeScope);
+ }
+
+ /**
+ * Convenience constructor for non on-demand compiler instances.
+ */
+ private Compiler(
final Context context,
- final ScriptEnvironment env,
- final CodeInstaller<ScriptEnvironment> installer,
+ final CodeInstaller installer,
+ final Source source,
+ final ErrorManager errors,
+ final boolean isStrict) {
+ this(context, installer, source, errors, isStrict, false, null, null, null, null, null, null);
+ }
+
+ private Compiler(
+ final Context context,
+ final CodeInstaller installer,
final Source source,
final ErrorManager errors,
final boolean isStrict,
@@ -404,7 +440,7 @@
final int[] continuationEntryPoints,
final ScriptObject runtimeScope) {
this.context = context;
- this.env = env;
+ this.env = context.getEnv();
this.installer = installer;
this.constantData = new ConstantData();
this.compileUnits = CompileUnit.createCompileUnitSet();
@@ -416,7 +452,7 @@
this.onDemand = isOnDemand;
this.compiledFunction = compiledFunction;
this.types = types;
- this.invalidatedProgramPoints = invalidatedProgramPoints == null ? new HashMap<Integer, Type>() : invalidatedProgramPoints;
+ this.invalidatedProgramPoints = invalidatedProgramPoints == null ? new HashMap<>() : invalidatedProgramPoints;
this.typeInformationFile = typeInformationFile;
this.continuationEntryPoints = continuationEntryPoints == null ? null: continuationEntryPoints.clone();
this.typeEvaluator = new TypeEvaluator(this, runtimeScope);
@@ -426,7 +462,7 @@
this.optimistic = env._optimistic_types;
}
- private static String safeSourceName(final ScriptEnvironment env, final CodeInstaller<ScriptEnvironment> installer, final Source source) {
+ private String safeSourceName() {
String baseName = new File(source.getName()).getName();
final int index = baseName.lastIndexOf(".js");
@@ -485,7 +521,7 @@
sb.append('$');
}
- sb.append(Compiler.safeSourceName(env, installer, source));
+ sb.append(safeSourceName());
return sb.toString();
}
@@ -684,7 +720,7 @@
return constantData;
}
- CodeInstaller<ScriptEnvironment> getCodeInstaller() {
+ CodeInstaller getCodeInstaller() {
return installer;
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/CompilerConstants.java Thu Sep 17 09:19:40 2015 -0700
@@ -192,7 +192,7 @@
private static Set<String> symbolNames;
/**
- * Prefix used for internal methods generated in script clases.
+ * Prefix used for internal methods generated in script classes.
*/
private static final String INTERNAL_METHOD_PREFIX = ":";
@@ -225,7 +225,7 @@
}
/**
- * Check whether a name is that of a reserved compiler constnat
+ * Check whether a name is that of a reserved compiler constant
* @param name name
* @return true if compiler constant name
*/
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Label.java Thu Sep 17 09:19:40 2015 -0700
@@ -447,7 +447,7 @@
undefineLocalVariables(liveLocalCount, true);
// Temporaries are promoted
firstTemp = liveLocalCount;
- // No trailing undefineds
+ // No trailing undefined values
localVariableTypes.subList(firstTemp, localVariableTypes.size()).clear();
assert symbolBoundary.length() == firstTemp;
// Generalize all reference types to Object, and promote boolean to int
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/Lower.java Thu Sep 17 09:19:40 2015 -0700
@@ -521,7 +521,7 @@
}
/*
- * create a new trynode
+ * create a new try node
* if we have catches:
*
* try try
@@ -532,7 +532,7 @@
* catchall
* rethrow
*
- * otheriwse
+ * otherwise
*
* try try
* x x
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/MethodEmitter.java Thu Sep 17 09:19:40 2015 -0700
@@ -1158,7 +1158,7 @@
/**
* Pop a value from the stack and store it in a variable denoted by the given symbol. The variable should be either
* a local variable, or a function parameter (and not a scoped variable). For local variables, this method will also
- * do the bookeeping of the local variable table as well as mark values in all alternative slots for the symbol as
+ * do the bookkeeping of the local variable table as well as mark values in all alternative slots for the symbol as
* dead. In this regard it differs from {@link #storeHidden(Type, int)}.
*
* @param symbol the symbol to store into.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/ObjectClassGenerator.java Thu Sep 17 09:19:40 2015 -0700
@@ -786,7 +786,7 @@
* @param primitiveSetter primitive setter for the current type with an element of the current type
* @param objectSetter the object setter
*
- * @return method handle that checks if the element to be set is of the currenttype, even though it's boxed
+ * @return method handle that checks if the element to be set is of the current type, even though it's boxed
* and instead of using the generic object setter, that would blow up the type and invalidate the map,
* unbox it and call the primitive setter instead
*/
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BytecodeOps.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/codegen/types/BytecodeOps.java Thu Sep 17 09:19:40 2015 -0700
@@ -36,7 +36,7 @@
* The bytecode ops are coupled to a MethodVisitor from ASM for
* byte code generation. They know nothing about our MethodGenerator,
* which is the abstraction for working with Nashorn JS types
- * For exmaple, anything like "two or one slots" for a type, which
+ * For example, anything like "two or one slots" for a type, which
* is represented in bytecode and ASM, is abstracted away in the
* MethodGenerator. There you just say "dup" or "store".
*
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockLexicalContext.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/BlockLexicalContext.java Thu Sep 17 09:19:40 2015 -0700
@@ -34,7 +34,7 @@
* This is a subclass of lexical context used for filling
* blocks (and function nodes) with statements. When popping
* a block from the lexical context, any statements that have
- * been generated in it are commited to the block. This saves
+ * been generated in it are committed to the block. This saves
* unnecessary object mutations and lexical context replacement
*/
public class BlockLexicalContext extends LexicalContext {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/LiteralNode.java Thu Sep 17 09:19:40 2015 -0700
@@ -452,7 +452,7 @@
*
* @param token token
* @param finish finish
- * @param value undefined value, passed only for polymorphisism discrimination
+ * @param value undefined value, passed only for polymorphism discrimination
*
* @return the new literal node
*/
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/RuntimeNode.java Thu Sep 17 09:19:40 2015 -0700
@@ -276,7 +276,7 @@
*
* @param request a request
*
- * @return the inverted rquest, or null if not applicable
+ * @return the inverted request, or null if not applicable
*/
public static Request invert(final Request request) {
switch (request) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/NashornClassReader.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/NashornClassReader.java Thu Sep 17 09:19:40 2015 -0700
@@ -36,7 +36,7 @@
import jdk.nashorn.internal.ir.debug.NashornTextifier.NashornLabel;
/**
- * Subclass of the ASM classs reader that retains more info, such
+ * Subclass of the ASM class reader that retains more info, such
* as bytecode offsets
*/
public class NashornClassReader extends ClassReader {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/ir/debug/ObjectSizeCalculator.java Thu Sep 17 09:19:40 2015 -0700
@@ -193,7 +193,7 @@
}
/**
- * Get the class histograpm
+ * Get the class histogram
* @return class histogram element list
*/
public List<ClassHistogramElement> getClassHistogram() {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ArrayBufferView.java Thu Sep 17 09:19:40 2015 -0700
@@ -192,7 +192,7 @@
/**
* Factory method for array data
*
- * @param nb underlying nativebuffer
+ * @param nb underlying native buffer
* @param start start element
* @param end end element
*
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/BoundScriptFunctionImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,51 +0,0 @@
-/*
- * Copyright (c) 2010, 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 jdk.nashorn.internal.objects;
-
-import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.ScriptFunctionData;
-import jdk.nashorn.internal.runtime.ScriptObject;
-import jdk.nashorn.internal.runtime.ScriptRuntime;
-
-/**
- * A {@code ScriptFunctionImpl} subclass for functions created using {@code Function.prototype.bind}. Such functions
- * must track their {@code [[TargetFunction]]} property for purposes of correctly implementing {@code [[HasInstance]]};
- * see {@link ScriptFunction#isInstance(ScriptObject)}.
- */
-final class BoundScriptFunctionImpl extends ScriptFunctionImpl {
- private final ScriptFunction targetFunction;
-
- BoundScriptFunctionImpl(final ScriptFunctionData data, final ScriptFunction targetFunction) {
- super(data, Global.instance());
- setPrototype(ScriptRuntime.UNDEFINED);
- this.targetFunction = targetFunction;
- }
-
- @Override
- protected ScriptFunction getTargetFunction() {
- return targetFunction;
- }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Thu Sep 17 09:19:40 2015 -0700
@@ -1583,7 +1583,11 @@
return ScriptFunction.getPrototype(builtinObject);
}
- ScriptObject getFunctionPrototype() {
+ /**
+ * Get the builtin Function prototype.
+ * @return the Function.prototype.
+ */
+ public ScriptObject getFunctionPrototype() {
return ScriptFunction.getPrototype(builtinFunction);
}
@@ -1768,7 +1772,12 @@
return ScriptFunction.getPrototype(getBuiltinFloat64Array());
}
- ScriptFunction getTypeErrorThrower() {
+ /**
+ * Return the function that throws TypeError unconditionally. Used as "poison" methods for certain Function properties.
+ *
+ * @return the TypeError throwing function
+ */
+ public ScriptFunction getTypeErrorThrower() {
return typeErrorThrower;
}
@@ -2157,7 +2166,7 @@
// We want to avoid adding our generic lexical scope switchpoint to global constant invocations,
// because those are invalidated per-key in the addBoundProperties method above.
- // We therefor check if the invocation does already have a switchpoint and the property is non-inherited,
+ // We therefore check if the invocation does already have a switchpoint and the property is non-inherited,
// assuming this only applies to global constants. If other non-inherited properties will
// start using switchpoints some time in the future we'll have to revisit this.
if (isScope && context.getEnv()._es6 && (invocation.getSwitchPoints() == null || !hasOwnProperty(name))) {
@@ -2202,10 +2211,10 @@
* Adds jjs shell interactive mode builtin functions to global scope.
*/
public void addShellBuiltins() {
- Object value = ScriptFunctionImpl.makeFunction("input", ShellFunctions.INPUT);
+ Object value = ScriptFunction.createBuiltin("input", ShellFunctions.INPUT);
addOwnProperty("input", Attribute.NOT_ENUMERABLE, value);
- value = ScriptFunctionImpl.makeFunction("evalinput", ShellFunctions.EVALINPUT);
+ value = ScriptFunction.createBuiltin("evalinput", ShellFunctions.EVALINPUT);
addOwnProperty("evalinput", Attribute.NOT_ENUMERABLE, value);
}
@@ -2251,35 +2260,35 @@
this.setInitialProto(getObjectPrototype());
// initialize global function properties
- this.eval = this.builtinEval = ScriptFunctionImpl.makeFunction("eval", EVAL);
-
- this.parseInt = ScriptFunctionImpl.makeFunction("parseInt", GlobalFunctions.PARSEINT,
+ this.eval = this.builtinEval = ScriptFunction.createBuiltin("eval", EVAL);
+
+ this.parseInt = ScriptFunction.createBuiltin("parseInt", GlobalFunctions.PARSEINT,
new Specialization[] {
new Specialization(GlobalFunctions.PARSEINT_Z),
new Specialization(GlobalFunctions.PARSEINT_I),
new Specialization(GlobalFunctions.PARSEINT_J),
new Specialization(GlobalFunctions.PARSEINT_OI),
new Specialization(GlobalFunctions.PARSEINT_O) });
- this.parseFloat = ScriptFunctionImpl.makeFunction("parseFloat", GlobalFunctions.PARSEFLOAT);
- this.isNaN = ScriptFunctionImpl.makeFunction("isNaN", GlobalFunctions.IS_NAN,
+ this.parseFloat = ScriptFunction.createBuiltin("parseFloat", GlobalFunctions.PARSEFLOAT);
+ this.isNaN = ScriptFunction.createBuiltin("isNaN", GlobalFunctions.IS_NAN,
new Specialization[] {
new Specialization(GlobalFunctions.IS_NAN_I),
new Specialization(GlobalFunctions.IS_NAN_J),
new Specialization(GlobalFunctions.IS_NAN_D) });
- this.parseFloat = ScriptFunctionImpl.makeFunction("parseFloat", GlobalFunctions.PARSEFLOAT);
- this.isNaN = ScriptFunctionImpl.makeFunction("isNaN", GlobalFunctions.IS_NAN);
- this.isFinite = ScriptFunctionImpl.makeFunction("isFinite", GlobalFunctions.IS_FINITE);
- this.encodeURI = ScriptFunctionImpl.makeFunction("encodeURI", GlobalFunctions.ENCODE_URI);
- this.encodeURIComponent = ScriptFunctionImpl.makeFunction("encodeURIComponent", GlobalFunctions.ENCODE_URICOMPONENT);
- this.decodeURI = ScriptFunctionImpl.makeFunction("decodeURI", GlobalFunctions.DECODE_URI);
- this.decodeURIComponent = ScriptFunctionImpl.makeFunction("decodeURIComponent", GlobalFunctions.DECODE_URICOMPONENT);
- this.escape = ScriptFunctionImpl.makeFunction("escape", GlobalFunctions.ESCAPE);
- this.unescape = ScriptFunctionImpl.makeFunction("unescape", GlobalFunctions.UNESCAPE);
- this.print = ScriptFunctionImpl.makeFunction("print", env._print_no_newline ? PRINT : PRINTLN);
- this.load = ScriptFunctionImpl.makeFunction("load", LOAD);
- this.loadWithNewGlobal = ScriptFunctionImpl.makeFunction("loadWithNewGlobal", LOAD_WITH_NEW_GLOBAL);
- this.exit = ScriptFunctionImpl.makeFunction("exit", EXIT);
- this.quit = ScriptFunctionImpl.makeFunction("quit", EXIT);
+ this.parseFloat = ScriptFunction.createBuiltin("parseFloat", GlobalFunctions.PARSEFLOAT);
+ this.isNaN = ScriptFunction.createBuiltin("isNaN", GlobalFunctions.IS_NAN);
+ this.isFinite = ScriptFunction.createBuiltin("isFinite", GlobalFunctions.IS_FINITE);
+ this.encodeURI = ScriptFunction.createBuiltin("encodeURI", GlobalFunctions.ENCODE_URI);
+ this.encodeURIComponent = ScriptFunction.createBuiltin("encodeURIComponent", GlobalFunctions.ENCODE_URICOMPONENT);
+ this.decodeURI = ScriptFunction.createBuiltin("decodeURI", GlobalFunctions.DECODE_URI);
+ this.decodeURIComponent = ScriptFunction.createBuiltin("decodeURIComponent", GlobalFunctions.DECODE_URICOMPONENT);
+ this.escape = ScriptFunction.createBuiltin("escape", GlobalFunctions.ESCAPE);
+ this.unescape = ScriptFunction.createBuiltin("unescape", GlobalFunctions.UNESCAPE);
+ this.print = ScriptFunction.createBuiltin("print", env._print_no_newline ? PRINT : PRINTLN);
+ this.load = ScriptFunction.createBuiltin("load", LOAD);
+ this.loadWithNewGlobal = ScriptFunction.createBuiltin("loadWithNewGlobal", LOAD_WITH_NEW_GLOBAL);
+ this.exit = ScriptFunction.createBuiltin("exit", EXIT);
+ this.quit = ScriptFunction.createBuiltin("quit", EXIT);
// built-in constructors
this.builtinArray = initConstructorAndSwitchPoint("Array", ScriptFunction.class);
@@ -2359,7 +2368,7 @@
// default file name
addOwnProperty(ScriptEngine.FILENAME, Attribute.NOT_ENUMERABLE, null);
// __noSuchProperty__ hook for ScriptContext search of missing variables
- final ScriptFunction noSuchProp = ScriptFunctionImpl.makeStrictFunction(NO_SUCH_PROPERTY_NAME, NO_SUCH_PROPERTY);
+ final ScriptFunction noSuchProp = ScriptFunction.createStrictBuiltin(NO_SUCH_PROPERTY_NAME, NO_SUCH_PROPERTY);
addOwnProperty(NO_SUCH_PROPERTY_NAME, Attribute.NOT_ENUMERABLE, noSuchProp);
}
}
@@ -2370,17 +2379,17 @@
final ScriptObject errorProto = getErrorPrototype();
// Nashorn specific accessors on Error.prototype - stack, lineNumber, columnNumber and fileName
- final ScriptFunction getStack = ScriptFunctionImpl.makeFunction("getStack", NativeError.GET_STACK);
- final ScriptFunction setStack = ScriptFunctionImpl.makeFunction("setStack", NativeError.SET_STACK);
+ final ScriptFunction getStack = ScriptFunction.createBuiltin("getStack", NativeError.GET_STACK);
+ final ScriptFunction setStack = ScriptFunction.createBuiltin("setStack", NativeError.SET_STACK);
errorProto.addOwnProperty("stack", Attribute.NOT_ENUMERABLE, getStack, setStack);
- final ScriptFunction getLineNumber = ScriptFunctionImpl.makeFunction("getLineNumber", NativeError.GET_LINENUMBER);
- final ScriptFunction setLineNumber = ScriptFunctionImpl.makeFunction("setLineNumber", NativeError.SET_LINENUMBER);
+ final ScriptFunction getLineNumber = ScriptFunction.createBuiltin("getLineNumber", NativeError.GET_LINENUMBER);
+ final ScriptFunction setLineNumber = ScriptFunction.createBuiltin("setLineNumber", NativeError.SET_LINENUMBER);
errorProto.addOwnProperty("lineNumber", Attribute.NOT_ENUMERABLE, getLineNumber, setLineNumber);
- final ScriptFunction getColumnNumber = ScriptFunctionImpl.makeFunction("getColumnNumber", NativeError.GET_COLUMNNUMBER);
- final ScriptFunction setColumnNumber = ScriptFunctionImpl.makeFunction("setColumnNumber", NativeError.SET_COLUMNNUMBER);
+ final ScriptFunction getColumnNumber = ScriptFunction.createBuiltin("getColumnNumber", NativeError.GET_COLUMNNUMBER);
+ final ScriptFunction setColumnNumber = ScriptFunction.createBuiltin("setColumnNumber", NativeError.SET_COLUMNNUMBER);
errorProto.addOwnProperty("columnNumber", Attribute.NOT_ENUMERABLE, getColumnNumber, setColumnNumber);
- final ScriptFunction getFileName = ScriptFunctionImpl.makeFunction("getFileName", NativeError.GET_FILENAME);
- final ScriptFunction setFileName = ScriptFunctionImpl.makeFunction("setFileName", NativeError.SET_FILENAME);
+ final ScriptFunction getFileName = ScriptFunction.createBuiltin("getFileName", NativeError.GET_FILENAME);
+ final ScriptFunction setFileName = ScriptFunction.createBuiltin("setFileName", NativeError.SET_FILENAME);
errorProto.addOwnProperty("fileName", Attribute.NOT_ENUMERABLE, getFileName, setFileName);
// ECMA 15.11.4.2 Error.prototype.name
@@ -2420,14 +2429,14 @@
private void initScripting(final ScriptEnvironment scriptEnv) {
ScriptObject value;
- value = ScriptFunctionImpl.makeFunction("readLine", ScriptingFunctions.READLINE);
+ value = ScriptFunction.createBuiltin("readLine", ScriptingFunctions.READLINE);
addOwnProperty("readLine", Attribute.NOT_ENUMERABLE, value);
- value = ScriptFunctionImpl.makeFunction("readFully", ScriptingFunctions.READFULLY);
+ value = ScriptFunction.createBuiltin("readFully", ScriptingFunctions.READFULLY);
addOwnProperty("readFully", Attribute.NOT_ENUMERABLE, value);
final String execName = ScriptingFunctions.EXEC_NAME;
- value = ScriptFunctionImpl.makeFunction(execName, ScriptingFunctions.EXEC);
+ value = ScriptFunction.createBuiltin(execName, ScriptingFunctions.EXEC);
value.addOwnProperty(ScriptingFunctions.THROW_ON_ERROR_NAME, Attribute.NOT_ENUMERABLE, false);
addOwnProperty(execName, Attribute.NOT_ENUMERABLE, value);
@@ -2610,7 +2619,7 @@
this.builtinFunction = initConstructor("Function", ScriptFunction.class);
// create global anonymous function
- final ScriptFunction anon = ScriptFunctionImpl.newAnonymousFunction();
+ final ScriptFunction anon = ScriptFunction.createAnonymous();
// need to copy over members of Function.prototype to anon function
anon.addBoundProperties(getFunctionPrototype());
@@ -2622,10 +2631,7 @@
anon.deleteOwnProperty(anon.getMap().findProperty("prototype"));
// use "getter" so that [[ThrowTypeError]] function's arity is 0 - as specified in step 10 of section 13.2.3
- this.typeErrorThrower = new ScriptFunctionImpl("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_GETTER, null, null, 0);
- typeErrorThrower.setPrototype(UNDEFINED);
- // Non-constructor built-in functions do not have "prototype" property
- typeErrorThrower.deleteOwnProperty(typeErrorThrower.getMap().findProperty("prototype"));
+ this.typeErrorThrower = ScriptFunction.createBuiltin("TypeErrorThrower", Lookup.TYPE_ERROR_THROWER_GETTER);
typeErrorThrower.preventExtensions();
// now initialize Object
@@ -2636,8 +2642,8 @@
// ES6 draft compliant __proto__ property of Object.prototype
// accessors on Object.prototype for "__proto__"
- final ScriptFunction getProto = ScriptFunctionImpl.makeFunction("getProto", NativeObject.GET__PROTO__);
- final ScriptFunction setProto = ScriptFunctionImpl.makeFunction("setProto", NativeObject.SET__PROTO__);
+ final ScriptFunction getProto = ScriptFunction.createBuiltin("getProto", NativeObject.GET__PROTO__);
+ final ScriptFunction setProto = ScriptFunction.createBuiltin("setProto", NativeObject.SET__PROTO__);
ObjectPrototype.addOwnProperty("__proto__", Attribute.NOT_ENUMERABLE, getProto, setProto);
// Function valued properties of Function.prototype were not properly
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeDebug.java Thu Sep 17 09:19:40 2015 -0700
@@ -26,6 +26,7 @@
package jdk.nashorn.internal.objects;
import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+
import java.io.PrintWriter;
import java.util.LinkedList;
import java.util.Objects;
@@ -246,7 +247,7 @@
final PrintWriter out = Context.getCurrentErr();
out.println("ScriptObject count " + ScriptObject.getCount());
- out.println("Scope count " + Scope.getCount());
+ out.println("Scope count " + Scope.getScopeCount());
out.println("ScriptObject listeners added " + PropertyListeners.getListenersAdded());
out.println("ScriptObject listeners removed " + PropertyListeners.getListenersRemoved());
out.println("ScriptFunction constructor calls " + ScriptFunction.getConstructorCount());
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeError.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeError.java Thu Sep 17 09:19:40 2015 -0700
@@ -148,8 +148,8 @@
initException(sobj);
sobj.delete(STACK, false);
if (! sobj.has("stack")) {
- final ScriptFunction getStack = ScriptFunctionImpl.makeFunction("getStack", GET_STACK);
- final ScriptFunction setStack = ScriptFunctionImpl.makeFunction("setStack", SET_STACK);
+ final ScriptFunction getStack = ScriptFunction.createBuiltin("getStack", GET_STACK);
+ final ScriptFunction setStack = ScriptFunction.createBuiltin("setStack", SET_STACK);
sobj.addOwnProperty("stack", Attribute.NOT_ENUMERABLE, getStack, setStack);
}
return UNDEFINED;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJSAdapter.java Thu Sep 17 09:19:40 2015 -0700
@@ -621,11 +621,11 @@
if (find != null) {
final Object value = find.getObjectValue();
if (value instanceof ScriptFunction) {
- final ScriptFunctionImpl func = (ScriptFunctionImpl)value;
+ final ScriptFunction func = (ScriptFunction)value;
// TODO: It's a shame we need to produce a function bound to this and name, when we'd only need it bound
// to name. Probably not a big deal, but if we can ever make it leaner, it'd be nice.
return new GuardedInvocation(MH.dropArguments(MH.constant(Object.class,
- func.makeBoundFunction(this, new Object[] { name })), 0, Object.class),
+ func.createBound(this, new Object[] { name })), 0, Object.class),
testJSAdaptor(adaptee, null, null, null),
adaptee.getProtoSwitchPoint(__call__, find.getOwner()));
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeJava.java Thu Sep 17 09:19:40 2015 -0700
@@ -96,7 +96,7 @@
@Function(name="synchronized", attributes = Attribute.NOT_ENUMERABLE, where = Where.CONSTRUCTOR)
public static Object synchronizedFunc(final Object self, final Object func, final Object obj) {
if (func instanceof ScriptFunction) {
- return ((ScriptFunction)func).makeSynchronizedFunction(obj);
+ return ((ScriptFunction)func).createSynchronized(obj);
}
throw typeError("not.a.function", ScriptRuntime.safeToString(func));
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeNumber.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeNumber.java Thu Sep 17 09:19:40 2015 -0700
@@ -33,6 +33,7 @@
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
import java.lang.invoke.MethodType;
+import java.math.RoundingMode;
import java.text.NumberFormat;
import java.util.Locale;
import jdk.internal.dynalink.linker.GuardedInvocation;
@@ -187,6 +188,7 @@
format.setMinimumFractionDigits(fractionDigits);
format.setMaximumFractionDigits(fractionDigits);
format.setGroupingUsed(false);
+ format.setRoundingMode(RoundingMode.HALF_UP);
return format.format(x);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/NativeRegExp.java Thu Sep 17 09:19:40 2015 -0700
@@ -728,7 +728,7 @@
*
* $$ -> $
* $& -> the matched substring
- * $` -> the portion of string that preceeds matched substring
+ * $` -> the portion of string that precedes matched substring
* $' -> the portion of string that follows the matched substring
* $n -> the nth capture, where n is [1-9] and $n is NOT followed by a decimal digit
* $nn -> the nnth capture, where nn is a two digit decimal number [01-99].
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/PrototypeObject.java Tue Sep 15 15:49:30 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,115 +0,0 @@
-/*
- * Copyright (c) 2010, 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 jdk.nashorn.internal.objects;
-
-import static jdk.nashorn.internal.lookup.Lookup.MH;
-import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-
-import java.lang.invoke.MethodHandle;
-import java.lang.invoke.MethodHandles;
-import java.util.ArrayList;
-import jdk.nashorn.internal.runtime.AccessorProperty;
-import jdk.nashorn.internal.runtime.Property;
-import jdk.nashorn.internal.runtime.PropertyMap;
-import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.ScriptObject;
-
-/**
- * Instances of this class serve as "prototype" object for script functions.
- * The purpose is to expose "constructor" property from "prototype". Also, nasgen
- * generated prototype classes extend from this class.
- *
- */
-public class PrototypeObject extends ScriptObject {
- private static final PropertyMap map$;
-
- private Object constructor;
-
- private static final MethodHandle GET_CONSTRUCTOR = findOwnMH("getConstructor", Object.class, Object.class);
- private static final MethodHandle SET_CONSTRUCTOR = findOwnMH("setConstructor", void.class, Object.class, Object.class);
-
- static {
- final ArrayList<Property> properties = new ArrayList<>(1);
- properties.add(AccessorProperty.create("constructor", Property.NOT_ENUMERABLE, GET_CONSTRUCTOR, SET_CONSTRUCTOR));
- map$ = PropertyMap.newMap(properties);
- }
-
- private PrototypeObject(final Global global, final PropertyMap map) {
- super(global.getObjectPrototype(), map != map$? map.addAll(map$) : map$);
- }
-
- PrototypeObject() {
- this(Global.instance(), map$);
- }
-
- /**
- * PropertyObject constructor
- *
- * @param map property map
- */
- PrototypeObject(final PropertyMap map) {
- this(Global.instance(), map);
- }
-
- PrototypeObject(final ScriptFunction func) {
- this(Global.instance(), map$);
- this.constructor = func;
- }
-
- /**
- * Get the constructor for this {@code PrototypeObject}
- * @param self self reference
- * @return constructor, probably, but not necessarily, a {@link ScriptFunction}
- */
- static Object getConstructor(final Object self) {
- return (self instanceof PrototypeObject) ?
- ((PrototypeObject)self).getConstructor() :
- UNDEFINED;
- }
-
- /**
- * Reset the constructor for this {@code PrototypeObject}
- * @param self self reference
- * @param constructor constructor, probably, but not necessarily, a {@link ScriptFunction}
- */
- static void setConstructor(final Object self, final Object constructor) {
- if (self instanceof PrototypeObject) {
- ((PrototypeObject)self).setConstructor(constructor);
- }
- }
-
- private Object getConstructor() {
- return constructor;
- }
-
- private void setConstructor(final Object constructor) {
- this.constructor = constructor;
- }
-
- private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
- return MH.findStatic(MethodHandles.lookup(), PrototypeObject.class, name, MH.type(rtype, types));
- }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/ScriptFunctionImpl.java Tue Sep 15 15:49:30 2015 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,313 +0,0 @@
-/*
- * Copyright (c) 2010, 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 jdk.nashorn.internal.objects;
-
-import static jdk.nashorn.internal.lookup.Lookup.MH;
-import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
-
-import java.lang.invoke.MethodHandle;
-import java.util.ArrayList;
-import jdk.nashorn.internal.runtime.AccessorProperty;
-import jdk.nashorn.internal.runtime.GlobalFunctions;
-import jdk.nashorn.internal.runtime.Property;
-import jdk.nashorn.internal.runtime.PropertyMap;
-import jdk.nashorn.internal.runtime.RecompilableScriptFunctionData;
-import jdk.nashorn.internal.runtime.ScriptFunction;
-import jdk.nashorn.internal.runtime.ScriptFunctionData;
-import jdk.nashorn.internal.runtime.ScriptObject;
-import jdk.nashorn.internal.runtime.Specialization;
-
-/**
- * Concrete implementation of ScriptFunction. This sets correct map for the
- * function objects -- to expose properties like "prototype", "length" etc.
- */
-public class ScriptFunctionImpl extends ScriptFunction {
-
- /** Reference to constructor prototype. */
- private Object prototype;
-
- // property map for strict mode functions
- private static final PropertyMap strictmodemap$;
- // property map for bound functions
- private static final PropertyMap boundfunctionmap$;
- // property map for non-strict, non-bound functions.
- private static final PropertyMap map$;
-
- // Marker object for lazily initialized prototype object
- private static final Object LAZY_PROTOTYPE = new Object();
-
- private ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final Specialization[] specs, final Global global) {
- super(name, invokeHandle, map$, null, specs, ScriptFunctionData.IS_BUILTIN_CONSTRUCTOR);
- init(global);
- }
-
- /**
- * Constructor called by Nasgen generated code, no membercount, use the default map.
- * Creates builtin functions only.
- *
- * @param name name of function
- * @param invokeHandle handle for invocation
- * @param specs specialized versions of this method, if available, null otherwise
- */
- ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final Specialization[] specs) {
- this(name, invokeHandle, specs, Global.instance());
- }
-
- private ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final Specialization[] specs, final Global global) {
- super(name, invokeHandle, map.addAll(map$), null, specs, ScriptFunctionData.IS_BUILTIN_CONSTRUCTOR);
- init(global);
- }
-
- /**
- * Constructor called by Nasgen generated code, no membercount, use the map passed as argument.
- * Creates builtin functions only.
- *
- * @param name name of function
- * @param invokeHandle handle for invocation
- * @param map initial property map
- * @param specs specialized versions of this method, if available, null otherwise
- */
- ScriptFunctionImpl(final String name, final MethodHandle invokeHandle, final PropertyMap map, final Specialization[] specs) {
- this(name, invokeHandle, map, specs, Global.instance());
- }
-
- private ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final Specialization[] specs, final int flags, final Global global) {
- super(name, methodHandle, getMap(isStrict(flags)), scope, specs, flags);
- init(global);
- }
-
- /**
- * Constructor called by Global.newScriptFunction (runtime).
- *
- * @param name name of function
- * @param methodHandle handle for invocation
- * @param scope scope object
- * @param specs specialized versions of this method, if available, null otherwise
- * @param flags {@link ScriptFunctionData} flags
- */
- ScriptFunctionImpl(final String name, final MethodHandle methodHandle, final ScriptObject scope, final Specialization[] specs, final int flags) {
- this(name, methodHandle, scope, specs, flags, Global.instance());
- }
-
- private ScriptFunctionImpl(final RecompilableScriptFunctionData data, final ScriptObject scope, final Global global) {
- super(data, getMap(data.isStrict()), scope);
- init(global);
- }
-
- /**
- * Factory method called by compiler generated code for functions that need parent scope.
- *
- * @param constants the generated class' constant array
- * @param index the index of the {@code RecompilableScriptFunctionData} object in the constants array.
- * @param scope the parent scope object
- * @return a newly created function object
- */
- public static ScriptFunction create(final Object[] constants, final int index, final ScriptObject scope) {
- return new ScriptFunctionImpl((RecompilableScriptFunctionData)constants[index], scope, Global.instance());
- }
-
- /**
- * Factory method called by compiler generated code for functions that don't need parent scope.
- *
- * @param constants the generated class' constant array
- * @param index the index of the {@code RecompilableScriptFunctionData} object in the constants array.
- * @return a newly created function object
- */
- public static ScriptFunction create(final Object[] constants, final int index) {
- return create(constants, index, null);
- }
-
- /**
- * Only invoked internally from {@link BoundScriptFunctionImpl} constructor.
- * @param data the script function data for the bound function.
- * @param global the global object
- */
- ScriptFunctionImpl(final ScriptFunctionData data, final Global global) {
- super(data, boundfunctionmap$, null);
- init(global);
- }
-
- static {
- final ArrayList<Property> properties = new ArrayList<>(3);
- properties.add(AccessorProperty.create("prototype", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, G$PROTOTYPE, S$PROTOTYPE));
- properties.add(AccessorProperty.create("length", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$LENGTH, null));
- properties.add(AccessorProperty.create("name", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$NAME, null));
- map$ = PropertyMap.newMap(properties);
- strictmodemap$ = createStrictModeMap(map$);
- boundfunctionmap$ = createBoundFunctionMap(strictmodemap$);
- }
-
- private static PropertyMap createStrictModeMap(final PropertyMap map) {
- final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
- PropertyMap newMap = map;
- // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
- newMap = newMap.addPropertyNoHistory(map.newUserAccessors("arguments", flags));
- newMap = newMap.addPropertyNoHistory(map.newUserAccessors("caller", flags));
- return newMap;
- }
-
- private static boolean isStrict(final int flags) {
- return (flags & ScriptFunctionData.IS_STRICT) != 0;
- }
-
- // Choose the map based on strict mode!
- private static PropertyMap getMap(final boolean strict) {
- return strict ? strictmodemap$ : map$;
- }
-
- private static PropertyMap createBoundFunctionMap(final PropertyMap strictModeMap) {
- // Bound function map is same as strict function map, but additionally lacks the "prototype" property, see
- // ECMAScript 5.1 section 15.3.4.5
- return strictModeMap.deleteProperty(strictModeMap.findProperty("prototype"));
- }
-
- // Instance of this class is used as global anonymous function which
- // serves as Function.prototype object.
- private static class AnonymousFunction extends ScriptFunctionImpl {
- private static final PropertyMap anonmap$ = PropertyMap.newMap();
-
- AnonymousFunction() {
- super("", GlobalFunctions.ANONYMOUS, anonmap$, null);
- }
- }
-
- static ScriptFunctionImpl newAnonymousFunction() {
- return new AnonymousFunction();
- }
-
- private static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final Specialization[] specs, final int flags) {
- final ScriptFunctionImpl func = new ScriptFunctionImpl(name, methodHandle, null, specs, flags);
- func.setPrototype(UNDEFINED);
- // Non-constructor built-in functions do not have "prototype" property
- func.deleteOwnProperty(func.getMap().findProperty("prototype"));
-
- return func;
- }
-
- /**
- * Factory method for non-constructor built-in functions
- *
- * @param name function name
- * @param methodHandle handle for invocation
- * @param specs specialized versions of function if available, null otherwise
- * @return new ScriptFunction
- */
- static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle, final Specialization[] specs) {
- return makeFunction(name, methodHandle, specs, ScriptFunctionData.IS_BUILTIN);
- }
-
- /**
- * Factory method for non-constructor built-in, strict functions
- *
- * @param name function name
- * @param methodHandle handle for invocation
- * @return new ScriptFunction
- */
- static ScriptFunction makeStrictFunction(final String name, final MethodHandle methodHandle) {
- return makeFunction(name, methodHandle, null, ScriptFunctionData.IS_BUILTIN | ScriptFunctionData.IS_STRICT );
- }
-
- /**
- * Factory method for non-constructor built-in functions
- *
- * @param name function name
- * @param methodHandle handle for invocation
- * @return new ScriptFunction
- */
- static ScriptFunction makeFunction(final String name, final MethodHandle methodHandle) {
- return makeFunction(name, methodHandle, null);
- }
-
- @Override
- public ScriptFunction makeSynchronizedFunction(final Object sync) {
- final MethodHandle mh = MH.insertArguments(ScriptFunction.INVOKE_SYNC, 0, this, sync);
- return makeFunction(getName(), mh);
- }
-
- /**
- * Same as {@link ScriptFunction#makeBoundFunction(Object, Object[])}. The only reason we override it is so that we
- * can expose it.
- * @param self the self to bind to this function. Can be null (in which case, null is bound as this).
- * @param args additional arguments to bind to this function. Can be null or empty to not bind additional arguments.
- * @return a function with the specified self and parameters bound.
- */
- @Override
- public ScriptFunction makeBoundFunction(final Object self, final Object[] args) {
- return super.makeBoundFunction(self, args);
- }
-
- /**
- * This method is used to create a bound function based on this function.
- *
- * @param data the {@code ScriptFunctionData} specifying the functions immutable portion.
- * @return a function initialized from the specified data. Its parent scope will be set to null, therefore the
- * passed in data should not expect a callee.
- */
- @Override
- protected ScriptFunction makeBoundFunction(final ScriptFunctionData data) {
- return new BoundScriptFunctionImpl(data, getTargetFunction());
- }
-
- // return Object.prototype - used by "allocate"
- @Override
- protected final ScriptObject getObjectPrototype() {
- return Global.objectPrototype();
- }
-
- @Override
- public final Object getPrototype() {
- if (prototype == LAZY_PROTOTYPE) {
- prototype = new PrototypeObject(this);
- }
- return prototype;
- }
-
- @Override
- public final void setPrototype(final Object newProto) {
- if (newProto instanceof ScriptObject && newProto != this.prototype && allocatorMap != null) {
- // Replace our current allocator map with one that is associated with the new prototype.
- allocatorMap = allocatorMap.changeProto((ScriptObject)newProto);
- }
- this.prototype = newProto;
- }
-
- // Internals below..
- private void init(final Global global) {
- this.setInitialProto(global.getFunctionPrototype());
- this.prototype = LAZY_PROTOTYPE;
-
- // We have to fill user accessor functions late as these are stored
- // in this object rather than in the PropertyMap of this object.
- assert objectSpill == null;
- final ScriptFunction typeErrorThrower = global.getTypeErrorThrower();
- if (findProperty("arguments", true) != null) {
- initUserAccessors("arguments", Property.NOT_CONFIGURABLE | Property.NOT_ENUMERABLE, typeErrorThrower, typeErrorThrower);
- }
- if (findProperty("caller", true) != null) {
- initUserAccessors("caller", Property.NOT_CONFIGURABLE | Property.NOT_ENUMERABLE, typeErrorThrower, typeErrorThrower);
- }
- }
-}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/Parser.java Thu Sep 17 09:19:40 2015 -0700
@@ -808,7 +808,7 @@
if (!oldStrictMode && directiveStmts != null) {
// check that directives preceding this one do not violate strictness
for (final Node statement : directiveStmts) {
- // the get value will force unescape of preceeding
+ // the get value will force unescape of preceding
// escaped string directives
getValue(statement.getToken());
}
@@ -2507,7 +2507,7 @@
// run: function() { println("run"); }
// };
//
- // The object literal following the "new Constructor()" expresssion
+ // The object literal following the "new Constructor()" expression
// is passed as an additional (last) argument to the constructor.
if (!env._no_syntax_extensions && type == LBRACE) {
arguments.add(objectLiteral());
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextBaseNode.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextBaseNode.java Thu Sep 17 09:19:40 2015 -0700
@@ -90,7 +90,7 @@
}
/**
- * Adds a Statement at the end of the Statementlist
+ * Adds a statement at the end of the statement list
* @param statement The statement to add
*/
@Override
@@ -99,7 +99,7 @@
}
/**
- * Adds a statement at the begining of the statementlist
+ * Adds a statement at the beginning of the statement list
* @param statement The statement to add
*/
@Override
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextNode.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/parser/ParserContextNode.java Thu Sep 17 09:19:40 2015 -0700
@@ -53,13 +53,13 @@
public void setStatements(final List<Statement> statements);
/**
- * Adds a Statement at the end of the Statementlist
+ * Adds a statement at the end of the statement list
* @param statement The statement to add
*/
public void appendStatement(final Statement statement);
/**
- * Adds a statement at the begining of the statementlist
+ * Adds a statement at the beginning of the statement list
* @param statement The statement to add
*/
public void prependStatement(final Statement statement);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CodeInstaller.java Thu Sep 17 09:19:40 2015 -0700
@@ -38,15 +38,14 @@
* The compiler still retains most of the state around code emission
* and management internally, so this is to avoid passing around any
* logic that isn't directly related to installing a class
- * @param <T> owner class type for this code installer
*
*/
-public interface CodeInstaller<T> {
+public interface CodeInstaller {
/**
- * Return the owner for the CodeInstaller, e.g. a {@link Context}
- * @return owner
+ * Return the {@link Context} associated with this code installer.
+ * @return the context.
*/
- public T getOwner();
+ public Context getContext();
/**
* Install a class.
@@ -106,7 +105,7 @@
* new, independent class loader.
* @return a new code installer with a new independent class loader.
*/
- public CodeInstaller<T> withNewLoader();
+ public CodeInstaller withNewLoader();
/**
* Returns true if this code installer is compatible with the other code installer. Compatibility is expected to be
@@ -115,6 +114,6 @@
* @param other the other code installer tested for compatibility with this code installer.
* @return true if this code installer is compatible with the other code installer.
*/
- public boolean isCompatibleWith(CodeInstaller<T> other);
+ public boolean isCompatibleWith(CodeInstaller other);
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/CompiledFunction.java Thu Sep 17 09:19:40 2015 -0700
@@ -102,7 +102,7 @@
/*
* An optimistic builtin with isOptimistic=true works like any optimistic generated function, i.e. it
* can throw unwarranted optimism exceptions. As native functions trivially can't have parts of them
- * regenerated as restof methods, this only works if the methods are atomic/functional in their behavior
+ * regenerated as "restOf" methods, this only works if the methods are atomic/functional in their behavior
* and doesn't modify state before an UOE can be thrown. If they aren't, we can reexecute a wider version
* of the same builtin in a recompilation handler for FinalScriptFunctionData. There are several
* candidate methods in Native* that would benefit from this, but I haven't had time to implement any
@@ -567,7 +567,7 @@
return handle;
}
- // Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itslef
+ // Otherwise, we need a new level of indirection; need to introduce a mutable call site that can relink itself
// to the compiled function's changed target whenever the optimistic assumptions are invalidated.
final CallSite cs = new MutableCallSite(handle.type());
relinkComposableInvoker(cs, this, isConstructor);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Context.java Thu Sep 17 09:19:40 2015 -0700
@@ -153,7 +153,7 @@
* Currently we are conservative and associate the name of a builtin class with all
* its properties, so it's enough to invalidate a property to break all assumptions
* about a prototype. This can be changed to a more fine grained approach, but no one
- * ever needs this, given the very rare occurance of swapping out only parts of
+ * ever needs this, given the very rare occurrence of swapping out only parts of
* a builtin v.s. the entire builtin object
*/
private final Map<String, SwitchPoint> builtinSwitchPoints = new HashMap<>();
@@ -167,7 +167,7 @@
* ContextCodeInstaller that has the privilege of installing classes in the Context.
* Can only be instantiated from inside the context and is opaque to other classes
*/
- public static class ContextCodeInstaller implements CodeInstaller<ScriptEnvironment> {
+ public static class ContextCodeInstaller implements CodeInstaller {
private final Context context;
private final ScriptLoader loader;
private final CodeSource codeSource;
@@ -185,13 +185,9 @@
this.codeSource = codeSource;
}
- /**
- * Return the script environment for this installer
- * @return ScriptEnvironment
- */
@Override
- public ScriptEnvironment getOwner() {
- return context.env;
+ public Context getContext() {
+ return context;
}
@Override
@@ -254,7 +250,7 @@
}
@Override
- public CodeInstaller<ScriptEnvironment> withNewLoader() {
+ public CodeInstaller withNewLoader() {
// Reuse this installer if we're within our limits.
if (usageCount < MAX_USAGES && bytesDefined < MAX_BYTES_DEFINED) {
return this;
@@ -263,7 +259,7 @@
}
@Override
- public boolean isCompatibleWith(final CodeInstaller<ScriptEnvironment> other) {
+ public boolean isCompatibleWith(final CodeInstaller other) {
if (other instanceof ContextCodeInstaller) {
final ContextCodeInstaller cci = (ContextCodeInstaller)other;
return cci.context == context && cci.codeSource == codeSource;
@@ -1300,14 +1296,12 @@
final URL url = source.getURL();
final ScriptLoader loader = env._loader_per_compile ? createNewLoader() : scriptLoader;
final CodeSource cs = new CodeSource(url, (CodeSigner[])null);
- final CodeInstaller<ScriptEnvironment> installer = new ContextCodeInstaller(this, loader, cs);
+ final CodeInstaller installer = new ContextCodeInstaller(this, loader, cs);
if (storedScript == null) {
final CompilationPhases phases = Compiler.CompilationPhases.COMPILE_ALL;
- final Compiler compiler = new Compiler(
- this,
- env,
+ final Compiler compiler = Compiler.forInitialCompilation(
installer,
source,
errMan,
@@ -1481,7 +1475,7 @@
* @param level log level
* @param mh method handle
* @param paramStart first parameter to print
- * @param printReturnValue should we print the return vaulue?
+ * @param printReturnValue should we print the return value?
* @param text debug printout to add
*
* @return instrumented method handle, or null if logger not enabled
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/FindProperty.java Thu Sep 17 09:19:40 2015 -0700
@@ -297,4 +297,3 @@
}
}
-
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/GlobalConstants.java Thu Sep 17 09:19:40 2015 -0700
@@ -67,7 +67,7 @@
*
* Thus everything registered as a global constant gets an extra chance. Set once,
* reregister the switchpoint. Set twice or more - don't try again forever, or we'd
- * just end up relinking our way into megamorphisism.
+ * just end up relinking our way into megamorphism.
*
* Also it has to be noted that this kind of linking creates a coupling between a Global
* and the call sites in compiled code belonging to the Context. For this reason, the
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSONFunctions.java Thu Sep 17 09:19:40 2015 -0700
@@ -26,7 +26,6 @@
package jdk.nashorn.internal.runtime;
import java.lang.invoke.MethodHandle;
-import java.util.Iterator;
import java.util.concurrent.Callable;
import jdk.nashorn.internal.objects.Global;
import jdk.nashorn.internal.parser.JSONParser;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/JSType.java Thu Sep 17 09:19:40 2015 -0700
@@ -1967,7 +1967,7 @@
/**
* Get the unboxed (primitive) type for an object
* @param o object
- * @return primive type or Object.class if not primitive
+ * @return primitive type or Object.class if not primitive
*/
public static Class<?> unboxedFieldType(final Object o) {
if (o == null) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ParserException.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ParserException.java Thu Sep 17 09:19:40 2015 -0700
@@ -38,7 +38,7 @@
private final Source source;
// token responsible for this exception
private final long token;
- // if this is traslated as ECMA error, which type should be used?
+ // if this is translated as ECMA error, which type should be used?
private final JSErrorType errorType;
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyListeners.java Thu Sep 17 09:19:40 2015 -0700
@@ -28,6 +28,7 @@
import java.util.Map;
import java.util.Set;
import java.util.WeakHashMap;
+import java.util.concurrent.atomic.LongAdder;
/**
* Helper class to manage property listeners and notification.
@@ -37,8 +38,15 @@
private Map<String, WeakPropertyMapSet> listeners;
// These counters are updated in debug mode
- private static int listenersAdded;
- private static int listenersRemoved;
+ private static LongAdder listenersAdded;
+ private static LongAdder listenersRemoved;
+
+ static {
+ if (Context.DEBUG) {
+ listenersAdded = new LongAdder();
+ listenersRemoved = new LongAdder();
+ }
+ }
/**
* Copy constructor
@@ -54,16 +62,16 @@
* Return aggregate listeners added to all PropertyListenerManagers
* @return the listenersAdded
*/
- public static int getListenersAdded() {
- return listenersAdded;
+ public static long getListenersAdded() {
+ return listenersAdded.longValue();
}
/**
* Return aggregate listeners removed from all PropertyListenerManagers
* @return the listenersRemoved
*/
- public static int getListenersRemoved() {
- return listenersRemoved;
+ public static long getListenersRemoved() {
+ return listenersRemoved.longValue();
}
/**
@@ -122,7 +130,7 @@
*/
synchronized final void addListener(final String key, final PropertyMap propertyMap) {
if (Context.DEBUG) {
- listenersAdded++;
+ listenersAdded.increment();
}
if (listeners == null) {
listeners = new WeakHashMap<>();
@@ -151,6 +159,9 @@
propertyMap.propertyAdded(prop);
}
listeners.remove(prop.getKey());
+ if (Context.DEBUG) {
+ listenersRemoved.increment();
+ }
}
}
}
@@ -168,6 +179,9 @@
propertyMap.propertyDeleted(prop);
}
listeners.remove(prop.getKey());
+ if (Context.DEBUG) {
+ listenersRemoved.increment();
+ }
}
}
}
@@ -187,6 +201,9 @@
propertyMap.propertyModified(oldProp, newProp);
}
listeners.remove(oldProp.getKey());
+ if (Context.DEBUG) {
+ listenersRemoved.increment();
+ }
}
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PropertyMap.java Thu Sep 17 09:19:40 2015 -0700
@@ -42,6 +42,7 @@
import java.util.Iterator;
import java.util.NoSuchElementException;
import java.util.WeakHashMap;
+import java.util.concurrent.atomic.LongAdder;
import jdk.nashorn.internal.scripts.JO;
/**
@@ -114,7 +115,7 @@
}
if (Context.DEBUG) {
- count++;
+ count.increment();
}
}
@@ -135,8 +136,8 @@
this.freeSlots = propertyMap.freeSlots;
if (Context.DEBUG) {
- count++;
- clonedCount++;
+ count.increment();
+ clonedCount.increment();
}
}
@@ -328,7 +329,7 @@
if (sp != null) {
protoGetSwitches.remove(key);
if (Context.DEBUG) {
- protoInvalidations++;
+ protoInvalidations.increment();
}
SwitchPoint.invalidateAll(new SwitchPoint[] { sp });
}
@@ -343,7 +344,7 @@
final int size = protoGetSwitches.size();
if (size > 0) {
if (Context.DEBUG) {
- protoInvalidations += size;
+ protoInvalidations.add(size);
}
SwitchPoint.invalidateAll(protoGetSwitches.values().toArray(new SwitchPoint[size]));
protoGetSwitches.clear();
@@ -713,7 +714,7 @@
}
if (Context.DEBUG && cachedMap != null) {
- protoHistoryHit++;
+ protoHistoryHit.increment();
}
return cachedMap;
@@ -762,7 +763,7 @@
if (historicMap != null) {
if (Context.DEBUG) {
- historyHit++;
+ historyHit.increment();
}
return historicMap;
@@ -910,7 +911,7 @@
}
if (Context.DEBUG) {
- setProtoNewMapCount++;
+ setProtoNewMapCount.increment();
}
final PropertyMap newMap = new PropertyMap(this);
@@ -1030,52 +1031,62 @@
}
// counters updated only in debug mode
- private static int count;
- private static int clonedCount;
- private static int historyHit;
- private static int protoInvalidations;
- private static int protoHistoryHit;
- private static int setProtoNewMapCount;
+ private static LongAdder count;
+ private static LongAdder clonedCount;
+ private static LongAdder historyHit;
+ private static LongAdder protoInvalidations;
+ private static LongAdder protoHistoryHit;
+ private static LongAdder setProtoNewMapCount;
+ static {
+ if (Context.DEBUG) {
+ count = new LongAdder();
+ clonedCount = new LongAdder();
+ historyHit = new LongAdder();
+ protoInvalidations = new LongAdder();
+ protoHistoryHit = new LongAdder();
+ setProtoNewMapCount = new LongAdder();
+ }
+ }
/**
* @return Total number of maps.
*/
- public static int getCount() {
- return count;
+ public static long getCount() {
+ return count.longValue();
}
/**
* @return The number of maps that were cloned.
*/
- public static int getClonedCount() {
- return clonedCount;
+ public static long getClonedCount() {
+ return clonedCount.longValue();
}
/**
* @return The number of times history was successfully used.
*/
- public static int getHistoryHit() {
- return historyHit;
+ public static long getHistoryHit() {
+ return historyHit.longValue();
}
/**
* @return The number of times prototype changes caused invalidation.
*/
- public static int getProtoInvalidations() {
- return protoInvalidations;
+ public static long getProtoInvalidations() {
+ return protoInvalidations.longValue();
}
/**
* @return The number of times proto history was successfully used.
*/
- public static int getProtoHistoryHit() {
- return protoHistoryHit;
+ public static long getProtoHistoryHit() {
+ return protoHistoryHit.longValue();
}
/**
* @return The number of times prototypes were modified.
*/
- public static int getSetProtoNewMapCount() {
- return setProtoNewMapCount;
+ public static long getSetProtoNewMapCount() {
+ return setProtoNewMapCount.longValue();
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/PrototypeObject.java Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,118 @@
+/*
+ * Copyright (c) 2010, 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 jdk.nashorn.internal.runtime;
+
+import static jdk.nashorn.internal.lookup.Lookup.MH;
+import static jdk.nashorn.internal.runtime.ScriptRuntime.UNDEFINED;
+
+import java.lang.invoke.MethodHandle;
+import java.lang.invoke.MethodHandles;
+import java.util.ArrayList;
+import jdk.nashorn.internal.objects.Global;
+
+/**
+ * Instances of this class serve as "prototype" object for script functions.
+ * The purpose is to expose "constructor" property from "prototype". Also, nasgen
+ * generated prototype classes extend from this class.
+ */
+public class PrototypeObject extends ScriptObject {
+ private static final PropertyMap map$;
+
+ private Object constructor;
+
+ private static final MethodHandle GET_CONSTRUCTOR = findOwnMH("getConstructor", Object.class, Object.class);
+ private static final MethodHandle SET_CONSTRUCTOR = findOwnMH("setConstructor", void.class, Object.class, Object.class);
+
+ static {
+ final ArrayList<Property> properties = new ArrayList<>(1);
+ properties.add(AccessorProperty.create("constructor", Property.NOT_ENUMERABLE, GET_CONSTRUCTOR, SET_CONSTRUCTOR));
+ map$ = PropertyMap.newMap(properties);
+ }
+
+ private PrototypeObject(final Global global, final PropertyMap map) {
+ super(global.getObjectPrototype(), map != map$? map.addAll(map$) : map$);
+ }
+
+ /**
+ * Prototype constructor
+ */
+ protected PrototypeObject() {
+ this(Global.instance(), map$);
+ }
+
+ /**
+ * PropertyObject constructor
+ *
+ * @param map property map
+ */
+ protected PrototypeObject(final PropertyMap map) {
+ this(Global.instance(), map);
+ }
+
+ /**
+ * PropertyObject constructor
+ *
+ * @param func constructor function
+ */
+ protected PrototypeObject(final ScriptFunction func) {
+ this(Global.instance(), map$);
+ this.constructor = func;
+ }
+
+ /**
+ * Get the constructor for this {@code PrototypeObject}
+ * @param self self reference
+ * @return constructor, probably, but not necessarily, a {@link ScriptFunction}
+ */
+ public static Object getConstructor(final Object self) {
+ return (self instanceof PrototypeObject) ?
+ ((PrototypeObject)self).getConstructor() :
+ UNDEFINED;
+ }
+
+ /**
+ * Reset the constructor for this {@code PrototypeObject}
+ * @param self self reference
+ * @param constructor constructor, probably, but not necessarily, a {@link ScriptFunction}
+ */
+ public static void setConstructor(final Object self, final Object constructor) {
+ if (self instanceof PrototypeObject) {
+ ((PrototypeObject)self).setConstructor(constructor);
+ }
+ }
+
+ private Object getConstructor() {
+ return constructor;
+ }
+
+ private void setConstructor(final Object constructor) {
+ this.constructor = constructor;
+ }
+
+ private static MethodHandle findOwnMH(final String name, final Class<?> rtype, final Class<?>... types) {
+ return MH.findStatic(MethodHandles.lookup(), PrototypeObject.class, name, MH.type(rtype, types));
+ }
+}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/RecompilableScriptFunctionData.java Thu Sep 17 09:19:40 2015 -0700
@@ -119,7 +119,7 @@
private final Object endParserState;
/** Code installer used for all further recompilation/specialization of this ScriptFunction */
- private transient CodeInstaller<ScriptEnvironment> installer;
+ private transient CodeInstaller installer;
private final Map<Integer, RecompilableScriptFunctionData> nestedFunctions;
@@ -153,7 +153,7 @@
*/
public RecompilableScriptFunctionData(
final FunctionNode functionNode,
- final CodeInstaller<ScriptEnvironment> installer,
+ final CodeInstaller installer,
final AllocationStrategy allocationStrategy,
final Map<Integer, RecompilableScriptFunctionData> nestedFunctions,
final Map<String, Integer> externalScopeDepths,
@@ -285,7 +285,7 @@
* @param src source
* @param inst code installer
*/
- public void initTransients(final Source src, final CodeInstaller<ScriptEnvironment> inst) {
+ public void initTransients(final Source src, final CodeInstaller inst) {
if (this.source == null && this.installer == null) {
this.source = src;
this.installer = inst;
@@ -500,7 +500,7 @@
}
private FunctionNode deserialize(final byte[] serializedAst) {
- final ScriptEnvironment env = installer.getOwner();
+ final ScriptEnvironment env = installer.getContext().getEnv();
final Timing timing = env._timing;
final long t1 = System.nanoTime();
try {
@@ -647,8 +647,8 @@
* a new class loader with optimistic typing so that deoptimized code can get reclaimed by GC.
* @return a code installer for installing new code.
*/
- private CodeInstaller<ScriptEnvironment> getInstallerForNewCode() {
- final ScriptEnvironment env = installer.getOwner();
+ private CodeInstaller getInstallerForNewCode() {
+ final ScriptEnvironment env = installer.getContext().getEnv();
return env._optimistic_types || env._loader_per_compile ? installer.withNewLoader() : installer;
}
@@ -658,15 +658,10 @@
final TypeMap typeMap = typeMap(actualCallSiteType);
final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
final Object typeInformationFile = OptimisticTypesPersistence.getLocationDescriptor(source, functionNodeId, paramTypes);
- final Context context = Context.getContextTrusted();
- return new Compiler(
- context,
- context.getEnv(),
+ return Compiler.forOnDemandCompilation(
getInstallerForNewCode(),
functionNode.getSource(), // source
- context.getErrorManager(),
isStrict() | functionNode.isStrict(), // is strict
- true, // is on demand
this, // compiledFunction, i.e. this RecompilableScriptFunctionData
typeMap, // type map
getEffectiveInvalidatedProgramPoints(invalidatedProgramPoints, typeInformationFile), // invalidated program points
@@ -709,7 +704,7 @@
final TypeMap typeMap = typeMap(actualCallSiteType);
final Type[] paramTypes = typeMap == null ? null : typeMap.getParameterTypes(functionNodeId);
cacheKey = CodeStore.getCacheKey(functionNodeId, paramTypes);
- final CodeInstaller<ScriptEnvironment> newInstaller = getInstallerForNewCode();
+ final CodeInstaller newInstaller = getInstallerForNewCode();
final StoredScript script = newInstaller.loadScript(source, cacheKey);
if (script != null) {
@@ -730,7 +725,7 @@
}
boolean usePersistentCodeCache() {
- return installer != null && installer.getOwner()._persistent_cache;
+ return installer != null && installer.getContext().getEnv()._persistent_cache;
}
private MethodType explicitParams(final MethodType callSiteType) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Scope.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/Scope.java Thu Sep 17 09:19:40 2015 -0700
@@ -27,6 +27,7 @@
import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
+import java.util.concurrent.atomic.LongAdder;
import jdk.nashorn.internal.codegen.CompilerConstants;
/**
@@ -38,7 +39,7 @@
private int splitState = -1;
/** This is updated only in debug mode - counts number of {@code ScriptObject} instances created that are scope */
- private static int count;
+ private static final LongAdder count = Context.DEBUG ? new LongAdder() : null;
/** Method handle that points to {@link Scope#getSplitState}. */
public static final CompilerConstants.Call GET_SPLIT_STATE = virtualCallNoLookup(Scope.class, "getSplitState", int.class);
@@ -52,9 +53,7 @@
*/
public Scope(final PropertyMap map) {
super(map);
- if (Context.DEBUG) {
- count++;
- }
+ incrementCount();
}
/**
@@ -65,9 +64,7 @@
*/
public Scope(final ScriptObject proto, final PropertyMap map) {
super(proto, map);
- if (Context.DEBUG) {
- count++;
- }
+ incrementCount();
}
/**
@@ -79,9 +76,7 @@
*/
public Scope(final PropertyMap map, final long[] primitiveSpill, final Object[] objectSpill) {
super(map, primitiveSpill, objectSpill);
- if (Context.DEBUG) {
- count++;
- }
+ incrementCount();
}
@Override
@@ -123,7 +118,13 @@
*
* @return number of scope ScriptObjects created
*/
- public static int getScopeCount() {
- return count;
+ public static long getScopeCount() {
+ return count != null ? count.sum() : 0;
+ }
+
+ private static void incrementCount() {
+ if (Context.DEBUG) {
+ count.increment();
+ }
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunction.java Thu Sep 17 09:19:40 2015 -0700
@@ -22,7 +22,6 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
-
package jdk.nashorn.internal.runtime;
import static jdk.nashorn.internal.codegen.CompilerConstants.virtualCallNoLookup;
@@ -40,6 +39,7 @@
import java.util.Collections;
import java.util.HashSet;
import java.util.List;
+import java.util.concurrent.atomic.LongAdder;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.GuardedInvocation;
import jdk.internal.dynalink.linker.LinkRequest;
@@ -55,38 +55,54 @@
import jdk.nashorn.internal.runtime.logging.DebugLogger;
/**
- * Runtime representation of a JavaScript function.
+ * Runtime representation of a JavaScript function. This class has only private
+ * and protected constructors. There are no *public* constructors - but only
+ * factory methods that follow the naming pattern "createXYZ".
*/
-public abstract class ScriptFunction extends ScriptObject {
+public class ScriptFunction extends ScriptObject {
- /** Method handle for prototype getter for this ScriptFunction */
+ /**
+ * Method handle for prototype getter for this ScriptFunction
+ */
public static final MethodHandle G$PROTOTYPE = findOwnMH_S("G$prototype", Object.class, Object.class);
- /** Method handle for prototype setter for this ScriptFunction */
+ /**
+ * Method handle for prototype setter for this ScriptFunction
+ */
public static final MethodHandle S$PROTOTYPE = findOwnMH_S("S$prototype", void.class, Object.class, Object.class);
- /** Method handle for length getter for this ScriptFunction */
+ /**
+ * Method handle for length getter for this ScriptFunction
+ */
public static final MethodHandle G$LENGTH = findOwnMH_S("G$length", int.class, Object.class);
- /** Method handle for name getter for this ScriptFunction */
+ /**
+ * Method handle for name getter for this ScriptFunction
+ */
public static final MethodHandle G$NAME = findOwnMH_S("G$name", Object.class, Object.class);
- /** Method handle used for implementing sync() in mozilla_compat */
+ /**
+ * Method handle used for implementing sync() in mozilla_compat
+ */
public static final MethodHandle INVOKE_SYNC = findOwnMH_S("invokeSync", Object.class, ScriptFunction.class, Object.class, Object.class, Object[].class);
- /** Method handle for allocate function for this ScriptFunction */
+ /**
+ * Method handle for allocate function for this ScriptFunction
+ */
static final MethodHandle ALLOCATE = findOwnMH_V("allocate", Object.class);
private static final MethodHandle WRAPFILTER = findOwnMH_S("wrapFilter", Object.class, Object.class);
private static final MethodHandle SCRIPTFUNCTION_GLOBALFILTER = findOwnMH_S("globalFilter", Object.class, Object.class);
- /** method handle to scope getter for this ScriptFunction */
+ /**
+ * method handle to scope getter for this ScriptFunction
+ */
public static final Call GET_SCOPE = virtualCallNoLookup(ScriptFunction.class, "getScope", ScriptObject.class);
- private static final MethodHandle IS_FUNCTION_MH = findOwnMH_S("isFunctionMH", boolean.class, Object.class, ScriptFunctionData.class);
+ private static final MethodHandle IS_FUNCTION_MH = findOwnMH_S("isFunctionMH", boolean.class, Object.class, ScriptFunctionData.class);
- private static final MethodHandle IS_APPLY_FUNCTION = findOwnMH_S("isApplyFunction", boolean.class, boolean.class, Object.class, Object.class);
+ private static final MethodHandle IS_APPLY_FUNCTION = findOwnMH_S("isApplyFunction", boolean.class, boolean.class, Object.class, Object.class);
private static final MethodHandle IS_NONSTRICT_FUNCTION = findOwnMH_S("isNonStrictFunction", boolean.class, Object.class, Object.class, ScriptFunctionData.class);
@@ -94,55 +110,298 @@
private static final MethodHandle WRAP_THIS = MH.findStatic(MethodHandles.lookup(), ScriptFunctionData.class, "wrapThis", MH.type(Object.class, Object.class));
- /** The parent scope. */
+ // various property maps used for different kinds of functions
+ // property map for anonymous function that serves as Function.prototype
+ private static final PropertyMap anonmap$;
+ // property map for strict mode functions
+ private static final PropertyMap strictmodemap$;
+ // property map for bound functions
+ private static final PropertyMap boundfunctionmap$;
+ // property map for non-strict, non-bound functions.
+ private static final PropertyMap map$;
+
+ // Marker object for lazily initialized prototype object
+ private static final Object LAZY_PROTOTYPE = new Object();
+
+ private static PropertyMap createStrictModeMap(final PropertyMap map) {
+ final int flags = Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE;
+ PropertyMap newMap = map;
+ // Need to add properties directly to map since slots are assigned speculatively by newUserAccessors.
+ newMap = newMap.addPropertyNoHistory(map.newUserAccessors("arguments", flags));
+ newMap = newMap.addPropertyNoHistory(map.newUserAccessors("caller", flags));
+ return newMap;
+ }
+
+ private static PropertyMap createBoundFunctionMap(final PropertyMap strictModeMap) {
+ // Bound function map is same as strict function map, but additionally lacks the "prototype" property, see
+ // ECMAScript 5.1 section 15.3.4.5
+ return strictModeMap.deleteProperty(strictModeMap.findProperty("prototype"));
+ }
+
+ static {
+ anonmap$ = PropertyMap.newMap();
+ final ArrayList<Property> properties = new ArrayList<>(3);
+ properties.add(AccessorProperty.create("prototype", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE, G$PROTOTYPE, S$PROTOTYPE));
+ properties.add(AccessorProperty.create("length", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$LENGTH, null));
+ properties.add(AccessorProperty.create("name", Property.NOT_ENUMERABLE | Property.NOT_CONFIGURABLE | Property.NOT_WRITABLE, G$NAME, null));
+ map$ = PropertyMap.newMap(properties);
+ strictmodemap$ = createStrictModeMap(map$);
+ boundfunctionmap$ = createBoundFunctionMap(strictmodemap$);
+ }
+
+ private static boolean isStrict(final int flags) {
+ return (flags & ScriptFunctionData.IS_STRICT) != 0;
+ }
+
+ // Choose the map based on strict mode!
+ private static PropertyMap getMap(final boolean strict) {
+ return strict ? strictmodemap$ : map$;
+ }
+
+ /**
+ * The parent scope.
+ */
private final ScriptObject scope;
private final ScriptFunctionData data;
- /** The property map used for newly allocated object when function is used as constructor. */
+ /**
+ * The property map used for newly allocated object when function is used as
+ * constructor.
+ */
protected PropertyMap allocatorMap;
/**
+ * Reference to constructor prototype.
+ */
+ protected Object prototype;
+
+ /**
* Constructor
*
- * @param name function name
- * @param methodHandle method handle to function (if specializations are present, assumed to be most generic)
- * @param map property map
- * @param scope scope
- * @param specs specialized version of this function - other method handles
- * @param flags {@link ScriptFunctionData} flags
+ * @param data static function data
+ * @param map property map
+ * @param scope scope
*/
- protected ScriptFunction(
+ private ScriptFunction(
+ final ScriptFunctionData data,
+ final PropertyMap map,
+ final ScriptObject scope,
+ final Global global) {
+
+ super(map);
+
+ if (Context.DEBUG) {
+ constructorCount.increment();
+ }
+
+ this.data = data;
+ this.scope = scope;
+ this.setInitialProto(global.getFunctionPrototype());
+ this.prototype = LAZY_PROTOTYPE;
+
+ // We have to fill user accessor functions late as these are stored
+ // in this object rather than in the PropertyMap of this object.
+ assert objectSpill == null;
+ if (isStrict() || isBoundFunction()) {
+ final ScriptFunction typeErrorThrower = global.getTypeErrorThrower();
+ initUserAccessors("arguments", Property.NOT_CONFIGURABLE | Property.NOT_ENUMERABLE, typeErrorThrower, typeErrorThrower);
+ initUserAccessors("caller", Property.NOT_CONFIGURABLE | Property.NOT_ENUMERABLE, typeErrorThrower, typeErrorThrower);
+ }
+ }
+
+ /**
+ * Constructor
+ *
+ * @param name function name
+ * @param methodHandle method handle to function (if specializations are
+ * present, assumed to be most generic)
+ * @param map property map
+ * @param scope scope
+ * @param specs specialized version of this function - other method handles
+ * @param flags {@link ScriptFunctionData} flags
+ */
+ private ScriptFunction(
final String name,
final MethodHandle methodHandle,
final PropertyMap map,
final ScriptObject scope,
final Specialization[] specs,
- final int flags) {
-
- this(new FinalScriptFunctionData(name, methodHandle, specs, flags), map, scope);
+ final int flags,
+ final Global global) {
+ this(new FinalScriptFunctionData(name, methodHandle, specs, flags), map, scope, global);
}
/**
* Constructor
*
- * @param data static function data
- * @param map property map
- * @param scope scope
+ * @param name name of function
+ * @param methodHandle handle for invocation
+ * @param scope scope object
+ * @param specs specialized versions of this method, if available, null
+ * otherwise
+ * @param flags {@link ScriptFunctionData} flags
+ */
+ private ScriptFunction(
+ final String name,
+ final MethodHandle methodHandle,
+ final ScriptObject scope,
+ final Specialization[] specs,
+ final int flags) {
+ this(name, methodHandle, getMap(isStrict(flags)), scope, specs, flags, Global.instance());
+ }
+
+ /**
+ * Constructor called by Nasgen generated code, zero added members, use the
+ * default map. Creates builtin functions only.
+ *
+ * @param name name of function
+ * @param invokeHandle handle for invocation
+ * @param specs specialized versions of this method, if available, null
+ * otherwise
+ */
+ protected ScriptFunction(final String name, final MethodHandle invokeHandle, final Specialization[] specs) {
+ this(name, invokeHandle, map$, null, specs, ScriptFunctionData.IS_BUILTIN_CONSTRUCTOR, Global.instance());
+ }
+
+ /**
+ * Constructor called by Nasgen generated code, non zero member count, use
+ * the map passed as argument. Creates builtin functions only.
+ *
+ * @param name name of function
+ * @param invokeHandle handle for invocation
+ * @param map initial property map
+ * @param specs specialized versions of this method, if available, null
+ * otherwise
+ */
+ protected ScriptFunction(final String name, final MethodHandle invokeHandle, final PropertyMap map, final Specialization[] specs) {
+ this(name, invokeHandle, map.addAll(map$), null, specs, ScriptFunctionData.IS_BUILTIN_CONSTRUCTOR, Global.instance());
+ }
+
+ // Factory methods to create various functions
+ /**
+ * Factory method called by compiler generated code for functions that need
+ * parent scope.
+ *
+ * @param constants the generated class' constant array
+ * @param index the index of the {@code RecompilableScriptFunctionData}
+ * object in the constants array.
+ * @param scope the parent scope object
+ * @return a newly created function object
*/
- protected ScriptFunction(
- final ScriptFunctionData data,
- final PropertyMap map,
- final ScriptObject scope) {
+ public static ScriptFunction create(final Object[] constants, final int index, final ScriptObject scope) {
+ final RecompilableScriptFunctionData data = (RecompilableScriptFunctionData) constants[index];
+ return new ScriptFunction(data, getMap(data.isStrict()), scope, Global.instance());
+ }
+
+ /**
+ * Factory method called by compiler generated code for functions that don't
+ * need parent scope.
+ *
+ * @param constants the generated class' constant array
+ * @param index the index of the {@code RecompilableScriptFunctionData}
+ * object in the constants array.
+ * @return a newly created function object
+ */
+ public static ScriptFunction create(final Object[] constants, final int index) {
+ return create(constants, index, null);
+ }
+
+ /**
+ * Create anonymous function that serves as Function.prototype
+ *
+ * @return anonymous function object
+ */
+ public static ScriptFunction createAnonymous() {
+ return new ScriptFunction("", GlobalFunctions.ANONYMOUS, anonmap$, null);
+ }
+
+ // builtin function create helper factory
+ private static ScriptFunction createBuiltin(final String name, final MethodHandle methodHandle, final Specialization[] specs, final int flags) {
+ final ScriptFunction func = new ScriptFunction(name, methodHandle, null, specs, flags);
+ func.setPrototype(UNDEFINED);
+ // Non-constructor built-in functions do not have "prototype" property
+ func.deleteOwnProperty(func.getMap().findProperty("prototype"));
+
+ return func;
+ }
- super(map);
+ /**
+ * Factory method for non-constructor built-in functions
+ *
+ * @param name function name
+ * @param methodHandle handle for invocation
+ * @param specs specialized versions of function if available, null
+ * otherwise
+ * @return new ScriptFunction
+ */
+ public static ScriptFunction createBuiltin(final String name, final MethodHandle methodHandle, final Specialization[] specs) {
+ return ScriptFunction.createBuiltin(name, methodHandle, specs, ScriptFunctionData.IS_BUILTIN);
+ }
- if (Context.DEBUG) {
- constructorCount++;
+ /**
+ * Factory method for non-constructor built-in functions
+ *
+ * @param name function name
+ * @param methodHandle handle for invocation
+ * @return new ScriptFunction
+ */
+ public static ScriptFunction createBuiltin(final String name, final MethodHandle methodHandle) {
+ return ScriptFunction.createBuiltin(name, methodHandle, null);
+ }
+
+ /**
+ * Factory method for non-constructor built-in, strict functions
+ *
+ * @param name function name
+ * @param methodHandle handle for invocation
+ * @return new ScriptFunction
+ */
+ public static ScriptFunction createStrictBuiltin(final String name, final MethodHandle methodHandle) {
+ return ScriptFunction.createBuiltin(name, methodHandle, null, ScriptFunctionData.IS_BUILTIN | ScriptFunctionData.IS_STRICT);
+ }
+
+ // Subclass to represent bound functions
+ private static class Bound extends ScriptFunction {
+ private final ScriptFunction target;
+
+ Bound(final ScriptFunctionData boundData, final ScriptFunction target) {
+ super(boundData, boundfunctionmap$, null, Global.instance());
+ setPrototype(ScriptRuntime.UNDEFINED);
+ this.target = target;
}
- this.data = data;
- this.scope = scope;
+ @Override
+ protected ScriptFunction getTargetFunction() {
+ return target;
+ }
+ }
+
+ /**
+ * Creates a version of this function bound to a specific "self" and other
+ * arguments, as per {@code Function.prototype.bind} functionality in
+ * ECMAScript 5.1 section 15.3.4.5.
+ *
+ * @param self the self to bind to this function. Can be null (in which
+ * case, null is bound as this).
+ * @param args additional arguments to bind to this function. Can be null or
+ * empty to not bind additional arguments.
+ * @return a function with the specified self and parameters bound.
+ */
+ public final ScriptFunction createBound(final Object self, final Object[] args) {
+ return new Bound(data.makeBoundFunctionData(this, self, args), getTargetFunction());
+ }
+
+ /**
+ * Create a function that invokes this function synchronized on {@code sync}
+ * or the self object of the invocation.
+ *
+ * @param sync the Object to synchronize on, or undefined
+ * @return synchronized function
+ */
+ public final ScriptFunction createSynchronized(final Object sync) {
+ final MethodHandle mh = MH.insertArguments(ScriptFunction.INVOKE_SYNC, 0, this, sync);
+ return createBuiltin(getName(), mh);
}
@Override
@@ -151,8 +410,8 @@
}
/**
- * ECMA 15.3.5.3 [[HasInstance]] (V)
- * Step 3 if "prototype" value is not an Object, throw TypeError
+ * ECMA 15.3.5.3 [[HasInstance]] (V) Step 3 if "prototype" value is not an
+ * Object, throw TypeError
*/
@Override
public boolean isInstance(final ScriptObject instance) {
@@ -171,22 +430,25 @@
}
/**
- * Returns the target function for this function. If the function was not created using
- * {@link #makeBoundFunction(Object, Object[])}, its target function is itself. If it is bound, its target function
- * is the target function of the function it was made from (therefore, the target function is always the final,
- * unbound recipient of the calls).
+ * Returns the target function for this function. If the function was not
+ * created using {@link #createBound(Object, Object[])}, its target
+ * function is itself. If it is bound, its target function is the target
+ * function of the function it was made from (therefore, the target function
+ * is always the final, unbound recipient of the calls).
+ *
* @return the target function for this function.
*/
protected ScriptFunction getTargetFunction() {
return this;
}
- boolean isBoundFunction() {
+ final boolean isBoundFunction() {
return getTargetFunction() != this;
}
/**
* Set the arity of this ScriptFunction
+ *
* @param arity arity
*/
public final void setArity(final int arity) {
@@ -195,59 +457,66 @@
/**
* Is this a ECMAScript 'use strict' function?
+ *
* @return true if function is in strict mode
*/
- public boolean isStrict() {
+ public final boolean isStrict() {
return data.isStrict();
}
/**
- * Returns true if this is a non-strict, non-built-in function that requires non-primitive this argument
- * according to ECMA 10.4.3.
+ * Returns true if this is a non-strict, non-built-in function that requires
+ * non-primitive this argument according to ECMA 10.4.3.
+ *
* @return true if this argument must be an object
*/
- public boolean needsWrappedThis() {
+ public final boolean needsWrappedThis() {
return data.needsWrappedThis();
}
private static boolean needsWrappedThis(final Object fn) {
- return fn instanceof ScriptFunction ? ((ScriptFunction)fn).needsWrappedThis() : false;
+ return fn instanceof ScriptFunction ? ((ScriptFunction) fn).needsWrappedThis() : false;
}
/**
* Execute this script function.
- * @param self Target object.
- * @param arguments Call arguments.
+ *
+ * @param self Target object.
+ * @param arguments Call arguments.
* @return ScriptFunction result.
- * @throws Throwable if there is an exception/error with the invocation or thrown from it
+ * @throws Throwable if there is an exception/error with the invocation or
+ * thrown from it
*/
- Object invoke(final Object self, final Object... arguments) throws Throwable {
+ final Object invoke(final Object self, final Object... arguments) throws Throwable {
if (Context.DEBUG) {
- invokes++;
+ invokes.increment();
}
return data.invoke(this, self, arguments);
}
/**
* Execute this script function as a constructor.
- * @param arguments Call arguments.
+ *
+ * @param arguments Call arguments.
* @return Newly constructed result.
- * @throws Throwable if there is an exception/error with the invocation or thrown from it
+ * @throws Throwable if there is an exception/error with the invocation or
+ * thrown from it
*/
- Object construct(final Object... arguments) throws Throwable {
+ final Object construct(final Object... arguments) throws Throwable {
return data.construct(this, arguments);
}
/**
- * Allocate function. Called from generated {@link ScriptObject} code
- * for allocation as a factory method
+ * Allocate function. Called from generated {@link ScriptObject} code for
+ * allocation as a factory method
*
- * @return a new instance of the {@link ScriptObject} whose allocator this is
+ * @return a new instance of the {@link ScriptObject} whose allocator this
+ * is
*/
@SuppressWarnings("unused")
private Object allocate() {
if (Context.DEBUG) {
- allocations++;
+ allocations.increment();
}
assert !isBoundFunction(); // allocate never invoked on bound functions
@@ -257,7 +526,7 @@
if (object != null) {
final Object prototype = getPrototype();
if (prototype instanceof ScriptObject) {
- object.setInitialProto((ScriptObject)prototype);
+ object.setInitialProto((ScriptObject) prototype);
}
if (object.getProto() == null) {
@@ -277,43 +546,28 @@
/**
* Return Object.prototype - used by "allocate"
+ *
* @return Object.prototype
*/
- protected abstract ScriptObject getObjectPrototype();
-
- /**
- * Creates a version of this function bound to a specific "self" and other arguments, as per
- * {@code Function.prototype.bind} functionality in ECMAScript 5.1 section 15.3.4.5.
- * @param self the self to bind to this function. Can be null (in which case, null is bound as this).
- * @param args additional arguments to bind to this function. Can be null or empty to not bind additional arguments.
- * @return a function with the specified self and parameters bound.
- */
- protected ScriptFunction makeBoundFunction(final Object self, final Object[] args) {
- return makeBoundFunction(data.makeBoundFunctionData(this, self, args));
+ protected final ScriptObject getObjectPrototype() {
+ return Global.objectPrototype();
}
- /**
- * Create a version of this function as in {@link ScriptFunction#makeBoundFunction(Object, Object[])},
- * but using a {@link ScriptFunctionData} for the bound data.
- *
- * @param boundData ScriptFuntionData for the bound function
- * @return a function with the bindings performed according to the given data
- */
- protected abstract ScriptFunction makeBoundFunction(ScriptFunctionData boundData);
-
@Override
public final String safeToString() {
return toSource();
}
@Override
- public String toString() {
+ public final String toString() {
return data.toString();
}
/**
- * Get this function as a String containing its source code. If no source code
- * exists in this ScriptFunction, its contents will be displayed as {@code [native code]}
+ * Get this function as a String containing its source code. If no source
+ * code exists in this ScriptFunction, its contents will be displayed as
+ * {@code [native code]}
+ *
* @return string representation of this function's source
*/
public final String toSource() {
@@ -322,27 +576,32 @@
/**
* Get the prototype object for this function
+ *
* @return prototype
*/
- public abstract Object getPrototype();
+ public final Object getPrototype() {
+ if (prototype == LAZY_PROTOTYPE) {
+ prototype = new PrototypeObject(this);
+ }
+ return prototype;
+ }
/**
* Set the prototype object for this function
- * @param prototype new prototype object
+ *
+ * @param newPrototype new prototype object
*/
- public abstract void setPrototype(Object prototype);
+ public final void setPrototype(Object newPrototype) {
+ if (newPrototype instanceof ScriptObject && newPrototype != this.prototype && allocatorMap != null) {
+ // Replace our current allocator map with one that is associated with the new prototype.
+ allocatorMap = allocatorMap.changeProto((ScriptObject) newPrototype);
+ }
+ this.prototype = newPrototype;
+ }
/**
- * Create a function that invokes this function synchronized on {@code sync} or the self object
- * of the invocation.
- * @param sync the Object to synchronize on, or undefined
- * @return synchronized function
- */
- public abstract ScriptFunction makeSynchronizedFunction(Object sync);
-
- /**
- * Return the invoke handle bound to a given ScriptObject self reference.
- * If callee parameter is required result is rebound to this.
+ * Return the invoke handle bound to a given ScriptObject self reference. If
+ * callee parameter is required result is rebound to this.
*
* @param self self reference
* @return bound invoke handle
@@ -352,9 +611,12 @@
}
/**
- * Bind the method handle to this {@code ScriptFunction} instance if it needs a callee parameter. If this function's
- * method handles don't have a callee parameter, the handle is returned unchanged.
- * @param methodHandle the method handle to potentially bind to this function instance.
+ * Bind the method handle to this {@code ScriptFunction} instance if it
+ * needs a callee parameter. If this function's method handles don't have a
+ * callee parameter, the handle is returned unchanged.
+ *
+ * @param methodHandle the method handle to potentially bind to this
+ * function instance.
* @return the potentially bound method handle
*/
private MethodHandle bindToCalleeIfNeeded(final MethodHandle methodHandle) {
@@ -364,15 +626,16 @@
/**
* Get the name for this function
+ *
* @return the name
*/
public final String getName() {
return data.getName();
}
-
/**
* Get the scope for this function
+ *
* @return the scope
*/
public final ScriptObject getScope() {
@@ -383,36 +646,37 @@
* Prototype getter for this ScriptFunction - follows the naming convention
* used by Nasgen and the code generator
*
- * @param self self reference
+ * @param self self reference
* @return self's prototype
*/
public static Object G$prototype(final Object self) {
- return self instanceof ScriptFunction ?
- ((ScriptFunction)self).getPrototype() :
- UNDEFINED;
+ return self instanceof ScriptFunction
+ ? ((ScriptFunction) self).getPrototype()
+ : UNDEFINED;
}
/**
* Prototype setter for this ScriptFunction - follows the naming convention
* used by Nasgen and the code generator
*
- * @param self self reference
+ * @param self self reference
* @param prototype prototype to set
*/
public static void S$prototype(final Object self, final Object prototype) {
if (self instanceof ScriptFunction) {
- ((ScriptFunction)self).setPrototype(prototype);
+ ((ScriptFunction) self).setPrototype(prototype);
}
}
/**
* Length getter - ECMA 15.3.3.2: Function.length
+ *
* @param self self reference
* @return length
*/
public static int G$length(final Object self) {
if (self instanceof ScriptFunction) {
- return ((ScriptFunction)self).data.getArity();
+ return ((ScriptFunction) self).data.getArity();
}
return 0;
@@ -420,12 +684,13 @@
/**
* Name getter - ECMA Function.name
+ *
* @param self self refence
* @return the name, or undefined if none
*/
public static Object G$name(final Object self) {
if (self instanceof ScriptFunction) {
- return ((ScriptFunction)self).getName();
+ return ((ScriptFunction) self).getName();
}
return UNDEFINED;
@@ -433,6 +698,7 @@
/**
* Get the prototype for this ScriptFunction
+ *
* @param constructor constructor
* @return prototype, or null if given constructor is not a ScriptFunction
*/
@@ -440,7 +706,7 @@
if (constructor != null) {
final Object proto = constructor.getPrototype();
if (proto instanceof ScriptObject) {
- return (ScriptObject)proto;
+ return (ScriptObject) proto;
}
}
@@ -448,29 +714,37 @@
}
// These counters are updated only in debug mode.
- private static int constructorCount;
- private static int invokes;
- private static int allocations;
+ private static LongAdder constructorCount;
+ private static LongAdder invokes;
+ private static LongAdder allocations;
+
+ static {
+ if (Context.DEBUG) {
+ constructorCount = new LongAdder();
+ invokes = new LongAdder();
+ allocations = new LongAdder();
+ }
+ }
/**
* @return the constructorCount
*/
- public static int getConstructorCount() {
- return constructorCount;
+ public static long getConstructorCount() {
+ return constructorCount.longValue();
}
/**
* @return the invokes
*/
- public static int getInvokes() {
- return invokes;
+ public static long getInvokes() {
+ return invokes.longValue();
}
/**
* @return the allocations
*/
- public static int getAllocations() {
- return allocations;
+ public static long getAllocations() {
+ return allocations.longValue();
}
@Override
@@ -490,7 +764,6 @@
return Context.getGlobal().wrapAsObject(obj);
}
-
@SuppressWarnings("unused")
private static Object globalFilter(final Object object) {
// replace whatever we get with the current global object
@@ -498,14 +771,16 @@
}
/**
- * Some receivers are primitive, in that case, according to the Spec we create a new
- * native object per callsite with the wrap filter. We can only apply optimistic builtins
- * if there is no per instance state saved for these wrapped objects (e.g. currently NativeStrings),
- * otherwise we can't create optimistic versions
+ * Some receivers are primitive, in that case, according to the Spec we
+ * create a new native object per callsite with the wrap filter. We can only
+ * apply optimistic builtins if there is no per instance state saved for
+ * these wrapped objects (e.g. currently NativeStrings), otherwise we can't
+ * create optimistic versions
*
- * @param self receiver
- * @param linkLogicClass linkLogicClass, or null if no link logic exists
- * @return link logic instance, or null if one could not be constructed for this receiver
+ * @param self receiver
+ * @param linkLogicClass linkLogicClass, or null if no link logic exists
+ * @return link logic instance, or null if one could not be constructed for
+ * this receiver
*/
private static LinkLogic getLinkLogic(final Object self, final Class<? extends LinkLogic> linkLogicClass) {
if (linkLogicClass == null) {
@@ -518,25 +793,25 @@
final Object wrappedSelf = wrapFilter(self);
if (wrappedSelf instanceof OptimisticBuiltins) {
- if (wrappedSelf != self && ((OptimisticBuiltins)wrappedSelf).hasPerInstanceAssumptions()) {
+ if (wrappedSelf != self && ((OptimisticBuiltins) wrappedSelf).hasPerInstanceAssumptions()) {
return null; //pessimistic - we created a wrapped object different from the primitive, but the assumptions have instance state
}
- return ((OptimisticBuiltins)wrappedSelf).getLinkLogic(linkLogicClass);
+ return ((OptimisticBuiltins) wrappedSelf).getLinkLogic(linkLogicClass);
}
return null;
}
/**
- * dyn:call call site signature: (callee, thiz, [args...])
- * generated method signature: (callee, thiz, [args...])
+ * dyn:call call site signature: (callee, thiz, [args...]) generated method
+ * signature: (callee, thiz, [args...])
*
* cases:
* (a) method has callee parameter
- * (1) for local/scope calls, we just bind thiz and drop the second argument.
- * (2) for normal this-calls, we have to swap thiz and callee to get matching signatures.
+ * (1) for local/scope calls, we just bind thiz and drop the second argument.
+ * (2) for normal this-calls, we have to swap thiz and callee to get matching signatures.
* (b) method doesn't have callee parameter (builtin functions)
- * (3) for local/scope calls, bind thiz and drop both callee and thiz.
- * (4) for normal this-calls, drop callee.
+ * (3) for local/scope calls, bind thiz and drop both callee and thiz.
+ * (4) for normal this-calls, drop callee.
*
* @return guarded invocation for call
*/
@@ -544,11 +819,11 @@
protected GuardedInvocation findCallMethod(final CallSiteDescriptor desc, final LinkRequest request) {
final MethodType type = desc.getMethodType();
- final String name = getName();
+ final String name = getName();
final boolean isUnstable = request.isCallSiteUnstable();
- final boolean scopeCall = NashornCallSiteDescriptor.isScope(desc);
- final boolean isCall = !scopeCall && data.isBuiltin() && "call".equals(name);
- final boolean isApply = !scopeCall && data.isBuiltin() && "apply".equals(name);
+ final boolean scopeCall = NashornCallSiteDescriptor.isScope(desc);
+ final boolean isCall = !scopeCall && data.isBuiltin() && "call".equals(name);
+ final boolean isApply = !scopeCall && data.isBuiltin() && "apply".equals(name);
final boolean isApplyOrCall = isCall | isApply;
@@ -569,7 +844,7 @@
return new GuardedInvocation(
handle,
null,
- (SwitchPoint)null,
+ (SwitchPoint) null,
ClassCastException.class);
}
@@ -672,14 +947,14 @@
this,
cf.getFlags()) :
guard,
- spsArray,
+ spsArray,
exceptionGuard);
}
private GuardedInvocation createApplyOrCallCall(final boolean isApply, final CallSiteDescriptor desc, final LinkRequest request, final Object[] args) {
final MethodType descType = desc.getMethodType();
final int paramCount = descType.parameterCount();
- if(descType.parameterType(paramCount - 1).isArray()) {
+ if (descType.parameterType(paramCount - 1).isArray()) {
// This is vararg invocation of apply or call. This can normally only happen when we do a recursive
// invocation of createApplyOrCallCall (because we're doing apply-of-apply). In this case, create delegate
// linkage by unpacking the vararg invocation and use pairArguments to introduce the necessary spreader.
@@ -786,7 +1061,7 @@
inv = MH.filterArguments(inv, 2, NativeFunction.TO_APPLY_ARGS);
} else {
// If the original call site doesn't pass argArray, pass in an empty array
- inv = MH.insertArguments(inv, 2, (Object)ScriptRuntime.EMPTY_ARRAY);
+ inv = MH.insertArguments(inv, 2, (Object) ScriptRuntime.EMPTY_ARRAY);
}
}
@@ -851,7 +1126,7 @@
final LinkRequest request, final Object[] args) {
final MethodType descType = desc.getMethodType();
final int paramCount = descType.parameterCount();
- final Object[] varArgs = (Object[])args[paramCount - 1];
+ final Object[] varArgs = (Object[]) args[paramCount - 1];
// -1 'cause we're not passing the vararg array itself
final int copiedArgCount = args.length - 1;
final int varArgCount = varArgs.length;
@@ -893,7 +1168,7 @@
// If the last parameter type of the guard is an array, then it is already itself a guard for a vararg apply
// invocation. We must filter the last argument with toApplyArgs otherwise deeper levels of nesting will fail
// with ClassCastException of NativeArray to Object[].
- if(guardType.parameterType(guardParamCount - 1).isArray()) {
+ if (guardType.parameterType(guardParamCount - 1).isArray()) {
arrayConvertingGuard = MH.filterArguments(guard, guardParamCount - 1, NativeFunction.TO_APPLY_ARGS);
} else {
arrayConvertingGuard = guard;
@@ -903,19 +1178,20 @@
}
private static MethodHandle bindImplicitThis(final Object fn, final MethodHandle mh) {
- final MethodHandle bound;
- if(fn instanceof ScriptFunction && ((ScriptFunction)fn).needsWrappedThis()) {
- bound = MH.filterArguments(mh, 1, SCRIPTFUNCTION_GLOBALFILTER);
- } else {
- bound = mh;
- }
- return MH.insertArguments(bound, 1, ScriptRuntime.UNDEFINED);
- }
+ final MethodHandle bound;
+ if (fn instanceof ScriptFunction && ((ScriptFunction) fn).needsWrappedThis()) {
+ bound = MH.filterArguments(mh, 1, SCRIPTFUNCTION_GLOBALFILTER);
+ } else {
+ bound = mh;
+ }
+ return MH.insertArguments(bound, 1, ScriptRuntime.UNDEFINED);
+ }
/**
* Used for noSuchMethod/noSuchProperty and JSAdapter hooks.
*
- * These don't want a callee parameter, so bind that. Name binding is optional.
+ * These don't want a callee parameter, so bind that. Name binding is
+ * optional.
*/
MethodHandle getCallMethodHandle(final MethodType type, final String bindName) {
return pairArguments(bindToNameIfNeeded(bindToCalleeIfNeeded(data.getGenericInvoker(scope)), bindName), type);
@@ -939,10 +1215,11 @@
}
/**
- * Get the guard that checks if a {@link ScriptFunction} is equal to
- * a known ScriptFunction, using reference comparison
+ * Get the guard that checks if a {@link ScriptFunction} is equal to a known
+ * ScriptFunction, using reference comparison
*
- * @param function The ScriptFunction to check against. This will be bound to the guard method handle
+ * @param function The ScriptFunction to check against. This will be bound
+ * to the guard method handle
*
* @return method handle for guard
*/
@@ -957,11 +1234,12 @@
}
/**
- * Get a guard that checks if a {@link ScriptFunction} is equal to
- * a known ScriptFunction using reference comparison, and whether the type of
- * the second argument (this-object) is not a JavaScript primitive type.
+ * Get a guard that checks if a {@link ScriptFunction} is equal to a known
+ * ScriptFunction using reference comparison, and whether the type of the
+ * second argument (this-object) is not a JavaScript primitive type.
*
- * @param function The ScriptFunction to check against. This will be bound to the guard method handle
+ * @param function The ScriptFunction to check against. This will be bound
+ * to the guard method handle
*
* @return method handle for guard
*/
@@ -972,12 +1250,12 @@
@SuppressWarnings("unused")
private static boolean isFunctionMH(final Object self, final ScriptFunctionData data) {
- return self instanceof ScriptFunction && ((ScriptFunction)self).data == data;
+ return self instanceof ScriptFunction && ((ScriptFunction) self).data == data;
}
@SuppressWarnings("unused")
private static boolean isNonStrictFunction(final Object self, final Object arg, final ScriptFunctionData data) {
- return self instanceof ScriptFunction && ((ScriptFunction)self).data == data && arg instanceof ScriptObject;
+ return self instanceof ScriptFunction && ((ScriptFunction) self).data == data && arg instanceof ScriptObject;
}
//TODO this can probably be removed given that we have builtin switchpoints in the context
@@ -990,7 +1268,7 @@
@SuppressWarnings("unused")
private static Object[] addZerothElement(final Object[] args, final Object value) {
// extends input array with by adding new zeroth element
- final Object[] src = args == null? ScriptRuntime.EMPTY_ARRAY : args;
+ final Object[] src = args == null ? ScriptRuntime.EMPTY_ARRAY : args;
final Object[] result = new Object[src.length + 1];
System.arraycopy(src, 0, result, 1, src.length);
result[0] = value;
@@ -1014,4 +1292,3 @@
return MH.findVirtual(MethodHandles.lookup(), ScriptFunction.class, name, MH.type(rtype, types));
}
}
-
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptFunctionData.java Thu Sep 17 09:19:40 2015 -0700
@@ -151,7 +151,7 @@
* Is this a ScriptFunction generated with strict semantics?
* @return true if strict, false otherwise
*/
- public boolean isStrict() {
+ public final boolean isStrict() {
return (flags & IS_STRICT) != 0;
}
@@ -164,11 +164,11 @@
return getName();
}
- boolean isBuiltin() {
+ final boolean isBuiltin() {
return (flags & IS_BUILTIN) != 0;
}
- boolean isConstructor() {
+ final boolean isConstructor() {
return (flags & IS_CONSTRUCTOR) != 0;
}
@@ -179,7 +179,7 @@
* according to ECMA 10.4.3.
* @return true if this argument must be an object
*/
- boolean needsWrappedThis() {
+ final boolean needsWrappedThis() {
return (flags & USES_THIS) != 0 && (flags & IS_STRICT_OR_BUILTIN) == 0;
}
@@ -318,7 +318,7 @@
* Used to find an apply to call version that fits this callsite.
* We cannot just, as in the normal matcher case, return e.g. (Object, Object, int)
* for (Object, Object, int, int, int) or we will destroy the semantics and get
- * a function that, when padded with undefineds, behaves differently
+ * a function that, when padded with undefined values, behaves differently
* @param type actual call site type
* @return apply to call that perfectly fits this callsite or null if none found
*/
@@ -397,7 +397,7 @@
/**
* This method is used to create the immutable portion of a bound function.
- * See {@link ScriptFunction#makeBoundFunction(Object, Object[])}
+ * See {@link ScriptFunction#createBound(Object, Object[])}
*
* @param fn the original function being bound
* @param self this reference to bind. Can be null.
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/ScriptObject.java Thu Sep 17 09:19:40 2015 -0700
@@ -64,6 +64,7 @@
import java.util.List;
import java.util.Map;
import java.util.Set;
+import java.util.concurrent.atomic.LongAdder;
import jdk.internal.dynalink.CallSiteDescriptor;
import jdk.internal.dynalink.linker.GuardedInvocation;
import jdk.internal.dynalink.linker.LinkRequest;
@@ -211,7 +212,7 @@
*/
public ScriptObject(final PropertyMap map) {
if (Context.DEBUG) {
- ScriptObject.count++;
+ ScriptObject.count.increment();
}
this.arrayData = ArrayData.EMPTY_ARRAY;
this.setMap(map == null ? PropertyMap.newMap() : map);
@@ -2316,7 +2317,7 @@
MH.dropArguments(
MH.constant(
ScriptFunction.class,
- func.makeBoundFunction(thiz, new Object[] { name })),
+ func.createBound(thiz, new Object[] { name })),
0,
Object.class),
NashornGuards.combineGuards(
@@ -2422,7 +2423,7 @@
return UNDEFINED;
}
- return ((ScriptFunction)value).makeBoundFunction(this, new Object[] {name});
+ return ((ScriptFunction)value).createBound(this, new Object[] {name});
}
private GuardedInvocation createEmptyGetter(final CallSiteDescriptor desc, final boolean explicitInstanceOfCheck, final String name) {
@@ -3811,15 +3812,20 @@
}
/** This is updated only in debug mode - counts number of {@code ScriptObject} instances created */
- private static int count;
-
+ private static LongAdder count;
+
+ static {
+ if (Context.DEBUG) {
+ count = new LongAdder();
+ }
+ }
/**
* Get number of {@code ScriptObject} instances created. If not running in debug
* mode this is always 0
*
* @return number of ScriptObjects created
*/
- public static int getCount() {
- return count;
+ public static long getCount() {
+ return count.longValue();
}
}
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/StoredScript.java Thu Sep 17 09:19:40 2015 -0700
@@ -77,7 +77,7 @@
return compilationId;
}
- private Map<String, Class<?>> installClasses(final Source source, final CodeInstaller<ScriptEnvironment> installer) {
+ private Map<String, Class<?>> installClasses(final Source source, final CodeInstaller installer) {
final Map<String, Class<?>> installedClasses = new HashMap<>();
final byte[] mainClassBytes = classBytes.get(mainClassName);
final Class<?> mainClass = installer.install(mainClassName, mainClassBytes);
@@ -96,7 +96,7 @@
return installedClasses;
}
- FunctionInitializer installFunction(final RecompilableScriptFunctionData data, final CodeInstaller<ScriptEnvironment> installer) {
+ FunctionInitializer installFunction(final RecompilableScriptFunctionData data, final CodeInstaller installer) {
final Map<String, Class<?>> installedClasses = installClasses(data.getSource(), installer);
assert initializers != null;
@@ -124,7 +124,7 @@
* @param installer the installer
* @return main script class
*/
- Class<?> installScript(final Source source, final CodeInstaller<ScriptEnvironment> installer) {
+ Class<?> installScript(final Source source, final CodeInstaller installer) {
final Map<String, Class<?>> installedClasses = installClasses(source, installer);
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/WithObject.java Thu Sep 17 09:19:40 2015 -0700
@@ -352,7 +352,7 @@
}
private static Object bindToExpression(final ScriptFunction fn, final Object receiver) {
- return fn.makeBoundFunction(withFilterExpression(receiver), ScriptRuntime.EMPTY_ARRAY);
+ return fn.createBound(withFilterExpression(receiver), ScriptRuntime.EMPTY_ARRAY);
}
private MethodHandle expressionGuard(final String name, final ScriptObject owner) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/ContinuousArrayData.java Thu Sep 17 09:19:40 2015 -0700
@@ -191,7 +191,7 @@
/**
* Return element setter for a {@link ContinuousArrayData}
- * @param clazz clazz for exact type guard
+ * @param clazz class for exact type guard
* @param setHas set has guard
* @param elementType element type
* @return method handle for element setter
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/arrays/UndefinedArrayFilter.java Thu Sep 17 09:19:40 2015 -0700
@@ -34,7 +34,7 @@
* This filter handles the presence of undefined array elements.
*/
final class UndefinedArrayFilter extends ArrayFilter {
- /** Bit vector tracking undefines. */
+ /** Bit vector tracking undefined slots. */
private final BitVector undefined;
UndefinedArrayFilter(final ArrayData underlying) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/Bootstrap.java Thu Sep 17 09:19:40 2015 -0700
@@ -49,7 +49,6 @@
import jdk.nashorn.internal.codegen.CompilerConstants.Call;
import jdk.nashorn.internal.lookup.MethodHandleFactory;
import jdk.nashorn.internal.lookup.MethodHandleFunctionality;
-import jdk.nashorn.internal.objects.ScriptFunctionImpl;
import jdk.nashorn.internal.runtime.ECMAException;
import jdk.nashorn.internal.runtime.JSType;
import jdk.nashorn.internal.runtime.OptimisticReturnFilters;
@@ -396,8 +395,8 @@
* @throws ECMAException with {@code TypeError} if the object is not a callable.
*/
public static Object bindCallable(final Object callable, final Object boundThis, final Object[] boundArgs) {
- if (callable instanceof ScriptFunctionImpl) {
- return ((ScriptFunctionImpl)callable).makeBoundFunction(boundThis, boundArgs);
+ if (callable instanceof ScriptFunction) {
+ return ((ScriptFunction)callable).createBound(boundThis, boundArgs);
} else if (callable instanceof BoundCallable) {
return ((BoundCallable)callable).bind(boundArgs);
} else if (isCallable(callable)) {
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/LinkerCallSite.java Thu Sep 17 09:19:40 2015 -0700
@@ -43,6 +43,7 @@
import java.util.Random;
import java.util.Set;
import java.util.concurrent.atomic.AtomicInteger;
+import java.util.concurrent.atomic.LongAdder;
import jdk.internal.dynalink.ChainedCallSite;
import jdk.internal.dynalink.DynamicLinker;
import jdk.internal.dynalink.linker.GuardedInvocation;
@@ -70,7 +71,7 @@
LinkerCallSite(final NashornCallSiteDescriptor descriptor) {
super(descriptor);
if (Context.DEBUG) {
- LinkerCallSite.count++;
+ LinkerCallSite.count.increment();
}
}
@@ -173,7 +174,7 @@
* @return self reference
*/
public static Object increaseMissCount(final String desc, final Object self) {
- ++missCount;
+ missCount.increment();
if (r.nextInt(100) < missSamplingPercentage) {
final AtomicInteger i = missCounts.get(desc);
if (i == null) {
@@ -509,12 +510,19 @@
}
// counters updated in debug mode
- private static int count;
+ private static LongAdder count;
private static final HashMap<String, AtomicInteger> missCounts = new HashMap<>();
- private static int missCount;
+ private static LongAdder missCount;
private static final Random r = new Random();
private static final int missSamplingPercentage = Options.getIntProperty("nashorn.tcs.miss.samplePercent", 1);
+ static {
+ if (Context.DEBUG) {
+ count = new LongAdder();
+ missCount = new LongAdder();
+ }
+ }
+
@Override
protected int getMaxChainLength() {
return 8;
@@ -524,16 +532,16 @@
* Get the callsite count
* @return the count
*/
- public static int getCount() {
- return count;
+ public static long getCount() {
+ return count.longValue();
}
/**
* Get the callsite miss count
* @return the missCount
*/
- public static int getMissCount() {
- return missCount;
+ public static long getMissCount() {
+ return missCount.longValue();
}
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/linker/NashornBeansLinker.java Thu Sep 17 09:19:40 2015 -0700
@@ -26,7 +26,6 @@
package jdk.nashorn.internal.runtime.linker;
import static jdk.nashorn.internal.lookup.Lookup.MH;
-import static jdk.nashorn.internal.runtime.ECMAErrors.typeError;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.MethodHandles;
@@ -42,13 +41,11 @@
import jdk.internal.dynalink.linker.LinkerServices;
import jdk.internal.dynalink.linker.MethodHandleTransformer;
import jdk.internal.dynalink.support.DefaultInternalObjectFilter;
-import jdk.internal.dynalink.support.Guards;
import jdk.internal.dynalink.support.Lookup;
import jdk.nashorn.api.scripting.ScriptUtils;
import jdk.nashorn.internal.runtime.ConsString;
import jdk.nashorn.internal.runtime.Context;
import jdk.nashorn.internal.runtime.ScriptObject;
-import jdk.nashorn.internal.runtime.ScriptRuntime;
import jdk.nashorn.internal.runtime.options.Options;
/**
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Config.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/regexp/joni/Config.java Thu Sep 17 09:19:40 2015 -0700
@@ -65,7 +65,7 @@
final boolean DONT_OPTIMIZE = false;
- final boolean USE_STRING_TEMPLATES = true; // use embeded string templates in Regex object as byte arrays instead of compiling them into int bytecode array
+ final boolean USE_STRING_TEMPLATES = true; // use embedded string templates in Regex object as byte arrays instead of compiling them into int bytecode array
final boolean NON_UNICODE_SDW = true;
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/parser.js Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/runtime/resources/parser.js Thu Sep 17 09:19:40 2015 -0700
@@ -55,7 +55,7 @@
// do not start with '/'. If regexp, then eval it to make RegExp object
return value.startsWith('/')? eval(value) : value.substring(1);
} else {
- // anythin else is returned "as is""
+ // anything else is returned "as is"
return value;
}
});
--- a/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/Shell.java Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/tools/Shell.java Thu Sep 17 09:19:40 2015 -0700
@@ -42,8 +42,8 @@
import jdk.nashorn.api.scripting.NashornException;
import jdk.nashorn.internal.codegen.Compiler;
import jdk.nashorn.internal.codegen.Compiler.CompilationPhases;
+import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.FunctionNode;
-import jdk.nashorn.internal.ir.Expression;
import jdk.nashorn.internal.ir.debug.ASTWriter;
import jdk.nashorn.internal.ir.debug.PrintVisitor;
import jdk.nashorn.internal.objects.Global;
@@ -255,12 +255,9 @@
return COMPILATION_ERROR;
}
- new Compiler(
+ Compiler.forNoInstallerCompilation(
context,
- env,
- null, //null - pass no code installer - this is compile only
functionNode.getSource(),
- context.getErrorManager(),
env._strict | functionNode.isStrict()).
compile(functionNode, CompilationPhases.COMPILE_ALL_NO_INSTALL);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8134569.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,128 @@
+/*
+ * 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.
+ */
+
+/**
+ * JDK-8134569: Add tests for prototype callsites
+ *
+ * @test
+ * @run
+ */
+
+function create() {
+ function C() {
+ this.i1 = 1;
+ this.i2 = 2;
+ this.i3 = 3;
+ return this;
+ }
+ return new C();
+}
+
+function createEmpty() {
+ function C() {
+ return this;
+ }
+ return new C();
+}
+
+function createDeep() {
+ function C() {
+ this.i1 = 1;
+ this.i2 = 2;
+ this.i3 = 3;
+ return this;
+ }
+ function D() {
+ this.p1 = 1;
+ this.p2 = 2;
+ this.p3 = 3;
+ return this;
+ }
+ C.prototype = new D();
+ return new C();
+}
+
+function createEval() {
+ return eval("Object.create({})");
+}
+
+function p(o) { print(o.x) }
+
+var a, b;
+
+create();
+a = create();
+b = create();
+a.__proto__.x = 123;
+
+p(a);
+p(b);
+
+a = create();
+b = create();
+b.__proto__.x = 123;
+
+p(a);
+p(b);
+
+a = createEmpty();
+b = createEmpty();
+a.__proto__.x = 123;
+
+p(a);
+p(b);
+
+a = createEmpty();
+b = createEmpty();
+b.__proto__.x = 123;
+
+p(a);
+p(b);
+
+a = createDeep();
+b = createDeep();
+a.__proto__.__proto__.x = 123;
+
+p(a);
+p(b);
+
+a = createDeep();
+b = createDeep();
+b.__proto__.__proto__.x = 123;
+
+p(a);
+p(b);
+
+a = createEval();
+b = createEval();
+a.__proto__.x = 123;
+
+p(a);
+p(b);
+
+a = createEval();
+b = createEval();
+b.__proto__.x = 123;
+
+p(a);
+p(b);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8134569.js.EXPECTED Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,16 @@
+123
+undefined
+undefined
+123
+123
+undefined
+undefined
+123
+123
+undefined
+undefined
+123
+123
+undefined
+undefined
+123
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8135000.js Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,48 @@
+/*
+ * 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.
+ */
+
+/**
+ * JDK-8135000: Number.prototype.toFixed returns wrong string for 0.5 and -0.5
+ *
+ * @test
+ * @run
+ */
+
+print(-2.6.toFixed());
+print(-2.5.toFixed());
+print(-2.4.toFixed());
+print(-1.6.toFixed());
+print(-1.5.toFixed());
+print(-1.4.toFixed());
+print(-0.6.toFixed());
+print(-0.5.toFixed());
+print(-0.4.toFixed());
+print(0.4.toFixed());
+print(0.5.toFixed());
+print(0.6.toFixed());
+print(1.4.toFixed());
+print(1.5.toFixed());
+print(1.6.toFixed());
+print(2.4.toFixed());
+print(2.5.toFixed());
+print(2.6.toFixed());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/nashorn/test/script/basic/JDK-8135000.js.EXPECTED Thu Sep 17 09:19:40 2015 -0700
@@ -0,0 +1,18 @@
+-3
+-3
+-2
+-2
+-2
+-1
+-1
+-1
+0
+0
+1
+1
+1
+2
+2
+2
+3
+3
--- a/nashorn/test/script/trusted/JDK-8006529.js Tue Sep 15 15:49:30 2015 +0200
+++ b/nashorn/test/script/trusted/JDK-8006529.js Thu Sep 17 09:19:40 2015 -0700
@@ -120,7 +120,7 @@
var sourceForMethod = Source.class.getMethod("sourceFor", java.lang.String.class, java.lang.String.class)
var ParserConstructor = Parser.class.getConstructor(ScriptEnvironment.class, Source.class, ErrorManager.class)
-var CompilerConstructor = Compiler.class.getConstructor(Context.class, ScriptEnvironment.class, CodeInstaller.class, Source.class, ErrorManager.class, boolean.class);
+var CompilerConstructor = Compiler.class.getMethod("forNoInstallerCompilation", Context.class, Source.class, boolean.class);
// compile(script) -- compiles a script specified as a string with its
// source code, returns a jdk.nashorn.internal.ir.FunctionNode object
@@ -134,7 +134,7 @@
var parser = ParserConstructor.newInstance(env, source, ThrowErrorManager.class.newInstance());
var func = parseMethod.invoke(parser);
- var compiler = CompilerConstructor.newInstance(ctxt, env, null, source, null, false);
+ var compiler = CompilerConstructor.invoke(null, ctxt, source, false);
return compileMethod.invoke(compiler, func, phases);
};