--- a/.hgtags Fri Oct 19 11:15:57 2018 -0700
+++ b/.hgtags Tue Oct 16 23:21:05 2018 +0530
@@ -518,3 +518,4 @@
8897e41b327c0a5601c6ba2bba5d07f15a3ffc91 jdk-12+14
6f04692c7d5137ee34a6bd94c0c8a6c9219cb127 jdk-12+14
f8626bcc169813a4b2a15880386b952719d1d6d1 jdk-12+15
+199658d1ef860cdc17055b4fd3e94b057f292fe9 jdk-12+16
--- a/make/CompileToolsJdk.gmk Fri Oct 19 11:15:57 2018 -0700
+++ b/make/CompileToolsJdk.gmk Tue Oct 16 23:21:05 2018 +0530
@@ -46,6 +46,7 @@
SETUP := GENERATE_OLDBYTECODE, \
SRC := $(BUILD_TOOLS_SRC_DIRS), \
EXCLUDES := \
+ build/tools/classlist \
build/tools/deps \
build/tools/docs \
build/tools/jigsaw \
--- a/make/GenerateLinkOptData.gmk Fri Oct 19 11:15:57 2018 -0700
+++ b/make/GenerateLinkOptData.gmk Tue Oct 16 23:21:05 2018 +0530
@@ -31,15 +31,17 @@
include $(SPEC)
include MakeBase.gmk
-include JarArchive.gmk
+include SetupJavaCompilers.gmk
################################################################################
# Create a jar with our generator class. Using a jar is intentional since it
# will load more classes
-$(eval $(call SetupJarArchive, CLASSLIST_JAR, \
- SRCS := $(BUILDTOOLS_OUTPUTDIR)/jdk_tools_classes, \
+$(eval $(call SetupJavaCompilation, CLASSLIST_JAR, \
+ SETUP := GENERATE_JDKBYTECODE, \
+ SRC := $(TOPDIR)/make/jdk/src/classes, \
INCLUDES := build/tools/classlist, \
+ BIN := $(BUILDTOOLS_OUTPUTDIR)/classlist_classes, \
JAR := $(SUPPORT_OUTPUTDIR)/classlist.jar, \
))
--- a/make/common/MakeBase.gmk Fri Oct 19 11:15:57 2018 -0700
+++ b/make/common/MakeBase.gmk Tue Oct 16 23:21:05 2018 +0530
@@ -656,8 +656,11 @@
# String equals
equals = \
- $(and $(findstring $(strip $1),$(strip $2)),\
- $(findstring $(strip $2),$(strip $1)))
+ $(if $(strip $1)$(strip $2),$(strip \
+ $(and $(findstring $(strip $1),$(strip $2)),\
+ $(findstring $(strip $2),$(strip $1)))), \
+ true \
+ )
# Remove a whole list of prefixes
# $1 - List of prefixes
--- a/make/common/NativeCompilation.gmk Fri Oct 19 11:15:57 2018 -0700
+++ b/make/common/NativeCompilation.gmk Tue Oct 16 23:21:05 2018 +0530
@@ -67,7 +67,6 @@
# Param 2: Working directory
# Param 3: Source file
# Param 4: Compile command
-# Param 5: Object name
################################################################################
define WriteCompileCommandsFragment
$(call LogInfo, Creating compile commands fragment for $(notdir $3))
@@ -76,8 +75,7 @@
"directory": "$(strip $2)"$(COMMA) \
"file": "$(strip $3)"$(COMMA) \
"command": "$(strip $(subst $(DQUOTE),\$(DQUOTE),$(subst \,\\,\
- $(subst $(FIXPATH),,$4))))"$(COMMA) \
- "output": "$(strip $5)" \
+ $(subst $(FIXPATH),,$4))))" \
}$(COMMA), \
$1)
endef
@@ -331,7 +329,7 @@
$$($1_OBJ_JSON): $$($1_OBJ_DEPS)
$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$($1_SRC_FILE), \
- $$($1_COMPILER) $$($1_COMPILE_OPTIONS), $$($1_OBJ))
+ $$($1_COMPILER) $$($1_COMPILE_OPTIONS))
$$($1_OBJ): $$($1_OBJ_DEPS) | $$($$($1_BASE)_BUILD_INFO)
$$(call LogInfo, Compiling $$($1_FILENAME) (for $$($$($1_BASE)_BASENAME)))
@@ -744,7 +742,7 @@
$$($1_PCH_FILE_JSON): $$($1_PRECOMPILED_HEADER) $$($1_COMPILE_VARDEPS_FILE)
$$(call WriteCompileCommandsFragment, $$@, $$(PWD), $$<, \
- $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE), $$($1_PCH_FILE))
+ $$($1_PCH_COMMAND) $$< -o $$($1_PCH_FILE))
endif
endif
endif
--- a/make/jdk/src/classes/build/tools/classlist/HelloClasslist.java Fri Oct 19 11:15:57 2018 -0700
+++ b/make/jdk/src/classes/build/tools/classlist/HelloClasslist.java Tue Oct 16 23:21:05 2018 +0530
@@ -66,6 +66,15 @@
Stream.of(helloWorld.split(","))
.forEach(System.out::println);
+ // Common concatenation patterns
+ String const_I = "string" + args.length;
+ String const_S = "string" + String.valueOf(args.length);
+ String S_const = String.valueOf(args.length) + "string";
+ String S_S = String.valueOf(args.length) + String.valueOf(args.length);
+ String const_J = "string" + System.currentTimeMillis();
+ String I_const = args.length + "string";
+ String J_const = System.currentTimeMillis() + "string";
+
String newDate = DateTimeFormatter.ISO_LOCAL_DATE_TIME.format(
LocalDateTime.now(ZoneId.of("GMT")));
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/aarch64/gc/shared/barrierSetNMethod_aarch64.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+ ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+ ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+ ShouldNotReachHere();
+ return false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/arm/gc/shared/barrierSetNMethod_arm.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+ ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+ ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+ ShouldNotReachHere();
+ return false;
+}
--- a/src/hotspot/cpu/arm/vm_version_arm.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/arm/vm_version_arm.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -110,7 +110,6 @@
static bool supports_kuser_cmpxchg64() { return _kuser_helper_version >= KUSER_VERSION_CMPXCHG64; }
// Override Abstract_VM_Version implementation
static bool use_biased_locking();
- static const char* vm_info_string();
static bool has_vfp() { return (_features & vfp_m) != 0; }
static bool has_vfp3_32() { return (_features & vfp3_32_m) != 0; }
--- a/src/hotspot/cpu/arm/vm_version_arm_32.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/arm/vm_version_arm_32.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -318,20 +318,3 @@
//
return (!os::is_MP() && (arm_arch() > 5)) ? false : true;
}
-
-#define EXP
-
-// Temporary override for experimental features
-// Copied from Abstract_VM_Version
-const char* VM_Version::vm_info_string() {
- switch (Arguments::mode()) {
- case Arguments::_int:
- return UseSharedSpaces ? "interpreted mode, sharing" EXP : "interpreted mode" EXP;
- case Arguments::_mixed:
- return UseSharedSpaces ? "mixed mode, sharing" EXP : "mixed mode" EXP;
- case Arguments::_comp:
- return UseSharedSpaces ? "compiled mode, sharing" EXP : "compiled mode" EXP;
- };
- ShouldNotReachHere();
- return "";
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/ppc/gc/shared/barrierSetNMethod_ppc.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+ ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+ ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+ ShouldNotReachHere();
+ return false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/s390/gc/shared/barrierSetNMethod_s390.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+ ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+ ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+ ShouldNotReachHere();
+ return false;
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/sparc/gc/shared/barrierSetNMethod_sparc.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+ ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+ ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+ ShouldNotReachHere();
+ return false;
+}
--- a/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/c1_MacroAssembler_x86.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -26,6 +26,8 @@
#include "c1/c1_MacroAssembler.hpp"
#include "c1/c1_Runtime1.hpp"
#include "classfile/systemDictionary.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/barrierSetAssembler.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "interpreter/interpreter.hpp"
#include "oops/arrayOop.hpp"
@@ -330,6 +332,9 @@
}
#endif // TIERED
decrement(rsp, frame_size_in_bytes); // does not emit code for frame_size == 0
+
+ BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+ bs->nmethod_entry_barrier(this);
}
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -23,7 +23,9 @@
*/
#include "precompiled.hpp"
+#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "interpreter/interp_masm.hpp"
#include "runtime/jniHandles.hpp"
@@ -322,3 +324,22 @@
__ adcl(Address(thread, in_bytes(JavaThread::allocated_bytes_offset())+4), 0);
#endif
}
+
+void BarrierSetAssembler::nmethod_entry_barrier(MacroAssembler* masm) {
+ BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+ if (bs_nm == NULL) {
+ return;
+ }
+#ifndef _LP64
+ ShouldNotReachHere();
+#else
+ Label continuation;
+ Register thread = LP64_ONLY(r15_thread);
+ Address disarmed_addr(thread, in_bytes(bs_nm->thread_disarmed_offset()));
+ __ align(8);
+ __ cmpl(disarmed_addr, 0);
+ __ jcc(Assembler::equal, continuation);
+ __ call(RuntimeAddress(StubRoutines::x86::method_entry_barrier()));
+ __ bind(continuation);
+#endif
+}
--- a/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetAssembler_x86.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -83,6 +83,8 @@
Label& slow_case);
virtual void barrier_stubs_init() {}
+
+ virtual void nmethod_entry_barrier(MacroAssembler* masm);
};
#endif // CPU_X86_GC_SHARED_BARRIERSETASSEMBLER_X86_HPP
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/x86/gc/shared/barrierSetNMethod_x86.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,155 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "code/codeCache.hpp"
+#include "code/nativeInst.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "logging/log.hpp"
+#include "memory/resourceArea.hpp"
+#include "runtime/sharedRuntime.hpp"
+#include "runtime/thread.hpp"
+#include "utilities/align.hpp"
+#include "utilities/debug.hpp"
+
+class NativeNMethodCmpBarrier: public NativeInstruction {
+public:
+ enum Intel_specific_constants {
+ instruction_code = 0x81,
+ instruction_size = 8,
+ imm_offset = 4,
+ instruction_rex_prefix = Assembler::REX | Assembler::REX_B,
+ instruction_modrm = 0x7f // [r15 + offset]
+ };
+
+ address instruction_address() const { return addr_at(0); }
+ address immediate_address() const { return addr_at(imm_offset); }
+
+ jint get_immedate() const { return int_at(imm_offset); }
+ void set_immediate(jint imm) { set_int_at(imm_offset, imm); }
+ void verify() const;
+};
+
+void NativeNMethodCmpBarrier::verify() const {
+ if (((uintptr_t) instruction_address()) & 0x7) {
+ fatal("Not properly aligned");
+ }
+
+ int prefix = ubyte_at(0);
+ if (prefix != instruction_rex_prefix) {
+ tty->print_cr("Addr: " INTPTR_FORMAT " Prefix: 0x%x", p2i(instruction_address()),
+ prefix);
+ fatal("not a cmp barrier");
+ }
+
+ int inst = ubyte_at(1);
+ if (inst != instruction_code) {
+ tty->print_cr("Addr: " INTPTR_FORMAT " Code: 0x%x", p2i(instruction_address()),
+ inst);
+ fatal("not a cmp barrier");
+ }
+
+ int modrm = ubyte_at(2);
+ if (modrm != instruction_modrm) {
+ tty->print_cr("Addr: " INTPTR_FORMAT " mod/rm: 0x%x", p2i(instruction_address()),
+ modrm);
+ fatal("not a cmp barrier");
+ }
+}
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+ /*
+ * [ callers frame ]
+ * [ callers return address ] <- callers rsp
+ * [ callers rbp ] <- callers rbp
+ * [ callers frame slots ]
+ * [ return_address ] <- return_address_ptr
+ * [ cookie ] <- used to write the new rsp (callers rsp)
+ * [ stub rbp ]
+ * [ stub stuff ]
+ */
+
+ address* stub_rbp = return_address_ptr - 2;
+ address* callers_rsp = return_address_ptr + nm->frame_size(); /* points to callers return_address now */
+ address* callers_rbp = callers_rsp - 1; // 1 to move to the callers return address, 1 more to move to the rbp
+ address* cookie = return_address_ptr - 1;
+
+ LogTarget(Trace, nmethod, barrier) out;
+ if (out.is_enabled()) {
+ Thread* thread = Thread::current();
+ assert(thread->is_Java_thread(), "must be JavaThread");
+ JavaThread* jth = (JavaThread*) thread;
+ ResourceMark mark;
+ log_trace(nmethod, barrier)("deoptimize(nmethod: %p, return_addr: %p, osr: %d, thread: %p(%s), making rsp: %p) -> %p",
+ nm, (address *) return_address_ptr, nm->is_osr_method(), jth,
+ jth->get_thread_name(), callers_rsp, nm->verified_entry_point());
+ }
+
+ assert(nm->frame_size() >= 3, "invariant");
+ assert(*cookie == (address) -1, "invariant");
+
+ // Preserve caller rbp.
+ *stub_rbp = *callers_rbp;
+
+ // At the cookie address put the callers rsp.
+ *cookie = (address) callers_rsp; // should point to the return address
+
+ // In the slot that used to be the callers rbp we put the address that our stub needs to jump to at the end.
+ // Overwriting the caller rbp should be okay since our stub rbp has the same value.
+ address* jmp_addr_ptr = callers_rbp;
+ *jmp_addr_ptr = SharedRuntime::get_handle_wrong_method_stub();
+}
+
+// This is the offset of the entry barrier from where the frame is completed.
+// If any code changes between the end of the verified entry where the entry
+// barrier resides, and the completion of the frame, then
+// NativeNMethodCmpBarrier::verify() will immediately complain when it does
+// not find the expected native instruction at this offset, which needs updating.
+// Note that this offset is invariant of PreserveFramePointer.
+static const int entry_barrier_offset = -19;
+
+static NativeNMethodCmpBarrier* native_nmethod_barrier(nmethod* nm) {
+ address barrier_address = nm->code_begin() + nm->frame_complete_offset() + entry_barrier_offset;
+ NativeNMethodCmpBarrier* barrier = reinterpret_cast<NativeNMethodCmpBarrier*>(barrier_address);
+ debug_only(barrier->verify());
+ return barrier;
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+ if (!supports_entry_barrier(nm)) {
+ return;
+ }
+
+ NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm);
+ cmp->set_immediate(disarmed_value());
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+ if (!supports_entry_barrier(nm)) {
+ return false;
+ }
+
+ NativeNMethodCmpBarrier* cmp = native_nmethod_barrier(nm);
+ return (disarmed_value() != cmp->get_immedate());
+}
--- a/src/hotspot/cpu/x86/macroAssembler_x86.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -5453,7 +5453,7 @@
#endif // _LP64
// C2 compiled method's prolog code.
-void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b) {
+void MacroAssembler::verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b, bool is_stub) {
// WARNING: Initial instruction MUST be 5 bytes or longer so that
// NativeJump::patch_verified_entry will be able to patch out the entry
@@ -5535,6 +5535,10 @@
}
#endif
+ if (!is_stub) {
+ BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+ bs->nmethod_entry_barrier(this);
+ }
}
// clear memory of size 'cnt' qwords, starting at 'base' using XMM/YMM registers
--- a/src/hotspot/cpu/x86/macroAssembler_x86.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/macroAssembler_x86.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -1588,7 +1588,7 @@
void movl2ptr(Register dst, Register src) { LP64_ONLY(movslq(dst, src)) NOT_LP64(if (dst != src) movl(dst, src)); }
// C2 compiled method's prolog code.
- void verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b);
+ void verified_entry(int framesize, int stack_bang_size, bool fp_mode_24b, bool is_stub);
// clear memory of size 'cnt' qwords, starting at 'base';
// if 'is_large' is set, do not try to produce short loop
--- a/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -34,6 +34,8 @@
#include "code/vtableStubs.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "gc/shared/gcLocker.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/barrierSetAssembler.hpp"
#include "interpreter/interpreter.hpp"
#include "logging/log.hpp"
#include "memory/resourceArea.hpp"
@@ -2160,6 +2162,9 @@
// -2 because return address is already present and so is saved rbp
__ subptr(rsp, stack_size - 2*wordSize);
+ BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
+ bs->nmethod_entry_barrier(masm);
+
// Frame is now completed as far as size and linkage.
int frame_complete = ((intptr_t)__ pc()) - start;
--- a/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/stubGenerator_x86_64.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -28,6 +28,7 @@
#include "ci/ciUtilities.hpp"
#include "gc/shared/barrierSet.hpp"
#include "gc/shared/barrierSetAssembler.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
#include "interpreter/interpreter.hpp"
#include "nativeInst_x86.hpp"
#include "oops/instanceOop.hpp"
@@ -5194,6 +5195,83 @@
return start;
}
+ address generate_method_entry_barrier() {
+ __ align(CodeEntryAlignment);
+ StubCodeMark mark(this, "StubRoutines", "nmethod_entry_barrier");
+
+ Label deoptimize_label;
+
+ address start = __ pc();
+
+ __ push(-1); // cookie, this is used for writing the new rsp when deoptimizing
+
+ BLOCK_COMMENT("Entry:");
+ __ enter(); // save rbp
+
+ // save c_rarg0, because we want to use that value.
+ // We could do without it but then we depend on the number of slots used by pusha
+ __ push(c_rarg0);
+
+ __ lea(c_rarg0, Address(rsp, wordSize * 3)); // 1 for cookie, 1 for rbp, 1 for c_rarg0 - this should be the return address
+
+ __ pusha();
+
+ // The method may have floats as arguments, and we must spill them before calling
+ // the VM runtime.
+ assert(Argument::n_float_register_parameters_j == 8, "Assumption");
+ const int xmm_size = wordSize * 2;
+ const int xmm_spill_size = xmm_size * Argument::n_float_register_parameters_j;
+ __ subptr(rsp, xmm_spill_size);
+ __ movdqu(Address(rsp, xmm_size * 7), xmm7);
+ __ movdqu(Address(rsp, xmm_size * 6), xmm6);
+ __ movdqu(Address(rsp, xmm_size * 5), xmm5);
+ __ movdqu(Address(rsp, xmm_size * 4), xmm4);
+ __ movdqu(Address(rsp, xmm_size * 3), xmm3);
+ __ movdqu(Address(rsp, xmm_size * 2), xmm2);
+ __ movdqu(Address(rsp, xmm_size * 1), xmm1);
+ __ movdqu(Address(rsp, xmm_size * 0), xmm0);
+
+ __ call_VM_leaf(CAST_FROM_FN_PTR(address, static_cast<int (*)(address*)>(BarrierSetNMethod::nmethod_stub_entry_barrier)), 1);
+
+ __ movdqu(xmm0, Address(rsp, xmm_size * 0));
+ __ movdqu(xmm1, Address(rsp, xmm_size * 1));
+ __ movdqu(xmm2, Address(rsp, xmm_size * 2));
+ __ movdqu(xmm3, Address(rsp, xmm_size * 3));
+ __ movdqu(xmm4, Address(rsp, xmm_size * 4));
+ __ movdqu(xmm5, Address(rsp, xmm_size * 5));
+ __ movdqu(xmm6, Address(rsp, xmm_size * 6));
+ __ movdqu(xmm7, Address(rsp, xmm_size * 7));
+ __ addptr(rsp, xmm_spill_size);
+
+ __ cmpl(rax, 1); // 1 means deoptimize
+ __ jcc(Assembler::equal, deoptimize_label);
+
+ __ popa();
+ __ pop(c_rarg0);
+
+ __ leave();
+
+ __ addptr(rsp, 1 * wordSize); // cookie
+ __ ret(0);
+
+
+ __ BIND(deoptimize_label);
+
+ __ popa();
+ __ pop(c_rarg0);
+
+ __ leave();
+
+ // this can be taken out, but is good for verification purposes. getting a SIGSEGV
+ // here while still having a correct stack is valuable
+ __ testptr(rsp, Address(rsp, 0));
+
+ __ movptr(rsp, Address(rsp, 0)); // new rsp was written in the barrier
+ __ jmp(Address(rsp, -1 * wordSize)); // jmp target should be callers verified_entry_point
+
+ return start;
+ }
+
/**
* Arguments:
*
@@ -5831,6 +5909,11 @@
generate_safefetch("SafeFetchN", sizeof(intptr_t), &StubRoutines::_safefetchN_entry,
&StubRoutines::_safefetchN_fault_pc,
&StubRoutines::_safefetchN_continuation_pc);
+
+ BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+ if (bs_nm != NULL) {
+ StubRoutines::x86::_method_entry_barrier = generate_method_entry_barrier();
+ }
#ifdef COMPILER2
if (UseMultiplyToLenIntrinsic) {
StubRoutines::_multiplyToLen = generate_multiplyToLen();
--- a/src/hotspot/cpu/x86/stubRoutines_x86.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/stubRoutines_x86.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -55,8 +55,14 @@
static address _double_sign_mask;
static address _double_sign_flip;
+ static address _method_entry_barrier;
+
public:
+ static address method_entry_barrier() {
+ return _method_entry_barrier;
+ }
+
static address get_previous_fp_entry() {
return _get_previous_fp_entry;
}
--- a/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/stubRoutines_x86_64.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -42,3 +42,4 @@
address StubRoutines::x86::_float_sign_flip = NULL;
address StubRoutines::x86::_double_sign_mask = NULL;
address StubRoutines::x86::_double_sign_flip = NULL;
+address StubRoutines::x86::_method_entry_barrier = NULL;
--- a/src/hotspot/cpu/x86/x86_32.ad Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/x86_32.ad Tue Oct 16 23:21:05 2018 +0530
@@ -619,7 +619,7 @@
int framesize = C->frame_size_in_bytes();
int bangsize = C->bang_size_in_bytes();
- __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, C->in_24_bit_fp_mode());
+ __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, C->in_24_bit_fp_mode(), C->stub_function() != NULL);
C->set_frame_complete(cbuf.insts_size());
--- a/src/hotspot/cpu/x86/x86_64.ad Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/cpu/x86/x86_64.ad Tue Oct 16 23:21:05 2018 +0530
@@ -890,6 +890,15 @@
st->print("# stack alignment check");
#endif
}
+ if (C->stub_function() != NULL && BarrierSet::barrier_set()->barrier_set_nmethod() != NULL) {
+ st->print("\n\t");
+ st->print("cmpl [r15_thread + #disarmed_offset], #disarmed_value\t");
+ st->print("\n\t");
+ st->print("je fast_entry\t");
+ st->print("\n\t");
+ st->print("call #nmethod_entry_barrier_stub\t");
+ st->print("\n\tfast_entry:");
+ }
st->cr();
}
#endif
@@ -901,7 +910,7 @@
int framesize = C->frame_size_in_bytes();
int bangsize = C->bang_size_in_bytes();
- __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false);
+ __ verified_entry(framesize, C->need_stack_bang(bangsize)?bangsize:0, false, C->stub_function() != NULL);
C->set_frame_complete(cbuf.insts_size());
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/cpu/zero/gc/shared/barrierSetNMethod_zero.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,40 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "utilities/debug.hpp"
+
+void BarrierSetNMethod::deoptimize(nmethod* nm, address* return_address_ptr) {
+ ShouldNotReachHere();
+}
+
+void BarrierSetNMethod::disarm(nmethod* nm) {
+ ShouldNotReachHere();
+}
+
+bool BarrierSetNMethod::is_armed(nmethod* nm) {
+ ShouldNotReachHere();
+ return false;
+}
--- a/src/hotspot/share/aot/aotLoader.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/aot/aotLoader.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -137,6 +137,12 @@
return;
}
+#ifdef _WINDOWS
+ const char pathSep = ';';
+#else
+ const char pathSep = ':';
+#endif
+
// Scan the AOTLibrary option.
if (AOTLibrary != NULL) {
const int len = (int)strlen(AOTLibrary);
@@ -147,7 +153,7 @@
char* end = cp + len;
while (cp < end) {
const char* name = cp;
- while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != ':' && (*cp) != ';') cp++;
+ while ((*cp) != '\0' && (*cp) != '\n' && (*cp) != ',' && (*cp) != pathSep) cp++;
cp[0] = '\0'; // Terminate name
cp++;
load_library(name, true);
--- a/src/hotspot/share/ci/ciEnv.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/ci/ciEnv.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -77,7 +77,7 @@
ciObject* ciEnv::_null_object_instance;
-#define WK_KLASS_DEFN(name, ignore_s, ignore_o) ciInstanceKlass* ciEnv::_##name = NULL;
+#define WK_KLASS_DEFN(name, ignore_s) ciInstanceKlass* ciEnv::_##name = NULL;
WK_KLASSES_DO(WK_KLASS_DEFN)
#undef WK_KLASS_DEFN
--- a/src/hotspot/share/ci/ciEnv.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/ci/ciEnv.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -82,7 +82,7 @@
// Distinguished instances of certain ciObjects..
static ciObject* _null_object_instance;
-#define WK_KLASS_DECL(name, ignore_s, ignore_o) static ciInstanceKlass* _##name;
+#define WK_KLASS_DECL(name, ignore_s) static ciInstanceKlass* _##name;
WK_KLASSES_DO(WK_KLASS_DECL)
#undef WK_KLASS_DECL
@@ -374,7 +374,7 @@
// Access to certain well known ciObjects.
-#define WK_KLASS_FUNC(name, ignore_s, ignore_o) \
+#define WK_KLASS_FUNC(name, ignore_s) \
ciInstanceKlass* name() { \
return _##name;\
}
--- a/src/hotspot/share/ci/ciObjectFactory.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/ci/ciObjectFactory.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -157,8 +157,8 @@
ciEnv::_null_object_instance = new (_arena) ciNullObject();
init_ident_of(ciEnv::_null_object_instance);
-#define WK_KLASS_DEFN(name, ignore_s, opt) \
- if (SystemDictionary::name() != NULL) \
+#define WK_KLASS_DEFN(name, ignore_s) \
+ if (SystemDictionary::name##_is_loaded()) \
ciEnv::_##name = get_metadata(SystemDictionary::name())->as_instance_klass();
WK_KLASSES_DO(WK_KLASS_DEFN)
--- a/src/hotspot/share/classfile/classLoader.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/classLoader.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -163,7 +163,7 @@
static char version_string[10] = "";
if (version_string[0] == '\0') {
jio_snprintf(version_string, sizeof(version_string), "%d.%d",
- Abstract_VM_Version::vm_major_version(), Abstract_VM_Version::vm_minor_version());
+ VM_Version::vm_major_version(), VM_Version::vm_minor_version());
}
return (const char*)version_string;
}
--- a/src/hotspot/share/classfile/classLoaderData.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -139,7 +139,7 @@
// it from being unloaded during parsing of the unsafe anonymous class.
// The null-class-loader should always be kept alive.
_keep_alive((is_unsafe_anonymous || h_class_loader.is_null()) ? 1 : 0),
- _claimed(0),
+ _claim(0),
_handles(),
_klasses(NULL), _packages(NULL), _modules(NULL), _unnamed_module(NULL), _dictionary(NULL),
_jmethod_ids(NULL),
@@ -268,12 +268,17 @@
}
#endif // PRODUCT
-bool ClassLoaderData::claim() {
- if (_claimed == 1) {
- return false;
+bool ClassLoaderData::try_claim(int claim) {
+ for (;;) {
+ int old_claim = Atomic::load(&_claim);
+ if ((old_claim & claim) == claim) {
+ return false;
+ }
+ int new_claim = old_claim | claim;
+ if (Atomic::cmpxchg(new_claim, &_claim, old_claim) == old_claim) {
+ return true;
+ }
}
-
- return (int) Atomic::cmpxchg(1, &_claimed, 0) == 0;
}
// Unsafe anonymous classes have their own ClassLoaderData that is marked to keep alive
@@ -295,8 +300,8 @@
}
}
-void ClassLoaderData::oops_do(OopClosure* f, bool must_claim, bool clear_mod_oops) {
- if (must_claim && !claim()) {
+void ClassLoaderData::oops_do(OopClosure* f, int claim_value, bool clear_mod_oops) {
+ if (claim_value != ClassLoaderData::_claim_none && !try_claim(claim_value)) {
return;
}
--- a/src/hotspot/share/classfile/classLoaderData.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderData.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -128,9 +128,8 @@
// loader. _keep_alive does not need to be volatile or
// atomic since there is one unique CLD per unsafe anonymous class.
- volatile int _claimed; // true if claimed, for example during GC traces.
- // To avoid applying oop closure more than once.
- // Has to be an int because we cas it.
+ volatile int _claim; // non-zero if claimed, for example during GC traces.
+ // To avoid applying oop closure more than once.
ChunkedHandleList _handles; // Handles to constant pool arrays, Modules, etc, which
// have the same life cycle of the corresponding ClassLoader.
@@ -200,11 +199,22 @@
Dictionary* create_dictionary();
void initialize_name(Handle class_loader);
+
public:
// GC interface.
- void clear_claimed() { _claimed = 0; }
- bool claimed() const { return _claimed == 1; }
- bool claim();
+
+ // The "claim" is typically used to check if oops_do needs to be applied on
+ // the CLD or not. Most GCs only perform strong marking during the marking phase.
+ enum {
+ _claim_none = 0,
+ _claim_finalizable = 2,
+ _claim_strong = 3
+ };
+ void clear_claim() { _claim = 0; }
+ bool claimed() const { return _claim != 0; }
+ bool try_claim(int claim);
+ int get_claim() const { return _claim; }
+ void set_claim(int claim) { _claim = claim; }
// Computes if the CLD is alive or not. This is safe to call in concurrent
// contexts.
@@ -264,7 +274,7 @@
void initialize_holder(Handle holder);
- void oops_do(OopClosure* f, bool must_claim, bool clear_modified_oops = false);
+ void oops_do(OopClosure* f, int claim_value, bool clear_modified_oops = false);
void classes_do(KlassClosure* klass_closure);
Klass* klasses() { return _klasses; }
--- a/src/hotspot/share/classfile/classLoaderDataGraph.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/classLoaderDataGraph.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -48,7 +48,7 @@
void ClassLoaderDataGraph::clear_claimed_marks() {
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->next()) {
- cld->clear_claimed();
+ cld->clear_claim();
}
}
@@ -231,14 +231,14 @@
}
void ClassLoaderDataGraph::cld_do(CLDClosure* cl) {
- assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+ assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->_next) {
cl->do_cld(cld);
}
}
void ClassLoaderDataGraph::cld_unloading_do(CLDClosure* cl) {
- assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+ assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
// Only walk the head until any clds not purged from prior unloading
// (CMS doesn't purge right away).
for (ClassLoaderData* cld = _unloading; cld != _saved_unloading; cld = cld->next()) {
@@ -248,7 +248,7 @@
}
void ClassLoaderDataGraph::roots_cld_do(CLDClosure* strong, CLDClosure* weak) {
- assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+ assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
for (ClassLoaderData* cld = _head; cld != NULL; cld = cld->_next) {
CLDClosure* closure = cld->keep_alive() ? strong : weak;
if (closure != NULL) {
@@ -258,7 +258,7 @@
}
void ClassLoaderDataGraph::always_strong_cld_do(CLDClosure* cl) {
- assert_locked_or_safepoint(ClassLoaderDataGraph_lock);
+ assert_locked_or_safepoint_weak(ClassLoaderDataGraph_lock);
if (ClassUnloading) {
roots_cld_do(cl, NULL);
} else {
--- a/src/hotspot/share/classfile/systemDictionary.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -1963,41 +1963,30 @@
// Compact table of directions on the initialization of klasses:
static const short wk_init_info[] = {
- #define WK_KLASS_INIT_INFO(name, symbol, option) \
- ( ((int)vmSymbols::VM_SYMBOL_ENUM_NAME(symbol) \
- << SystemDictionary::CEIL_LG_OPTION_LIMIT) \
- | (int)SystemDictionary::option ),
+ #define WK_KLASS_INIT_INFO(name, symbol) \
+ ((short)vmSymbols::VM_SYMBOL_ENUM_NAME(symbol)),
+
WK_KLASSES_DO(WK_KLASS_INIT_INFO)
#undef WK_KLASS_INIT_INFO
0
};
-bool SystemDictionary::resolve_wk_klass(WKID id, int init_opt, TRAPS) {
+bool SystemDictionary::resolve_wk_klass(WKID id, TRAPS) {
assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
- int info = wk_init_info[id - FIRST_WKID];
- int sid = (info >> CEIL_LG_OPTION_LIMIT);
+ int sid = wk_init_info[id - FIRST_WKID];
Symbol* symbol = vmSymbols::symbol_at((vmSymbols::SID)sid);
InstanceKlass** klassp = &_well_known_klasses[id];
- bool must_load;
+
#if INCLUDE_JVMCI
- if (EnableJVMCI) {
- // If JVMCI is enabled we require its classes to be found.
- must_load = (init_opt < SystemDictionary::Opt) || (init_opt == SystemDictionary::Jvmci);
- } else
+ if (id >= FIRST_JVMCI_WKID) {
+ assert(EnableJVMCI, "resolve JVMCI classes only when EnableJVMCI is true");
+ }
#endif
- {
- must_load = (init_opt < SystemDictionary::Opt);
- }
if ((*klassp) == NULL) {
- Klass* k;
- if (must_load) {
- k = resolve_or_fail(symbol, true, CHECK_0); // load required class
- } else {
- k = resolve_or_null(symbol, CHECK_0); // load optional klass
- }
- (*klassp) = (k == NULL) ? NULL : InstanceKlass::cast(k);
+ Klass* k = resolve_or_fail(symbol, true, CHECK_0);
+ (*klassp) = InstanceKlass::cast(k);
}
return ((*klassp) != NULL);
}
@@ -2006,11 +1995,7 @@
assert((int)start_id <= (int)limit_id, "IDs are out of order!");
for (int id = (int)start_id; id < (int)limit_id; id++) {
assert(id >= (int)FIRST_WKID && id < (int)WKID_LIMIT, "oob");
- int info = wk_init_info[id - FIRST_WKID];
- int sid = (info >> CEIL_LG_OPTION_LIMIT);
- int opt = (info & right_n_bits(CEIL_LG_OPTION_LIMIT));
-
- resolve_wk_klass((WKID)id, opt, CHECK);
+ resolve_wk_klass((WKID)id, CHECK);
}
// move the starting value forward to the limit:
--- a/src/hotspot/share/classfile/systemDictionary.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/systemDictionary.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -94,127 +94,125 @@
#define WK_KLASS_ENUM_NAME(kname) kname##_knum
// Each well-known class has a short klass name (like object_klass),
-// a vmSymbol name (like java_lang_Object), and a flag word
-// that makes some minor distinctions, like whether the klass
-// is preloaded, optional, release-specific, etc.
+// and a vmSymbol name (like java_lang_Object).
// The order of these definitions is significant; it is the order in which
// preloading is actually performed by resolve_preloaded_classes.
-#define WK_KLASSES_DO(do_klass) \
- /* well-known classes */ \
- do_klass(Object_klass, java_lang_Object, Pre ) \
- do_klass(String_klass, java_lang_String, Pre ) \
- do_klass(Class_klass, java_lang_Class, Pre ) \
- do_klass(Cloneable_klass, java_lang_Cloneable, Pre ) \
- do_klass(ClassLoader_klass, java_lang_ClassLoader, Pre ) \
- do_klass(Serializable_klass, java_io_Serializable, Pre ) \
- do_klass(System_klass, java_lang_System, Pre ) \
- do_klass(Throwable_klass, java_lang_Throwable, Pre ) \
- do_klass(Error_klass, java_lang_Error, Pre ) \
- do_klass(ThreadDeath_klass, java_lang_ThreadDeath, Pre ) \
- do_klass(Exception_klass, java_lang_Exception, Pre ) \
- do_klass(RuntimeException_klass, java_lang_RuntimeException, Pre ) \
- do_klass(SecurityManager_klass, java_lang_SecurityManager, Pre ) \
- do_klass(ProtectionDomain_klass, java_security_ProtectionDomain, Pre ) \
- do_klass(AccessControlContext_klass, java_security_AccessControlContext, Pre ) \
- do_klass(SecureClassLoader_klass, java_security_SecureClassLoader, Pre ) \
- do_klass(ClassNotFoundException_klass, java_lang_ClassNotFoundException, Pre ) \
- do_klass(NoClassDefFoundError_klass, java_lang_NoClassDefFoundError, Pre ) \
- do_klass(LinkageError_klass, java_lang_LinkageError, Pre ) \
- do_klass(ClassCastException_klass, java_lang_ClassCastException, Pre ) \
- do_klass(ArrayStoreException_klass, java_lang_ArrayStoreException, Pre ) \
- do_klass(VirtualMachineError_klass, java_lang_VirtualMachineError, Pre ) \
- do_klass(OutOfMemoryError_klass, java_lang_OutOfMemoryError, Pre ) \
- do_klass(StackOverflowError_klass, java_lang_StackOverflowError, Pre ) \
- do_klass(IllegalMonitorStateException_klass, java_lang_IllegalMonitorStateException, Pre ) \
- do_klass(Reference_klass, java_lang_ref_Reference, Pre ) \
- \
- /* Preload ref klasses and set reference types */ \
- do_klass(SoftReference_klass, java_lang_ref_SoftReference, Pre ) \
- do_klass(WeakReference_klass, java_lang_ref_WeakReference, Pre ) \
- do_klass(FinalReference_klass, java_lang_ref_FinalReference, Pre ) \
- do_klass(PhantomReference_klass, java_lang_ref_PhantomReference, Pre ) \
- do_klass(Finalizer_klass, java_lang_ref_Finalizer, Pre ) \
- \
- do_klass(Thread_klass, java_lang_Thread, Pre ) \
- do_klass(ThreadGroup_klass, java_lang_ThreadGroup, Pre ) \
- do_klass(Properties_klass, java_util_Properties, Pre ) \
- do_klass(Module_klass, java_lang_Module, Pre ) \
- do_klass(reflect_AccessibleObject_klass, java_lang_reflect_AccessibleObject, Pre ) \
- do_klass(reflect_Field_klass, java_lang_reflect_Field, Pre ) \
- do_klass(reflect_Parameter_klass, java_lang_reflect_Parameter, Opt ) \
- do_klass(reflect_Method_klass, java_lang_reflect_Method, Pre ) \
- do_klass(reflect_Constructor_klass, java_lang_reflect_Constructor, Pre ) \
- \
- /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */ \
- /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
- do_klass(reflect_MagicAccessorImpl_klass, reflect_MagicAccessorImpl, Opt ) \
- do_klass(reflect_MethodAccessorImpl_klass, reflect_MethodAccessorImpl, Pre ) \
- do_klass(reflect_ConstructorAccessorImpl_klass, reflect_ConstructorAccessorImpl, Pre ) \
- do_klass(reflect_DelegatingClassLoader_klass, reflect_DelegatingClassLoader, Opt ) \
- do_klass(reflect_ConstantPool_klass, reflect_ConstantPool, Opt ) \
- do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl, Opt ) \
- do_klass(reflect_CallerSensitive_klass, reflect_CallerSensitive, Opt ) \
- \
- /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
- do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle, Opt ) \
- do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle, Pre ) \
- do_klass(VarHandle_klass, java_lang_invoke_VarHandle, Pre ) \
- do_klass(MemberName_klass, java_lang_invoke_MemberName, Pre ) \
- do_klass(ResolvedMethodName_klass, java_lang_invoke_ResolvedMethodName, Pre ) \
- do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives, Pre ) \
- do_klass(LambdaForm_klass, java_lang_invoke_LambdaForm, Opt ) \
- do_klass(MethodType_klass, java_lang_invoke_MethodType, Pre ) \
- do_klass(BootstrapMethodError_klass, java_lang_BootstrapMethodError, Pre ) \
- do_klass(CallSite_klass, java_lang_invoke_CallSite, Pre ) \
- do_klass(Context_klass, java_lang_invoke_MethodHandleNatives_CallSiteContext, Pre ) \
- do_klass(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite, Pre ) \
- do_klass(MutableCallSite_klass, java_lang_invoke_MutableCallSite, Pre ) \
- do_klass(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite, Pre ) \
- /* Note: MethodHandle must be first, and VolatileCallSite last in group */ \
- \
- do_klass(AssertionStatusDirectives_klass, java_lang_AssertionStatusDirectives, Pre ) \
- do_klass(StringBuffer_klass, java_lang_StringBuffer, Pre ) \
- do_klass(StringBuilder_klass, java_lang_StringBuilder, Pre ) \
- do_klass(internal_Unsafe_klass, jdk_internal_misc_Unsafe, Pre ) \
- do_klass(module_Modules_klass, jdk_internal_module_Modules, Pre ) \
- \
- /* support for CDS */ \
- do_klass(ByteArrayInputStream_klass, java_io_ByteArrayInputStream, Pre ) \
- do_klass(URL_klass, java_net_URL, Pre ) \
- do_klass(Jar_Manifest_klass, java_util_jar_Manifest, Pre ) \
- do_klass(jdk_internal_loader_ClassLoaders_klass, jdk_internal_loader_ClassLoaders, Pre ) \
- do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass, jdk_internal_loader_ClassLoaders_AppClassLoader, Pre ) \
- do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader, Pre ) \
- do_klass(CodeSource_klass, java_security_CodeSource, Pre ) \
- \
- do_klass(StackTraceElement_klass, java_lang_StackTraceElement, Opt ) \
- \
- /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
- do_klass(nio_Buffer_klass, java_nio_Buffer, Opt ) \
- \
- /* Stack Walking */ \
- do_klass(StackWalker_klass, java_lang_StackWalker, Opt ) \
- do_klass(AbstractStackWalker_klass, java_lang_StackStreamFactory_AbstractStackWalker, Opt ) \
- do_klass(StackFrameInfo_klass, java_lang_StackFrameInfo, Opt ) \
- do_klass(LiveStackFrameInfo_klass, java_lang_LiveStackFrameInfo, Opt ) \
- \
- /* support for stack dump lock analysis */ \
- do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer, Pre ) \
- \
- /* Preload boxing klasses */ \
- do_klass(Boolean_klass, java_lang_Boolean, Pre ) \
- do_klass(Character_klass, java_lang_Character, Pre ) \
- do_klass(Float_klass, java_lang_Float, Pre ) \
- do_klass(Double_klass, java_lang_Double, Pre ) \
- do_klass(Byte_klass, java_lang_Byte, Pre ) \
- do_klass(Short_klass, java_lang_Short, Pre ) \
- do_klass(Integer_klass, java_lang_Integer, Pre ) \
- do_klass(Long_klass, java_lang_Long, Pre ) \
- \
- /* JVMCI classes. These are loaded on-demand. */ \
- JVMCI_WK_KLASSES_DO(do_klass) \
- \
+#define WK_KLASSES_DO(do_klass) \
+ /* well-known classes */ \
+ do_klass(Object_klass, java_lang_Object ) \
+ do_klass(String_klass, java_lang_String ) \
+ do_klass(Class_klass, java_lang_Class ) \
+ do_klass(Cloneable_klass, java_lang_Cloneable ) \
+ do_klass(ClassLoader_klass, java_lang_ClassLoader ) \
+ do_klass(Serializable_klass, java_io_Serializable ) \
+ do_klass(System_klass, java_lang_System ) \
+ do_klass(Throwable_klass, java_lang_Throwable ) \
+ do_klass(Error_klass, java_lang_Error ) \
+ do_klass(ThreadDeath_klass, java_lang_ThreadDeath ) \
+ do_klass(Exception_klass, java_lang_Exception ) \
+ do_klass(RuntimeException_klass, java_lang_RuntimeException ) \
+ do_klass(SecurityManager_klass, java_lang_SecurityManager ) \
+ do_klass(ProtectionDomain_klass, java_security_ProtectionDomain ) \
+ do_klass(AccessControlContext_klass, java_security_AccessControlContext ) \
+ do_klass(SecureClassLoader_klass, java_security_SecureClassLoader ) \
+ do_klass(ClassNotFoundException_klass, java_lang_ClassNotFoundException ) \
+ do_klass(NoClassDefFoundError_klass, java_lang_NoClassDefFoundError ) \
+ do_klass(LinkageError_klass, java_lang_LinkageError ) \
+ do_klass(ClassCastException_klass, java_lang_ClassCastException ) \
+ do_klass(ArrayStoreException_klass, java_lang_ArrayStoreException ) \
+ do_klass(VirtualMachineError_klass, java_lang_VirtualMachineError ) \
+ do_klass(OutOfMemoryError_klass, java_lang_OutOfMemoryError ) \
+ do_klass(StackOverflowError_klass, java_lang_StackOverflowError ) \
+ do_klass(IllegalMonitorStateException_klass, java_lang_IllegalMonitorStateException ) \
+ do_klass(Reference_klass, java_lang_ref_Reference ) \
+ \
+ /* Preload ref klasses and set reference types */ \
+ do_klass(SoftReference_klass, java_lang_ref_SoftReference ) \
+ do_klass(WeakReference_klass, java_lang_ref_WeakReference ) \
+ do_klass(FinalReference_klass, java_lang_ref_FinalReference ) \
+ do_klass(PhantomReference_klass, java_lang_ref_PhantomReference ) \
+ do_klass(Finalizer_klass, java_lang_ref_Finalizer ) \
+ \
+ do_klass(Thread_klass, java_lang_Thread ) \
+ do_klass(ThreadGroup_klass, java_lang_ThreadGroup ) \
+ do_klass(Properties_klass, java_util_Properties ) \
+ do_klass(Module_klass, java_lang_Module ) \
+ do_klass(reflect_AccessibleObject_klass, java_lang_reflect_AccessibleObject ) \
+ do_klass(reflect_Field_klass, java_lang_reflect_Field ) \
+ do_klass(reflect_Parameter_klass, java_lang_reflect_Parameter ) \
+ do_klass(reflect_Method_klass, java_lang_reflect_Method ) \
+ do_klass(reflect_Constructor_klass, java_lang_reflect_Constructor ) \
+ \
+ /* NOTE: needed too early in bootstrapping process to have checks based on JDK version */ \
+ /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
+ do_klass(reflect_MagicAccessorImpl_klass, reflect_MagicAccessorImpl ) \
+ do_klass(reflect_MethodAccessorImpl_klass, reflect_MethodAccessorImpl ) \
+ do_klass(reflect_ConstructorAccessorImpl_klass, reflect_ConstructorAccessorImpl ) \
+ do_klass(reflect_DelegatingClassLoader_klass, reflect_DelegatingClassLoader ) \
+ do_klass(reflect_ConstantPool_klass, reflect_ConstantPool ) \
+ do_klass(reflect_UnsafeStaticFieldAccessorImpl_klass, reflect_UnsafeStaticFieldAccessorImpl ) \
+ do_klass(reflect_CallerSensitive_klass, reflect_CallerSensitive ) \
+ \
+ /* support for dynamic typing; it's OK if these are NULL in earlier JDKs */ \
+ do_klass(DirectMethodHandle_klass, java_lang_invoke_DirectMethodHandle ) \
+ do_klass(MethodHandle_klass, java_lang_invoke_MethodHandle ) \
+ do_klass(VarHandle_klass, java_lang_invoke_VarHandle ) \
+ do_klass(MemberName_klass, java_lang_invoke_MemberName ) \
+ do_klass(ResolvedMethodName_klass, java_lang_invoke_ResolvedMethodName ) \
+ do_klass(MethodHandleNatives_klass, java_lang_invoke_MethodHandleNatives ) \
+ do_klass(LambdaForm_klass, java_lang_invoke_LambdaForm ) \
+ do_klass(MethodType_klass, java_lang_invoke_MethodType ) \
+ do_klass(BootstrapMethodError_klass, java_lang_BootstrapMethodError ) \
+ do_klass(CallSite_klass, java_lang_invoke_CallSite ) \
+ do_klass(Context_klass, java_lang_invoke_MethodHandleNatives_CallSiteContext ) \
+ do_klass(ConstantCallSite_klass, java_lang_invoke_ConstantCallSite ) \
+ do_klass(MutableCallSite_klass, java_lang_invoke_MutableCallSite ) \
+ do_klass(VolatileCallSite_klass, java_lang_invoke_VolatileCallSite ) \
+ /* Note: MethodHandle must be first, and VolatileCallSite last in group */ \
+ \
+ do_klass(AssertionStatusDirectives_klass, java_lang_AssertionStatusDirectives ) \
+ do_klass(StringBuffer_klass, java_lang_StringBuffer ) \
+ do_klass(StringBuilder_klass, java_lang_StringBuilder ) \
+ do_klass(internal_Unsafe_klass, jdk_internal_misc_Unsafe ) \
+ do_klass(module_Modules_klass, jdk_internal_module_Modules ) \
+ \
+ /* support for CDS */ \
+ do_klass(ByteArrayInputStream_klass, java_io_ByteArrayInputStream ) \
+ do_klass(URL_klass, java_net_URL ) \
+ do_klass(Jar_Manifest_klass, java_util_jar_Manifest ) \
+ do_klass(jdk_internal_loader_ClassLoaders_klass, jdk_internal_loader_ClassLoaders ) \
+ do_klass(jdk_internal_loader_ClassLoaders_AppClassLoader_klass, jdk_internal_loader_ClassLoaders_AppClassLoader) \
+ do_klass(jdk_internal_loader_ClassLoaders_PlatformClassLoader_klass, jdk_internal_loader_ClassLoaders_PlatformClassLoader) \
+ do_klass(CodeSource_klass, java_security_CodeSource ) \
+ \
+ do_klass(StackTraceElement_klass, java_lang_StackTraceElement ) \
+ \
+ /* It's okay if this turns out to be NULL in non-1.4 JDKs. */ \
+ do_klass(nio_Buffer_klass, java_nio_Buffer ) \
+ \
+ /* Stack Walking */ \
+ do_klass(StackWalker_klass, java_lang_StackWalker ) \
+ do_klass(AbstractStackWalker_klass, java_lang_StackStreamFactory_AbstractStackWalker ) \
+ do_klass(StackFrameInfo_klass, java_lang_StackFrameInfo ) \
+ do_klass(LiveStackFrameInfo_klass, java_lang_LiveStackFrameInfo ) \
+ \
+ /* support for stack dump lock analysis */ \
+ do_klass(java_util_concurrent_locks_AbstractOwnableSynchronizer_klass, java_util_concurrent_locks_AbstractOwnableSynchronizer) \
+ \
+ /* Preload boxing klasses */ \
+ do_klass(Boolean_klass, java_lang_Boolean ) \
+ do_klass(Character_klass, java_lang_Character ) \
+ do_klass(Float_klass, java_lang_Float ) \
+ do_klass(Double_klass, java_lang_Double ) \
+ do_klass(Byte_klass, java_lang_Byte ) \
+ do_klass(Short_klass, java_lang_Short ) \
+ do_klass(Integer_klass, java_lang_Integer ) \
+ do_klass(Long_klass, java_lang_Long ) \
+ \
+ /* JVMCI classes. These are loaded on-demand. */ \
+ JVMCI_WK_KLASSES_DO(do_klass) \
+ \
/*end*/
@@ -226,7 +224,7 @@
enum WKID {
NO_WKID = 0,
- #define WK_KLASS_ENUM(name, symbol, ignore_o) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
+ #define WK_KLASS_ENUM(name, symbol) WK_KLASS_ENUM_NAME(name), WK_KLASS_ENUM_NAME(symbol) = WK_KLASS_ENUM_NAME(name),
WK_KLASSES_DO(WK_KLASS_ENUM)
#undef WK_KLASS_ENUM
@@ -240,21 +238,6 @@
FIRST_WKID = NO_WKID + 1
};
- enum InitOption {
- Pre, // preloaded; error if not present
-
- // Order is significant. Options before this point require resolve_or_fail.
- // Options after this point will use resolve_or_null instead.
-
- Opt, // preload tried; NULL if not present
-#if INCLUDE_JVMCI
- Jvmci, // preload tried; error if not present if JVMCI enabled
-#endif
- OPTION_LIMIT,
- CEIL_LG_OPTION_LIMIT = 2 // OPTION_LIMIT <= (1<<CEIL_LG_OPTION_LIMIT)
- };
-
-
// Returns a class with a given class name and class loader. Loads the
// class if needed. If not found a NoClassDefFoundError or a
// ClassNotFoundException is thrown, depending on the value on the
@@ -414,12 +397,7 @@
return k;
}
- static InstanceKlass* check_klass_Pre(InstanceKlass* k) { return check_klass(k); }
- static InstanceKlass* check_klass_Opt(InstanceKlass* k) { return k; }
-
- JVMCI_ONLY(static InstanceKlass* check_klass_Jvmci(InstanceKlass* k) { return k; })
-
- static bool resolve_wk_klass(WKID id, int init_opt, TRAPS);
+ static bool resolve_wk_klass(WKID id, TRAPS);
static void resolve_wk_klasses_until(WKID limit_id, WKID &start_id, TRAPS);
static void resolve_wk_klasses_through(WKID end_id, WKID &start_id, TRAPS) {
int limit = (int)end_id + 1;
@@ -427,10 +405,13 @@
}
public:
- #define WK_KLASS_DECLARE(name, symbol, option) \
- static InstanceKlass* name() { return check_klass_##option(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
- static InstanceKlass** name##_addr() { \
- return &SystemDictionary::_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
+ #define WK_KLASS_DECLARE(name, symbol) \
+ static InstanceKlass* name() { return check_klass(_well_known_klasses[WK_KLASS_ENUM_NAME(name)]); } \
+ static InstanceKlass** name##_addr() { \
+ return &_well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)]; \
+ } \
+ static bool name##_is_loaded() { \
+ return _well_known_klasses[SystemDictionary::WK_KLASS_ENUM_NAME(name)] != NULL; \
}
WK_KLASSES_DO(WK_KLASS_DECLARE);
#undef WK_KLASS_DECLARE
--- a/src/hotspot/share/classfile/verificationType.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/classfile/verificationType.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -172,7 +172,11 @@
} else if (is_uninitialized()) {
st->print("uninitialized %d", bci());
} else {
- name()->print_value_on(st);
+ if (name() != NULL) {
+ name()->print_value_on(st);
+ } else {
+ st->print_cr("NULL");
+ }
}
}
}
--- a/src/hotspot/share/code/codeBlob.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/code/codeBlob.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -186,6 +186,7 @@
bool contains(address addr) const { return content_begin() <= addr && addr < content_end(); }
bool is_frame_complete_at(address addr) const { return _frame_complete_offset != CodeOffsets::frame_never_safe &&
code_contains(addr) && addr >= code_begin() + _frame_complete_offset; }
+ int frame_complete_offset() const { return _frame_complete_offset; }
// CodeCache support: really only used by the nmethods, but in order to get
// asserts and certain bookkeeping to work in the CodeCache they are defined
--- a/src/hotspot/share/gc/cms/cmsArguments.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/cms/cmsArguments.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -45,7 +46,7 @@
assert(UseConcMarkSweepGC, "CMS is expected to be on here");
if (FLAG_IS_DEFAULT(ParallelGCThreads)) {
- FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
+ FLAG_SET_DEFAULT(ParallelGCThreads, VM_Version::parallel_worker_threads());
assert(ParallelGCThreads > 0, "We should always have at least one thread by default");
} else if (ParallelGCThreads == 0) {
jio_fprintf(defaultStream::error_stream(),
--- a/src/hotspot/share/gc/cms/cmsOopClosures.inline.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/cms/cmsOopClosures.inline.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -41,8 +41,7 @@
}
inline void MetadataVisitingOopsInGenClosure::do_cld(ClassLoaderData* cld) {
- bool claim = true; // Must claim the class loader data before processing.
- cld->oops_do(this, claim);
+ cld->oops_do(this, ClassLoaderData::_claim_strong);
}
// Decode the oop and call do_oop on it.
--- a/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/cms/concurrentMarkSweepGeneration.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -2398,7 +2398,7 @@
public:
VerifyCLDOopsCLDClosure(CMSBitMap* bitmap) : _oop_closure(bitmap) {}
void do_cld(ClassLoaderData* cld) {
- cld->oops_do(&_oop_closure, false, false);
+ cld->oops_do(&_oop_closure, ClassLoaderData::_claim_none, false);
}
};
@@ -2413,7 +2413,7 @@
// Mark from roots one level into CMS
MarkRefsIntoVerifyClosure notOlder(_span, verification_mark_bm(),
markBitMap());
- CLDToOopClosure cld_closure(¬Older, true);
+ CLDToOopClosure cld_closure(¬Older, ClassLoaderData::_claim_strong);
heap->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
@@ -2886,7 +2886,7 @@
}
} else {
// The serial version.
- CLDToOopClosure cld_closure(¬Older, true);
+ CLDToOopClosure cld_closure(¬Older, ClassLoaderData::_claim_strong);
heap->rem_set()->prepare_for_younger_refs_iterate(false); // Not parallel.
StrongRootsScope srs(1);
@@ -4269,7 +4269,7 @@
_timer.reset();
_timer.start();
- CLDToOopClosure cld_closure(&par_mri_cl, true);
+ CLDToOopClosure cld_closure(&par_mri_cl, ClassLoaderData::_claim_strong);
heap->cms_process_roots(_strong_roots_scope,
false, // yg was scanned above
@@ -4331,7 +4331,7 @@
class RemarkCLDClosure : public CLDClosure {
CLDToOopClosure _cm_closure;
public:
- RemarkCLDClosure(OopClosure* oop_closure) : _cm_closure(oop_closure) {}
+ RemarkCLDClosure(OopClosure* oop_closure) : _cm_closure(oop_closure, ClassLoaderData::_claim_strong) {}
void do_cld(ClassLoaderData* cld) {
// Check if we have modified any oops in the CLD during the concurrent marking.
if (cld->has_accumulated_modified_oops()) {
--- a/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/epsilon/epsilonBarrierSet.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -40,6 +40,7 @@
make_barrier_set_assembler<BarrierSetAssembler>(),
make_barrier_set_c1<BarrierSetC1>(),
make_barrier_set_c2<BarrierSetC2>(),
+ NULL /* barrier_set_nmethod */,
BarrierSet::FakeRtti(BarrierSet::EpsilonBarrierSet)) {};
void EpsilonBarrierSet::on_thread_create(Thread *thread) {
--- a/src/hotspot/share/gc/epsilon/epsilonHeap.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/epsilon/epsilonHeap.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -47,7 +47,7 @@
_space->initialize(committed_region, /* clear_space = */ true, /* mangle_space = */ true);
// Precompute hot fields
- _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), EpsilonMaxTLABSize / HeapWordSize);
+ _max_tlab_size = MIN2(CollectedHeap::max_tlab_size(), align_object_size(EpsilonMaxTLABSize / HeapWordSize));
_step_counter_update = MIN2<size_t>(max_byte_size / 16, EpsilonUpdateCountersStep);
_step_heap_print = (EpsilonPrintHeapSteps == 0) ? SIZE_MAX : (max_byte_size / EpsilonPrintHeapSteps);
_decay_time_ns = (int64_t) EpsilonTLABDecayTime * NANOSECS_PER_MILLISEC;
@@ -217,6 +217,16 @@
// Always honor alignment
size = align_up(size, MinObjAlignment);
+ // Check that adjustments did not break local and global invariants
+ assert(is_object_aligned(size),
+ "Size honors object alignment: " SIZE_FORMAT, size);
+ assert(min_size <= size,
+ "Size honors min size: " SIZE_FORMAT " <= " SIZE_FORMAT, min_size, size);
+ assert(size <= _max_tlab_size,
+ "Size honors max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, _max_tlab_size);
+ assert(size <= CollectedHeap::max_tlab_size(),
+ "Size honors global max size: " SIZE_FORMAT " <= " SIZE_FORMAT, size, CollectedHeap::max_tlab_size());
+
if (log_is_enabled(Trace, gc)) {
ResourceMark rm;
log_trace(gc)("TLAB size for \"%s\" (Requested: " SIZE_FORMAT "K, Min: " SIZE_FORMAT
--- a/src/hotspot/share/gc/g1/g1Arguments.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1Arguments.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -75,7 +75,7 @@
void G1Arguments::initialize() {
GCArguments::initialize();
assert(UseG1GC, "Error");
- FLAG_SET_DEFAULT(ParallelGCThreads, Abstract_VM_Version::parallel_worker_threads());
+ FLAG_SET_DEFAULT(ParallelGCThreads, VM_Version::parallel_worker_threads());
if (ParallelGCThreads == 0) {
assert(!FLAG_IS_DEFAULT(ParallelGCThreads), "The default value for ParallelGCThreads should not be 0.");
vm_exit_during_initialization("The flag -XX:+UseG1GC can not be combined with -XX:ParallelGCThreads=0", NULL);
--- a/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCAdjustTask.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -108,7 +108,7 @@
AlwaysTrueClosure always_alive;
_weak_proc_task.work(worker_id, &always_alive, &_adjust);
- CLDToOopClosure adjust_cld(&_adjust);
+ CLDToOopClosure adjust_cld(&_adjust, ClassLoaderData::_claim_strong);
CodeBlobToOopClosure adjust_code(&_adjust, CodeBlobToOopClosure::FixRelocations);
_root_processor.process_all_roots(
&_adjust,
--- a/src/hotspot/share/gc/g1/g1FullGCMarker.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCMarker.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -23,6 +23,7 @@
*/
#include "precompiled.hpp"
+#include "classfile/classLoaderData.hpp"
#include "gc/g1/g1FullGCMarker.inline.hpp"
#include "gc/shared/referenceProcessor.hpp"
#include "memory/iterator.inline.hpp"
@@ -36,7 +37,7 @@
_mark_closure(worker_id, this, G1CollectedHeap::heap()->ref_processor_stw()),
_verify_closure(VerifyOption_G1UseFullMarking),
_stack_closure(this),
- _cld_closure(mark_closure()) {
+ _cld_closure(mark_closure(), ClassLoaderData::_claim_strong) {
_oop_stack.initialize();
_objarray_stack.initialize();
}
--- a/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1FullGCOopClosures.inline.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -25,7 +25,7 @@
#ifndef SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
#define SHARE_VM_GC_G1_G1FULLGCOOPCLOSURES_INLINE_HPP
-#include "gc/g1/g1Allocator.hpp"
+#include "gc/g1/g1Allocator.inline.hpp"
#include "gc/g1/g1ConcurrentMarkBitMap.inline.hpp"
#include "gc/g1/g1FullGCMarker.inline.hpp"
#include "gc/g1/g1FullGCOopClosures.hpp"
--- a/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1HeapVerifier.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -24,14 +24,12 @@
#include "precompiled.hpp"
#include "gc/g1/g1Allocator.inline.hpp"
-#include "gc/g1/g1CollectedHeap.hpp"
#include "gc/g1/g1CollectedHeap.inline.hpp"
#include "gc/g1/g1ConcurrentMarkThread.hpp"
#include "gc/g1/g1HeapVerifier.hpp"
#include "gc/g1/g1Policy.hpp"
#include "gc/g1/g1RemSet.hpp"
#include "gc/g1/g1RootProcessor.hpp"
-#include "gc/g1/heapRegion.hpp"
#include "gc/g1/heapRegion.inline.hpp"
#include "gc/g1/heapRegionRemSet.hpp"
#include "gc/g1/g1StringDedup.hpp"
@@ -170,10 +168,10 @@
public:
VerifyCLDClosure(G1CollectedHeap* g1h, OopClosure* cl) : _young_ref_counter_closure(g1h), _oop_closure(cl) {}
void do_cld(ClassLoaderData* cld) {
- cld->oops_do(_oop_closure, false);
+ cld->oops_do(_oop_closure, ClassLoaderData::_claim_none);
_young_ref_counter_closure.reset_count();
- cld->oops_do(&_young_ref_counter_closure, false);
+ cld->oops_do(&_young_ref_counter_closure, ClassLoaderData::_claim_none);
if (_young_ref_counter_closure.count() > 0) {
guarantee(cld->has_modified_oops(), "CLD " PTR_FORMAT ", has young %d refs but is not dirty.", p2i(cld), _young_ref_counter_closure.count());
}
--- a/src/hotspot/share/gc/g1/g1OopClosures.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1OopClosures.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -52,7 +52,7 @@
// Clean the cld since we're going to scavenge all the metadata.
// Clear modified oops only if this cld is claimed.
- cld->oops_do(_closure, _must_claim, /*clear_modified_oops*/true);
+ cld->oops_do(_closure, _claim, /*clear_modified_oops*/true);
_closure->set_scanned_cld(NULL);
--- a/src/hotspot/share/gc/g1/g1OopClosures.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1OopClosures.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -160,12 +160,12 @@
class G1CLDScanClosure : public CLDClosure {
G1ParCopyHelper* _closure;
bool _process_only_dirty;
- bool _must_claim;
+ int _claim;
int _count;
public:
G1CLDScanClosure(G1ParCopyHelper* closure,
- bool process_only_dirty, bool must_claim)
- : _closure(closure), _process_only_dirty(process_only_dirty), _must_claim(must_claim), _count(0) {}
+ bool process_only_dirty, int claim_value)
+ : _closure(closure), _process_only_dirty(process_only_dirty), _claim(claim_value), _count(0) {}
void do_cld(ClassLoaderData* cld);
};
--- a/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1ParScanThreadState.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -201,11 +201,11 @@
HeapWord * const obj_ptr) const {
PLAB* alloc_buf = _plab_allocator->alloc_buffer(dest_state);
if (alloc_buf->contains(obj_ptr)) {
- _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz, age,
+ _g1h->_gc_tracer_stw->report_promotion_in_new_plab_event(old->klass(), word_sz * HeapWordSize, age,
dest_state.value() == InCSetState::Old,
alloc_buf->word_sz());
} else {
- _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz, age,
+ _g1h->_gc_tracer_stw->report_promotion_outside_plab_event(old->klass(), word_sz * HeapWordSize, age,
dest_state.value() == InCSetState::Old);
}
}
--- a/src/hotspot/share/gc/g1/g1RootClosures.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1RootClosures.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -35,7 +35,7 @@
G1EvacuationClosures(G1CollectedHeap* g1h,
G1ParScanThreadState* pss,
bool in_young_gc) :
- _closures(g1h, pss, in_young_gc, /* must_claim_cld */ false) {}
+ _closures(g1h, pss, in_young_gc, /* cld_claim */ ClassLoaderData::_claim_none) {}
OopClosure* weak_oops() { return &_closures._oops; }
OopClosure* strong_oops() { return &_closures._oops; }
@@ -73,8 +73,8 @@
public:
G1InitialMarkClosures(G1CollectedHeap* g1h,
G1ParScanThreadState* pss) :
- _strong(g1h, pss, /* process_only_dirty_klasses */ false, /* must_claim_cld */ true),
- _weak(g1h, pss, /* process_only_dirty_klasses */ false, /* must_claim_cld */ true) {}
+ _strong(g1h, pss, /* process_only_dirty_klasses */ false, /* cld_claim */ ClassLoaderData::_claim_strong),
+ _weak(g1h, pss, /* process_only_dirty_klasses */ false, /* cld_claim */ ClassLoaderData::_claim_strong) {}
OopClosure* weak_oops() { return &_weak._oops; }
OopClosure* strong_oops() { return &_strong._oops; }
--- a/src/hotspot/share/gc/g1/g1SharedClosures.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/g1/g1SharedClosures.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -39,9 +39,9 @@
G1CLDScanClosure _clds;
G1CodeBlobClosure _codeblobs;
- G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty, bool must_claim_cld) :
+ G1SharedClosures(G1CollectedHeap* g1h, G1ParScanThreadState* pss, bool process_only_dirty, int cld_claim) :
_oops(g1h, pss),
_oops_in_cld(g1h, pss),
- _clds(&_oops_in_cld, process_only_dirty, must_claim_cld),
+ _clds(&_oops_in_cld, process_only_dirty, cld_claim),
_codeblobs(&_oops) {}
};
--- a/src/hotspot/share/gc/parallel/parallelArguments.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/parallel/parallelArguments.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -1,4 +1,5 @@
/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2017, Red Hat, Inc. and/or its affiliates.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -50,7 +51,7 @@
// If no heap maximum was requested explicitly, use some reasonable fraction
// of the physical memory, up to a maximum of 1GB.
FLAG_SET_DEFAULT(ParallelGCThreads,
- Abstract_VM_Version::parallel_worker_threads());
+ VM_Version::parallel_worker_threads());
if (ParallelGCThreads == 0) {
jio_fprintf(defaultStream::error_stream(),
"The Parallel GC can not be combined with -XX:ParallelGCThreads=0\n");
--- a/src/hotspot/share/gc/parallel/pcTasks.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/parallel/pcTasks.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -110,7 +110,7 @@
break;
case class_loader_data: {
- CLDToOopClosure cld_closure(&mark_and_push_closure);
+ CLDToOopClosure cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong);
ClassLoaderDataGraph::always_strong_cld_do(&cld_closure);
}
break;
--- a/src/hotspot/share/gc/parallel/psParallelCompact.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/parallel/psParallelCompact.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -2213,7 +2213,7 @@
Management::oops_do(&oop_closure);
JvmtiExport::oops_do(&oop_closure);
SystemDictionary::oops_do(&oop_closure);
- CLDToOopClosure cld_closure(&oop_closure);
+ CLDToOopClosure cld_closure(&oop_closure, ClassLoaderData::_claim_strong);
ClassLoaderDataGraph::cld_do(&cld_closure);
// Now adjust pointers in remaining weak roots. (All of which should
--- a/src/hotspot/share/gc/serial/defNewGeneration.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/serial/defNewGeneration.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -137,7 +137,7 @@
_scavenge_closure->set_scanned_cld(cld);
// Clean the cld since we're going to scavenge all the metadata.
- cld->oops_do(_scavenge_closure, false, /*clear_modified_oops*/true);
+ cld->oops_do(_scavenge_closure, ClassLoaderData::_claim_none, /*clear_modified_oops*/true);
_scavenge_closure->set_scanned_cld(NULL);
}
--- a/src/hotspot/share/gc/serial/markSweep.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/serial/markSweep.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -58,9 +58,9 @@
MarkSweep::FollowRootClosure MarkSweep::follow_root_closure;
-MarkAndPushClosure MarkSweep::mark_and_push_closure;
-CLDToOopClosure MarkSweep::follow_cld_closure(&mark_and_push_closure);
-CLDToOopClosure MarkSweep::adjust_cld_closure(&adjust_pointer_closure);
+MarkAndPushClosure MarkSweep::mark_and_push_closure;
+CLDToOopClosure MarkSweep::follow_cld_closure(&mark_and_push_closure, ClassLoaderData::_claim_strong);
+CLDToOopClosure MarkSweep::adjust_cld_closure(&adjust_pointer_closure, ClassLoaderData::_claim_strong);
template <class T> inline void MarkSweep::KeepAliveClosure::do_oop_work(T* p) {
mark_and_push(p);
--- a/src/hotspot/share/gc/shared/barrierSet.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/shared/barrierSet.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -36,6 +36,7 @@
class BarrierSetAssembler;
class BarrierSetC1;
class BarrierSetC2;
+class BarrierSetNMethod;
class JavaThread;
// This class provides the interface between a barrier implementation and
@@ -72,6 +73,7 @@
BarrierSetAssembler* _barrier_set_assembler;
BarrierSetC1* _barrier_set_c1;
BarrierSetC2* _barrier_set_c2;
+ BarrierSetNMethod* _barrier_set_nmethod;
public:
// Metafunction mapping a class derived from BarrierSet to the
@@ -95,11 +97,13 @@
BarrierSet(BarrierSetAssembler* barrier_set_assembler,
BarrierSetC1* barrier_set_c1,
BarrierSetC2* barrier_set_c2,
+ BarrierSetNMethod* barrier_set_nmethod,
const FakeRtti& fake_rtti) :
_fake_rtti(fake_rtti),
_barrier_set_assembler(barrier_set_assembler),
_barrier_set_c1(barrier_set_c1),
- _barrier_set_c2(barrier_set_c2) {}
+ _barrier_set_c2(barrier_set_c2),
+ _barrier_set_nmethod(barrier_set_nmethod) {}
~BarrierSet() { }
template <class BarrierSetAssemblerT>
@@ -156,6 +160,10 @@
return _barrier_set_c2;
}
+ BarrierSetNMethod* barrier_set_nmethod() {
+ return _barrier_set_nmethod;
+ }
+
// The AccessBarrier of a BarrierSet subclass is called by the Access API
// (cf. oops/access.hpp) to perform decorated accesses. GC implementations
// may override these default access operations by declaring an
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shared/barrierSetNMethod.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,87 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#include "precompiled.hpp"
+#include "code/codeCache.hpp"
+#include "code/nmethod.hpp"
+#include "gc/shared/barrierSet.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
+#include "logging/log.hpp"
+#include "runtime/thread.hpp"
+#include "utilities/debug.hpp"
+
+int BarrierSetNMethod::disarmed_value() const {
+ char* disarmed_addr = reinterpret_cast<char*>(Thread::current());
+ disarmed_addr += in_bytes(thread_disarmed_offset());
+ return *reinterpret_cast<int*>(disarmed_addr);
+}
+
+bool BarrierSetNMethod::supports_entry_barrier(nmethod* nm) {
+ if (nm->method()->is_method_handle_intrinsic()) {
+ return false;
+ }
+
+ if (!nm->is_native_method() && !nm->is_compiled_by_c2() && !nm->is_compiled_by_c1()) {
+ return false;
+ }
+
+ return true;
+}
+
+int BarrierSetNMethod::nmethod_stub_entry_barrier(address* return_address_ptr) {
+ address return_address = *return_address_ptr;
+ CodeBlob* cb = CodeCache::find_blob(return_address);
+ assert(cb != NULL, "invariant");
+
+ nmethod* nm = cb->as_nmethod();
+ BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+
+ if (!bs_nm->is_armed(nm)) {
+ return 0;
+ }
+
+ assert(!nm->is_osr_method(), "Should not reach here");
+ // Called upon first entry after being armed
+ bool may_enter = bs_nm->nmethod_entry_barrier(nm);
+ if (!may_enter) {
+ log_trace(nmethod, barrier)("Deoptimizing nmethod: " PTR_FORMAT, p2i(nm));
+ bs_nm->deoptimize(nm, return_address_ptr);
+ }
+ return may_enter ? 0 : 1;
+}
+
+bool BarrierSetNMethod::nmethod_osr_entry_barrier(nmethod* nm) {
+ // This check depends on the invariant that all nmethods that are deoptimized / made not entrant
+ // are NOT disarmed.
+ // This invariant is important because a method can be deoptimized after the method have been
+ // resolved / looked up by OSR by another thread. By not deoptimizing them we guarantee that
+ // a deoptimized method will always hit the barrier and come to the same conclusion - deoptimize
+ if (!is_armed(nm)) {
+ return true;
+ }
+
+ assert(nm->is_osr_method(), "Should not reach here");
+ log_trace(nmethod, barrier)("Running osr nmethod entry barrier: " PTR_FORMAT, p2i(nm));
+ return nmethod_entry_barrier(nm);
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/hotspot/share/gc/shared/barrierSetNMethod.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ *
+ */
+
+#ifndef SHARE_CODE_NMETHOD_BARRIER_HPP
+#define SHARE_CODE_NMETHOD_BARRIER_HPP
+
+#include "memory/allocation.hpp"
+#include "utilities/globalDefinitions.hpp"
+#include "utilities/sizes.hpp"
+
+class nmethod;
+
+class BarrierSetNMethod: public CHeapObj<mtGC> {
+ bool supports_entry_barrier(nmethod* nm);
+ void deoptimize(nmethod* nm, address* return_addr_ptr);
+
+protected:
+ virtual int disarmed_value() const;
+ virtual bool nmethod_entry_barrier(nmethod* nm) = 0;
+
+public:
+ virtual ByteSize thread_disarmed_offset() const = 0;
+
+ static int nmethod_stub_entry_barrier(address* return_address_ptr);
+ bool nmethod_osr_entry_barrier(nmethod* nm);
+ bool is_armed(nmethod* nm);
+ void disarm(nmethod* nm);
+};
+
+
+#endif // SHARE_CODE_NMETHOD_BARRIER_HPP
--- a/src/hotspot/share/gc/shared/modRefBarrierSet.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/shared/modRefBarrierSet.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -39,6 +39,7 @@
: BarrierSet(barrier_set_assembler,
barrier_set_c1,
barrier_set_c2,
+ NULL /* barrier_set_nmethod */,
fake_rtti.add_tag(BarrierSet::ModRef)) { }
~ModRefBarrierSet() { }
--- a/src/hotspot/share/gc/z/zBarrierSet.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zBarrierSet.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -43,6 +43,7 @@
BarrierSet(make_barrier_set_assembler<ZBarrierSetAssembler>(),
make_barrier_set_c1<ZBarrierSetC1>(),
make_barrier_set_c2<ZBarrierSetC2>(),
+ NULL /* barrier_set_nmethod */,
BarrierSet::FakeRtti(BarrierSet::ZBarrierSet)) {}
ZBarrierSetAssembler* ZBarrierSet::assembler() {
--- a/src/hotspot/share/gc/z/zCollectedHeap.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zCollectedHeap.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -23,6 +23,7 @@
#include "precompiled.hpp"
#include "gc/shared/gcHeapSummary.hpp"
+#include "gc/shared/suspendibleThreadSet.hpp"
#include "gc/z/zCollectedHeap.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zHeap.inline.hpp"
@@ -295,6 +296,14 @@
reserved_region().start() + max_capacity_in_words);
}
+void ZCollectedHeap::safepoint_synchronize_begin() {
+ SuspendibleThreadSet::synchronize();
+}
+
+void ZCollectedHeap::safepoint_synchronize_end() {
+ SuspendibleThreadSet::desynchronize();
+}
+
void ZCollectedHeap::prepare_for_verify() {
// Does nothing
}
--- a/src/hotspot/share/gc/z/zCollectedHeap.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zCollectedHeap.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -117,6 +117,9 @@
virtual VirtualSpaceSummary create_heap_space_summary();
+ virtual void safepoint_synchronize_begin();
+ virtual void safepoint_synchronize_end();
+
virtual void print_on(outputStream* st) const;
virtual void print_on_error(outputStream* st) const;
virtual void print_extended_on(outputStream* st) const;
--- a/src/hotspot/share/gc/z/zDriver.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zDriver.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -336,7 +336,7 @@
// Phase 2: Concurrent Mark
{
ZStatTimer timer(ZPhaseConcurrentMark);
- ZHeap::heap()->mark();
+ ZHeap::heap()->mark(true /* initial */);
}
// Phase 3: Pause Mark End
@@ -345,7 +345,7 @@
while (!vm_operation(&cl)) {
// Phase 3.5: Concurrent Mark Continue
ZStatTimer timer(ZPhaseConcurrentMarkContinue);
- ZHeap::heap()->mark();
+ ZHeap::heap()->mark(false /* initial */);
}
}
--- a/src/hotspot/share/gc/z/zHeap.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeap.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -296,8 +296,8 @@
ZStatHeap::set_at_mark_start(capacity(), used());
}
-void ZHeap::mark() {
- _mark.mark();
+void ZHeap::mark(bool initial) {
+ _mark.mark(initial);
}
void ZHeap::mark_flush_and_free(Thread* thread) {
--- a/src/hotspot/share/gc/z/zHeap.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeap.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -133,7 +133,7 @@
bool is_object_strongly_live(uintptr_t addr) const;
template <bool finalizable, bool publish> void mark_object(uintptr_t addr);
void mark_start();
- void mark();
+ void mark(bool initial);
void mark_flush_and_free(Thread* thread);
bool mark_end();
--- a/src/hotspot/share/gc/z/zHeapIterator.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeapIterator.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -29,7 +29,6 @@
#include "gc/z/zOop.inline.hpp"
#include "gc/z/zRootsIterator.hpp"
#include "memory/iterator.inline.hpp"
-#include "oops/oop.inline.hpp"
#include "utilities/bitMap.inline.hpp"
#include "utilities/stack.inline.hpp"
@@ -54,19 +53,18 @@
class ZHeapIteratorRootOopClosure : public ZRootsIteratorClosure {
private:
ZHeapIterator* const _iter;
- ObjectClosure* const _cl;
public:
- ZHeapIteratorRootOopClosure(ZHeapIterator* iter, ObjectClosure* cl) :
- _iter(iter),
- _cl(cl) {}
+ ZHeapIteratorRootOopClosure(ZHeapIterator* iter) :
+ _iter(iter) {}
virtual void do_oop(oop* p) {
// Load barrier needed here for the same reason we
- // need fixup_partial_loads() in ZHeap::mark_end()
+ // need fixup_partial_loads() in ZHeap::mark_end().
+ // This barrier is also needed here in case we're
+ // treating the JVMTI weak tag map as strong roots.
const oop obj = ZBarrier::load_barrier_on_oop_field(p);
_iter->push(obj);
- _iter->drain(_cl);
}
virtual void do_oop(narrowOop* p) {
@@ -74,19 +72,13 @@
}
};
-class ZHeapIteratorPushOopClosure : public BasicOopIterateClosure {
+class ZHeapIteratorOopClosure : public BasicOopIterateClosure {
private:
ZHeapIterator* const _iter;
const oop _base;
const bool _visit_referents;
-public:
- ZHeapIteratorPushOopClosure(ZHeapIterator* iter, oop base) :
- _iter(iter),
- _base(base),
- _visit_referents(iter->visit_referents()) {}
-
- oop load_oop(oop* p) {
+ oop load_oop(oop* p) const {
if (_visit_referents) {
return HeapAccess<ON_UNKNOWN_OOP_REF>::oop_load_at(_base, _base->field_offset(p));
} else {
@@ -94,6 +86,12 @@
}
}
+public:
+ ZHeapIteratorOopClosure(ZHeapIterator* iter, oop base, bool visit_referents) :
+ _iter(iter),
+ _base(base),
+ _visit_referents(visit_referents) {}
+
virtual ReferenceIterationMode reference_iteration_mode() {
return _visit_referents ? DO_FIELDS : DO_FIELDS_EXCEPT_REFERENT;
}
@@ -126,11 +124,11 @@
}
}
-size_t ZHeapIterator::object_index_max() const {
+static size_t object_index_max() {
return ZPageSizeMin >> ZObjectAlignmentSmallShift;
}
-size_t ZHeapIterator::object_index(oop obj) const {
+static size_t object_index(oop obj) {
const uintptr_t addr = ZOop::to_address(obj);
const uintptr_t offset = ZAddress::offset(addr);
const uintptr_t mask = (1 << ZPageSizeMinShift) - 1;
@@ -165,7 +163,22 @@
_visit_stack.push(obj);
}
-void ZHeapIterator::drain(ObjectClosure* cl) {
+void ZHeapIterator::objects_do(ObjectClosure* cl) {
+ // Push roots onto stack
+ {
+ // Note that we also visit the JVMTI weak tag map as if they were
+ // strong roots to make sure we visit all tagged objects, even
+ // those that might now have become unreachable. If we didn't do
+ // this the user would have expected to see ObjectFree events for
+ // unreachable objects in the tag map.
+ ZRootsIterator roots;
+ ZConcurrentRootsIterator concurrent_roots(false /* marking */);
+ ZHeapIteratorRootOopClosure root_cl(this);
+ roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */);
+ concurrent_roots.oops_do(&root_cl);
+ }
+
+ // Drain stack
while (!_visit_stack.is_empty()) {
const oop obj = _visit_stack.pop();
@@ -173,23 +186,7 @@
cl->do_object(obj);
// Push members to visit
- ZHeapIteratorPushOopClosure push_cl(this, obj);
+ ZHeapIteratorOopClosure push_cl(this, obj, _visit_referents);
obj->oop_iterate(&push_cl);
}
}
-
-bool ZHeapIterator::visit_referents() const {
- return _visit_referents;
-}
-
-void ZHeapIterator::objects_do(ObjectClosure* cl) {
- ZHeapIteratorRootOopClosure root_cl(this, cl);
- ZRootsIterator roots;
-
- // Follow roots. Note that we also visit the JVMTI weak tag map
- // as if they were strong roots to make sure we visit all tagged
- // objects, even those that might now have become unreachable.
- // If we didn't do this the user would have expected to see
- // ObjectFree events for unreachable objects in the tag map.
- roots.oops_do(&root_cl, true /* visit_jvmti_weak_export */);
-}
--- a/src/hotspot/share/gc/z/zHeapIterator.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zHeapIterator.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -33,7 +33,7 @@
class ZHeapIterator : public StackObj {
friend class ZHeapIteratorRootOopClosure;
- friend class ZHeapIteratorPushOopClosure;
+ friend class ZHeapIteratorOopClosure;
private:
typedef ZAddressRangeMap<ZHeapIteratorBitMap*, ZPageSizeMinShift> ZVisitMap;
@@ -44,14 +44,8 @@
ZVisitMap _visit_map;
const bool _visit_referents;
- size_t object_index_max() const;
- size_t object_index(oop obj) const;
ZHeapIteratorBitMap* object_map(oop obj);
-
void push(oop obj);
- void drain(ObjectClosure* cl);
-
- bool visit_referents() const;
public:
ZHeapIterator(bool visit_referents);
--- a/src/hotspot/share/gc/z/zInitialize.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zInitialize.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -38,8 +38,8 @@
ZInitialize::ZInitialize(ZBarrierSet* barrier_set) {
log_info(gc, init)("Initializing %s", ZGCName);
log_info(gc, init)("Version: %s (%s)",
- Abstract_VM_Version::vm_release(),
- Abstract_VM_Version::jdk_debug_level());
+ VM_Version::vm_release(),
+ VM_Version::jdk_debug_level());
// Early initialization
ZAddressMasks::initialize();
--- a/src/hotspot/share/gc/z/zMark.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zMark.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -615,6 +615,34 @@
stacks->free(&_allocator);
}
+class ZMarkConcurrentRootsIteratorClosure : public ZRootsIteratorClosure {
+public:
+ virtual void do_oop(oop* p) {
+ ZBarrier::mark_barrier_on_oop_field(p, false /* finalizable */);
+ }
+
+ virtual void do_oop(narrowOop* p) {
+ ShouldNotReachHere();
+ }
+};
+
+
+class ZMarkConcurrentRootsTask : public ZTask {
+private:
+ ZConcurrentRootsIterator _roots;
+ ZMarkConcurrentRootsIteratorClosure _cl;
+
+public:
+ ZMarkConcurrentRootsTask(ZMark* mark) :
+ ZTask("ZMarkConcurrentRootsTask"),
+ _roots(true /* marking */),
+ _cl() {}
+
+ virtual void work() {
+ _roots.oops_do(&_cl);
+ }
+};
+
class ZMarkTask : public ZTask {
private:
ZMark* const _mark;
@@ -637,7 +665,12 @@
}
};
-void ZMark::mark() {
+void ZMark::mark(bool initial) {
+ if (initial) {
+ ZMarkConcurrentRootsTask task(this);
+ _workers->run_concurrent(&task);
+ }
+
ZMarkTask task(this);
_workers->run_concurrent(&task);
}
--- a/src/hotspot/share/gc/z/zMark.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zMark.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -108,7 +108,7 @@
template <bool finalizable, bool publish> void mark_object(uintptr_t addr);
void start();
- void mark();
+ void mark(bool initial);
bool end();
void flush_and_free();
--- a/src/hotspot/share/gc/z/zRootsIterator.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zRootsIterator.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -28,6 +28,7 @@
#include "code/codeCache.hpp"
#include "compiler/oopMap.hpp"
#include "gc/shared/oopStorageParState.inline.hpp"
+#include "gc/shared/suspendibleThreadSet.hpp"
#include "gc/z/zGlobals.hpp"
#include "gc/z/zNMethodTable.hpp"
#include "gc/z/zOopClosures.inline.hpp"
@@ -52,16 +53,20 @@
static const ZStatSubPhase ZSubPhasePauseRoots("Pause Roots");
static const ZStatSubPhase ZSubPhasePauseRootsTeardown("Pause Roots Teardown");
static const ZStatSubPhase ZSubPhasePauseRootsUniverse("Pause Roots Universe");
-static const ZStatSubPhase ZSubPhasePauseRootsJNIHandles("Pause Roots JNIHandles");
static const ZStatSubPhase ZSubPhasePauseRootsObjectSynchronizer("Pause Roots ObjectSynchronizer");
static const ZStatSubPhase ZSubPhasePauseRootsManagement("Pause Roots Management");
static const ZStatSubPhase ZSubPhasePauseRootsJVMTIExport("Pause Roots JVMTIExport");
static const ZStatSubPhase ZSubPhasePauseRootsJVMTIWeakExport("Pause Roots JVMTIWeakExport");
static const ZStatSubPhase ZSubPhasePauseRootsSystemDictionary("Pause Roots SystemDictionary");
-static const ZStatSubPhase ZSubPhasePauseRootsClassLoaderDataGraph("Pause Roots ClassLoaderDataGraph");
static const ZStatSubPhase ZSubPhasePauseRootsThreads("Pause Roots Threads");
static const ZStatSubPhase ZSubPhasePauseRootsCodeCache("Pause Roots CodeCache");
+static const ZStatSubPhase ZSubPhaseConcurrentRootsSetup("Concurrent Roots Setup");
+static const ZStatSubPhase ZSubPhaseConcurrentRoots("Concurrent Roots");
+static const ZStatSubPhase ZSubPhaseConcurrentRootsTeardown("Concurrent Roots Teardown");
+static const ZStatSubPhase ZSubPhaseConcurrentRootsJNIHandles("Concurrent Roots JNIHandles");
+static const ZStatSubPhase ZSubPhaseConcurrentRootsClassLoaderDataGraph("Concurrent Roots ClassLoaderDataGraph");
+
static const ZStatSubPhase ZSubPhasePauseWeakRootsSetup("Pause Weak Roots Setup");
static const ZStatSubPhase ZSubPhasePauseWeakRoots("Pause Weak Roots");
static const ZStatSubPhase ZSubPhasePauseWeakRootsTeardown("Pause Weak Roots Teardown");
@@ -128,21 +133,17 @@
}
ZRootsIterator::ZRootsIterator() :
- _jni_handles_iter(JNIHandles::global_handles()),
_universe(this),
_object_synchronizer(this),
_management(this),
_jvmti_export(this),
_jvmti_weak_export(this),
_system_dictionary(this),
- _jni_handles(this),
- _class_loader_data_graph(this),
_threads(this),
_code_cache(this) {
assert(SafepointSynchronize::is_at_safepoint(), "Should be at safepoint");
ZStatTimer timer(ZSubPhasePauseRootsSetup);
Threads::change_thread_claim_parity();
- ClassLoaderDataGraph::clear_claimed_marks();
COMPILER2_PRESENT(DerivedPointerTable::clear());
CodeCache::gc_prologue();
ZNMethodTable::gc_prologue();
@@ -163,11 +164,6 @@
Universe::oops_do(cl);
}
-void ZRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) {
- ZStatTimer timer(ZSubPhasePauseRootsJNIHandles);
- _jni_handles_iter.oops_do(cl);
-}
-
void ZRootsIterator::do_object_synchronizer(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsObjectSynchronizer);
ObjectSynchronizer::oops_do(cl);
@@ -194,12 +190,6 @@
SystemDictionary::oops_do(cl);
}
-void ZRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) {
- ZStatTimer timer(ZSubPhasePauseRootsClassLoaderDataGraph);
- CLDToOopClosure cld_cl(cl);
- ClassLoaderDataGraph::cld_do(&cld_cl);
-}
-
void ZRootsIterator::do_threads(ZRootsIteratorClosure* cl) {
ZStatTimer timer(ZSubPhasePauseRootsThreads);
ResourceMark rm;
@@ -218,8 +208,6 @@
_management.oops_do(cl);
_jvmti_export.oops_do(cl);
_system_dictionary.oops_do(cl);
- _jni_handles.oops_do(cl);
- _class_loader_data_graph.oops_do(cl);
_threads.oops_do(cl);
_code_cache.oops_do(cl);
if (visit_jvmti_weak_export) {
@@ -227,6 +215,43 @@
}
}
+ZConcurrentRootsIterator::ZConcurrentRootsIterator(bool marking) :
+ _marking(marking),
+ _sts_joiner(marking /* active */),
+ _jni_handles_iter(JNIHandles::global_handles()),
+ _jni_handles(this),
+ _class_loader_data_graph(this) {
+ ZStatTimer timer(ZSubPhaseConcurrentRootsSetup);
+ if (_marking) {
+ ClassLoaderDataGraph_lock->lock();
+ ClassLoaderDataGraph::clear_claimed_marks();
+ }
+}
+
+ZConcurrentRootsIterator::~ZConcurrentRootsIterator() {
+ ZStatTimer timer(ZSubPhaseConcurrentRootsTeardown);
+ if (_marking) {
+ ClassLoaderDataGraph_lock->unlock();
+ }
+}
+
+void ZConcurrentRootsIterator::do_jni_handles(ZRootsIteratorClosure* cl) {
+ ZStatTimer timer(ZSubPhaseConcurrentRootsJNIHandles);
+ _jni_handles_iter.oops_do(cl);
+}
+
+void ZConcurrentRootsIterator::do_class_loader_data_graph(ZRootsIteratorClosure* cl) {
+ ZStatTimer timer(ZSubPhaseConcurrentRootsClassLoaderDataGraph);
+ CLDToOopClosure cld_cl(cl, _marking ? ClassLoaderData::_claim_strong : ClassLoaderData::_claim_none);
+ ClassLoaderDataGraph::cld_do(&cld_cl);
+}
+
+void ZConcurrentRootsIterator::oops_do(ZRootsIteratorClosure* cl) {
+ ZStatTimer timer(ZSubPhaseConcurrentRoots);
+ _jni_handles.oops_do(cl);
+ _class_loader_data_graph.oops_do(cl);
+}
+
ZWeakRootsIterator::ZWeakRootsIterator() :
_jvmti_weak_export(this),
_jfr_weak(this) {
--- a/src/hotspot/share/gc/z/zRootsIterator.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/gc/z/zRootsIterator.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -25,6 +25,7 @@
#define SHARE_GC_Z_ZROOTSITERATOR_HPP
#include "gc/shared/oopStorageParState.hpp"
+#include "gc/shared/suspendibleThreadSet.hpp"
#include "memory/allocation.hpp"
#include "memory/iterator.hpp"
#include "runtime/thread.hpp"
@@ -37,8 +38,7 @@
}
};
-typedef OopStorage::ParState<false /* concurrent */, false /* is_const */> ZOopStorageIterator;
-typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZConcurrentOopStorageIterator;
+typedef OopStorage::ParState<true /* concurrent */, false /* is_const */> ZOopStorageIterator;
template <typename T, void (T::*F)(ZRootsIteratorClosure*)>
class ZSerialOopsDo {
@@ -86,29 +86,23 @@
class ZRootsIterator {
private:
- ZOopStorageIterator _jni_handles_iter;
-
void do_universe(ZRootsIteratorClosure* cl);
- void do_jni_handles(ZRootsIteratorClosure* cl);
void do_object_synchronizer(ZRootsIteratorClosure* cl);
void do_management(ZRootsIteratorClosure* cl);
void do_jvmti_export(ZRootsIteratorClosure* cl);
void do_jvmti_weak_export(ZRootsIteratorClosure* cl);
void do_system_dictionary(ZRootsIteratorClosure* cl);
- void do_class_loader_data_graph(ZRootsIteratorClosure* cl);
void do_threads(ZRootsIteratorClosure* cl);
void do_code_cache(ZRootsIteratorClosure* cl);
- ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe;
- ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer;
- ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management;
- ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export;
- ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export;
- ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_system_dictionary> _system_dictionary;
- ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_jni_handles> _jni_handles;
- ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_class_loader_data_graph> _class_loader_data_graph;
- ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_threads> _threads;
- ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache;
+ ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_universe> _universe;
+ ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_object_synchronizer> _object_synchronizer;
+ ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_management> _management;
+ ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_export> _jvmti_export;
+ ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_jvmti_weak_export> _jvmti_weak_export;
+ ZSerialOopsDo<ZRootsIterator, &ZRootsIterator::do_system_dictionary> _system_dictionary;
+ ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_threads> _threads;
+ ZParallelOopsDo<ZRootsIterator, &ZRootsIterator::do_code_cache> _code_cache;
public:
ZRootsIterator();
@@ -117,6 +111,25 @@
void oops_do(ZRootsIteratorClosure* cl, bool visit_jvmti_weak_export = false);
};
+class ZConcurrentRootsIterator {
+private:
+ const bool _marking;
+ SuspendibleThreadSetJoiner _sts_joiner;
+ ZOopStorageIterator _jni_handles_iter;
+
+ void do_jni_handles(ZRootsIteratorClosure* cl);
+ void do_class_loader_data_graph(ZRootsIteratorClosure* cl);
+
+ ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_jni_handles> _jni_handles;
+ ZParallelOopsDo<ZConcurrentRootsIterator, &ZConcurrentRootsIterator::do_class_loader_data_graph> _class_loader_data_graph;
+
+public:
+ ZConcurrentRootsIterator(bool marking);
+ ~ZConcurrentRootsIterator();
+
+ void oops_do(ZRootsIteratorClosure* cl);
+};
+
class ZWeakRootsIterator {
private:
void do_jvmti_weak_export(BoolObjectClosure* is_alive, ZRootsIteratorClosure* cl);
@@ -135,9 +148,9 @@
class ZConcurrentWeakRootsIterator {
private:
- ZConcurrentOopStorageIterator _vm_weak_handles_iter;
- ZConcurrentOopStorageIterator _jni_weak_handles_iter;
- ZConcurrentOopStorageIterator _string_table_iter;
+ ZOopStorageIterator _vm_weak_handles_iter;
+ ZOopStorageIterator _jni_weak_handles_iter;
+ ZOopStorageIterator _string_table_iter;
void do_vm_weak_handles(ZRootsIteratorClosure* cl);
void do_jni_weak_handles(ZRootsIteratorClosure* cl);
--- a/src/hotspot/share/interpreter/interpreterRuntime.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/interpreter/interpreterRuntime.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -29,6 +29,7 @@
#include "code/codeCache.hpp"
#include "compiler/compileBroker.hpp"
#include "compiler/disassembler.hpp"
+#include "gc/shared/barrierSetNMethod.hpp"
#include "gc/shared/collectedHeap.hpp"
#include "interpreter/interpreter.hpp"
#include "interpreter/interpreterRuntime.hpp"
@@ -1045,6 +1046,13 @@
Method* method = last_frame.method();
int bci = method->bci_from(last_frame.bcp());
nm = method->lookup_osr_nmethod_for(bci, CompLevel_none, false);
+ BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+ if (nm != NULL && bs_nm != NULL) {
+ // in case the transition passed a safepoint we need to barrier this again
+ if (!bs_nm->nmethod_osr_entry_barrier(nm)) {
+ nm = NULL;
+ }
+ }
}
if (nm != NULL && thread->is_interp_only_mode()) {
// Normally we never get an nm if is_interp_only_mode() is true, because
@@ -1081,6 +1089,13 @@
nmethod* osr_nm = CompilationPolicy::policy()->event(method, method, branch_bci, bci, CompLevel_none, NULL, thread);
assert(!HAS_PENDING_EXCEPTION, "Event handler should not throw any exceptions");
+ BarrierSetNMethod* bs_nm = BarrierSet::barrier_set()->barrier_set_nmethod();
+ if (osr_nm != NULL && bs_nm != NULL) {
+ if (!bs_nm->nmethod_osr_entry_barrier(osr_nm)) {
+ osr_nm = NULL;
+ }
+ }
+
if (osr_nm != NULL) {
// We may need to do on-stack replacement which requires that no
// monitors in the activation are biased because their
--- a/src/hotspot/share/interpreter/linkResolver.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/interpreter/linkResolver.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -974,68 +974,68 @@
THROW_MSG(vmSymbols::java_lang_NoSuchFieldError(), field->as_C_string());
}
- if (!link_info.check_access())
- // Access checking may be turned off when calling from within the VM.
- return;
+ // Access checking may be turned off when calling from within the VM.
+ Klass* current_klass = link_info.current_klass();
+ if (link_info.check_access()) {
- // check access
- Klass* current_klass = link_info.current_klass();
- check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK);
+ // check access
+ check_field_accessability(current_klass, resolved_klass, sel_klass, fd, CHECK);
- // check for errors
- if (is_static != fd.is_static()) {
- ResourceMark rm(THREAD);
- char msg[200];
- jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string());
- THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
- }
-
- // A final field can be modified only
- // (1) by methods declared in the class declaring the field and
- // (2) by the <clinit> method (in case of a static field)
- // or by the <init> method (in case of an instance field).
- if (is_put && fd.access_flags().is_final()) {
- ResourceMark rm(THREAD);
- stringStream ss;
-
- if (sel_klass != current_klass) {
- ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
- is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
- current_klass->external_name());
- THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
+ // check for errors
+ if (is_static != fd.is_static()) {
+ ResourceMark rm(THREAD);
+ char msg[200];
+ jio_snprintf(msg, sizeof(msg), "Expected %s field %s.%s", is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string());
+ THROW_MSG(vmSymbols::java_lang_IncompatibleClassChangeError(), msg);
}
- if (fd.constants()->pool_holder()->major_version() >= 53) {
- methodHandle m = link_info.current_method();
- assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
- bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
- fd.is_static() &&
- !m()->is_static_initializer());
- bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
- !fd.is_static() &&
- !m->is_object_initializer());
+ // A final field can be modified only
+ // (1) by methods declared in the class declaring the field and
+ // (2) by the <clinit> method (in case of a static field)
+ // or by the <init> method (in case of an instance field).
+ if (is_put && fd.access_flags().is_final()) {
+ ResourceMark rm(THREAD);
+ stringStream ss;
- if (is_initialized_static_final_update || is_initialized_instance_final_update) {
- ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
+ if (sel_klass != current_klass) {
+ ss.print("Update to %s final field %s.%s attempted from a different class (%s) than the field's declaring class",
is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
- m()->name()->as_C_string(),
- is_static ? "<clinit>" : "<init>");
+ current_klass->external_name());
THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
}
+
+ if (fd.constants()->pool_holder()->major_version() >= 53) {
+ methodHandle m = link_info.current_method();
+ assert(!m.is_null(), "information about the current method must be available for 'put' bytecodes");
+ bool is_initialized_static_final_update = (byte == Bytecodes::_putstatic &&
+ fd.is_static() &&
+ !m()->is_static_initializer());
+ bool is_initialized_instance_final_update = ((byte == Bytecodes::_putfield || byte == Bytecodes::_nofast_putfield) &&
+ !fd.is_static() &&
+ !m->is_object_initializer());
+
+ if (is_initialized_static_final_update || is_initialized_instance_final_update) {
+ ss.print("Update to %s final field %s.%s attempted from a different method (%s) than the initializer method %s ",
+ is_static ? "static" : "non-static", resolved_klass->external_name(), fd.name()->as_C_string(),
+ m()->name()->as_C_string(),
+ is_static ? "<clinit>" : "<init>");
+ THROW_MSG(vmSymbols::java_lang_IllegalAccessError(), ss.as_string());
+ }
+ }
+ }
+
+ // initialize resolved_klass if necessary
+ // note 1: the klass which declared the field must be initialized (i.e, sel_klass)
+ // according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
+ //
+ // note 2: we don't want to force initialization if we are just checking
+ // if the field access is legal; e.g., during compilation
+ if (is_static && initialize_class) {
+ sel_klass->initialize(CHECK);
}
}
- // initialize resolved_klass if necessary
- // note 1: the klass which declared the field must be initialized (i.e, sel_klass)
- // according to the newest JVM spec (5.5, p.170) - was bug (gri 7/28/99)
- //
- // note 2: we don't want to force initialization if we are just checking
- // if the field access is legal; e.g., during compilation
- if (is_static && initialize_class) {
- sel_klass->initialize(CHECK);
- }
-
- if (sel_klass != current_klass) {
+ if ((sel_klass != current_klass) && (current_klass != NULL)) {
check_field_loader_constraints(field, sig, current_klass, sel_klass, CHECK);
}
--- a/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jfr/leakprofiler/chains/rootSetClosure.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -92,7 +92,7 @@
SaveRestoreCLDClaimBits save_restore_cld_claim_bits;
RootSetClosureMarkScope mark_scope;
- CLDToOopClosure cldt_closure(closure);
+ CLDToOopClosure cldt_closure(closure, ClassLoaderData::_claim_strong);
ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure);
CodeBlobToOopClosure blobs(closure, false);
Threads::oops_do(closure, &blobs);
--- a/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jfr/leakprofiler/checkpoint/rootResolver.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -128,7 +128,7 @@
bool ReferenceToRootClosure::do_cldg_roots() {
assert(!complete(), "invariant");
ReferenceLocateClosure rlc(_callback, OldObjectRoot::_class_loader_data, OldObjectRoot::_type_undetermined, NULL);
- CLDToOopClosure cldt_closure(&rlc);
+ CLDToOopClosure cldt_closure(&rlc, ClassLoaderData::_claim_strong);
ClassLoaderDataGraph::always_strong_cld_do(&cldt_closure);
return rlc.complete();
}
--- a/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jfr/leakprofiler/utilities/saveRestore.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -69,12 +69,12 @@
CLDClaimContext::CLDClaimContext(ClassLoaderData* cld) : _cld(cld) {
assert(_cld->claimed(), "invariant");
- _cld->clear_claimed();
+ _cld->clear_claim();
}
CLDClaimContext::~CLDClaimContext() {
if (_cld != NULL) {
- _cld->claim();
+ _cld->try_claim(ClassLoaderData::_claim_strong);
assert(_cld->claimed(), "invariant");
}
}
--- a/src/hotspot/share/jvmci/jvmciJavaClasses.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jvmci/jvmciJavaClasses.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -323,7 +323,7 @@
static void check(oop obj, const char* field_name, int offset); \
static void compute_offsets(TRAPS); \
public: \
- static InstanceKlass* klass() { return SystemDictionary::name##_klass(); }
+ static InstanceKlass* klass() { return SystemDictionary::name##_klass_is_loaded() ? SystemDictionary::name##_klass() : NULL; }
#define END_CLASS };
--- a/src/hotspot/share/jvmci/systemDictionary_jvmci.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/jvmci/systemDictionary_jvmci.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -27,68 +27,68 @@
#if !INCLUDE_JVMCI
#define JVMCI_WK_KLASSES_DO(do_klass)
#else
-#define JVMCI_WK_KLASSES_DO(do_klass) \
- /* JVMCI classes. These are loaded on-demand. */ \
- do_klass(JVMCI_klass, jdk_vm_ci_runtime_JVMCI, Jvmci) \
- do_klass(HotSpotCompiledCode_klass, jdk_vm_ci_hotspot_HotSpotCompiledCode, Jvmci) \
- do_klass(HotSpotCompiledCode_Comment_klass, jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment, Jvmci) \
- do_klass(HotSpotCompiledNmethod_klass, jdk_vm_ci_hotspot_HotSpotCompiledNmethod, Jvmci) \
- do_klass(HotSpotForeignCallTarget_klass, jdk_vm_ci_hotspot_HotSpotForeignCallTarget, Jvmci) \
- do_klass(HotSpotReferenceMap_klass, jdk_vm_ci_hotspot_HotSpotReferenceMap, Jvmci) \
- do_klass(HotSpotInstalledCode_klass, jdk_vm_ci_hotspot_HotSpotInstalledCode, Jvmci) \
- do_klass(HotSpotNmethod_klass, jdk_vm_ci_hotspot_HotSpotNmethod, Jvmci) \
- do_klass(HotSpotResolvedJavaMethodImpl_klass, jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl, Jvmci) \
- do_klass(HotSpotResolvedObjectTypeImpl_klass, jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl, Jvmci) \
- do_klass(HotSpotCompressedNullConstant_klass, jdk_vm_ci_hotspot_HotSpotCompressedNullConstant, Jvmci) \
- do_klass(HotSpotObjectConstantImpl_klass, jdk_vm_ci_hotspot_HotSpotObjectConstantImpl, Jvmci) \
- do_klass(HotSpotMetaspaceConstantImpl_klass, jdk_vm_ci_hotspot_HotSpotMetaspaceConstantImpl, Jvmci) \
- do_klass(HotSpotSentinelConstant_klass, jdk_vm_ci_hotspot_HotSpotSentinelConstant, Jvmci) \
- do_klass(HotSpotStackFrameReference_klass, jdk_vm_ci_hotspot_HotSpotStackFrameReference, Jvmci) \
- do_klass(HotSpotMetaData_klass, jdk_vm_ci_hotspot_HotSpotMetaData, Jvmci) \
- do_klass(HotSpotConstantPool_klass, jdk_vm_ci_hotspot_HotSpotConstantPool, Jvmci) \
- do_klass(HotSpotJVMCIMetaAccessContext_klass, jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext, Jvmci) \
- do_klass(HotSpotJVMCIRuntime_klass, jdk_vm_ci_hotspot_HotSpotJVMCIRuntime, Jvmci) \
- do_klass(HotSpotSpeculationLog_klass, jdk_vm_ci_hotspot_HotSpotSpeculationLog, Jvmci) \
- do_klass(HotSpotCompilationRequestResult_klass, jdk_vm_ci_hotspot_HotSpotCompilationRequestResult, Jvmci) \
- do_klass(VMField_klass, jdk_vm_ci_hotspot_VMField, Jvmci) \
- do_klass(VMFlag_klass, jdk_vm_ci_hotspot_VMFlag, Jvmci) \
- do_klass(VMIntrinsicMethod_klass, jdk_vm_ci_hotspot_VMIntrinsicMethod, Jvmci) \
- do_klass(Assumptions_ConcreteMethod_klass, jdk_vm_ci_meta_Assumptions_ConcreteMethod, Jvmci) \
- do_klass(Assumptions_NoFinalizableSubclass_klass, jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass, Jvmci) \
- do_klass(Assumptions_ConcreteSubtype_klass, jdk_vm_ci_meta_Assumptions_ConcreteSubtype, Jvmci) \
- do_klass(Assumptions_LeafType_klass, jdk_vm_ci_meta_Assumptions_LeafType, Jvmci) \
- do_klass(Assumptions_CallSiteTargetValue_klass, jdk_vm_ci_meta_Assumptions_CallSiteTargetValue, Jvmci) \
- do_klass(Architecture_klass, jdk_vm_ci_code_Architecture, Jvmci) \
- do_klass(TargetDescription_klass, jdk_vm_ci_code_TargetDescription, Jvmci) \
- do_klass(BytecodePosition_klass, jdk_vm_ci_code_BytecodePosition, Jvmci) \
- do_klass(DebugInfo_klass, jdk_vm_ci_code_DebugInfo, Jvmci) \
- do_klass(RegisterSaveLayout_klass, jdk_vm_ci_code_RegisterSaveLayout, Jvmci) \
- do_klass(BytecodeFrame_klass, jdk_vm_ci_code_BytecodeFrame, Jvmci) \
- do_klass(InstalledCode_klass, jdk_vm_ci_code_InstalledCode, Jvmci) \
- do_klass(code_Location_klass, jdk_vm_ci_code_Location, Jvmci) \
- do_klass(code_Register_klass, jdk_vm_ci_code_Register, Jvmci) \
- do_klass(RegisterValue_klass, jdk_vm_ci_code_RegisterValue, Jvmci) \
- do_klass(StackSlot_klass, jdk_vm_ci_code_StackSlot, Jvmci) \
- do_klass(StackLockValue_klass, jdk_vm_ci_code_StackLockValue, Jvmci) \
- do_klass(VirtualObject_klass, jdk_vm_ci_code_VirtualObject, Jvmci) \
- do_klass(site_Call_klass, jdk_vm_ci_code_site_Call, Jvmci) \
- do_klass(site_ConstantReference_klass, jdk_vm_ci_code_site_ConstantReference, Jvmci) \
- do_klass(site_DataPatch_klass, jdk_vm_ci_code_site_DataPatch, Jvmci) \
- do_klass(site_DataSectionReference_klass, jdk_vm_ci_code_site_DataSectionReference, Jvmci) \
- do_klass(site_ExceptionHandler_klass, jdk_vm_ci_code_site_ExceptionHandler, Jvmci) \
- do_klass(site_Mark_klass, jdk_vm_ci_code_site_Mark, Jvmci) \
- do_klass(site_Infopoint_klass, jdk_vm_ci_code_site_Infopoint, Jvmci) \
- do_klass(site_Site_klass, jdk_vm_ci_code_site_Site, Jvmci) \
- do_klass(site_InfopointReason_klass, jdk_vm_ci_code_site_InfopointReason, Jvmci) \
- do_klass(InspectedFrameVisitor_klass, jdk_vm_ci_code_stack_InspectedFrameVisitor, Jvmci) \
- do_klass(JavaConstant_klass, jdk_vm_ci_meta_JavaConstant, Jvmci) \
- do_klass(PrimitiveConstant_klass, jdk_vm_ci_meta_PrimitiveConstant, Jvmci) \
- do_klass(RawConstant_klass, jdk_vm_ci_meta_RawConstant, Jvmci) \
- do_klass(NullConstant_klass, jdk_vm_ci_meta_NullConstant, Jvmci) \
- do_klass(ExceptionHandler_klass, jdk_vm_ci_meta_ExceptionHandler, Jvmci) \
- do_klass(JavaKind_klass, jdk_vm_ci_meta_JavaKind, Jvmci) \
- do_klass(ValueKind_klass, jdk_vm_ci_meta_ValueKind, Jvmci) \
- do_klass(Value_klass, jdk_vm_ci_meta_Value, Jvmci)
+#define JVMCI_WK_KLASSES_DO(do_klass) \
+ /* JVMCI classes. These are loaded on-demand. */ \
+ do_klass(JVMCI_klass, jdk_vm_ci_runtime_JVMCI ) \
+ do_klass(HotSpotCompiledCode_klass, jdk_vm_ci_hotspot_HotSpotCompiledCode ) \
+ do_klass(HotSpotCompiledCode_Comment_klass, jdk_vm_ci_hotspot_HotSpotCompiledCode_Comment ) \
+ do_klass(HotSpotCompiledNmethod_klass, jdk_vm_ci_hotspot_HotSpotCompiledNmethod ) \
+ do_klass(HotSpotForeignCallTarget_klass, jdk_vm_ci_hotspot_HotSpotForeignCallTarget ) \
+ do_klass(HotSpotReferenceMap_klass, jdk_vm_ci_hotspot_HotSpotReferenceMap ) \
+ do_klass(HotSpotInstalledCode_klass, jdk_vm_ci_hotspot_HotSpotInstalledCode ) \
+ do_klass(HotSpotNmethod_klass, jdk_vm_ci_hotspot_HotSpotNmethod ) \
+ do_klass(HotSpotResolvedJavaMethodImpl_klass, jdk_vm_ci_hotspot_HotSpotResolvedJavaMethodImpl ) \
+ do_klass(HotSpotResolvedObjectTypeImpl_klass, jdk_vm_ci_hotspot_HotSpotResolvedObjectTypeImpl ) \
+ do_klass(HotSpotCompressedNullConstant_klass, jdk_vm_ci_hotspot_HotSpotCompressedNullConstant ) \
+ do_klass(HotSpotObjectConstantImpl_klass, jdk_vm_ci_hotspot_HotSpotObjectConstantImpl ) \
+ do_klass(HotSpotMetaspaceConstantImpl_klass, jdk_vm_ci_hotspot_HotSpotMetaspaceConstantImpl ) \
+ do_klass(HotSpotSentinelConstant_klass, jdk_vm_ci_hotspot_HotSpotSentinelConstant ) \
+ do_klass(HotSpotStackFrameReference_klass, jdk_vm_ci_hotspot_HotSpotStackFrameReference ) \
+ do_klass(HotSpotMetaData_klass, jdk_vm_ci_hotspot_HotSpotMetaData ) \
+ do_klass(HotSpotConstantPool_klass, jdk_vm_ci_hotspot_HotSpotConstantPool ) \
+ do_klass(HotSpotJVMCIMetaAccessContext_klass, jdk_vm_ci_hotspot_HotSpotJVMCIMetaAccessContext ) \
+ do_klass(HotSpotJVMCIRuntime_klass, jdk_vm_ci_hotspot_HotSpotJVMCIRuntime ) \
+ do_klass(HotSpotSpeculationLog_klass, jdk_vm_ci_hotspot_HotSpotSpeculationLog ) \
+ do_klass(HotSpotCompilationRequestResult_klass, jdk_vm_ci_hotspot_HotSpotCompilationRequestResult) \
+ do_klass(VMField_klass, jdk_vm_ci_hotspot_VMField ) \
+ do_klass(VMFlag_klass, jdk_vm_ci_hotspot_VMFlag ) \
+ do_klass(VMIntrinsicMethod_klass, jdk_vm_ci_hotspot_VMIntrinsicMethod ) \
+ do_klass(Assumptions_ConcreteMethod_klass, jdk_vm_ci_meta_Assumptions_ConcreteMethod ) \
+ do_klass(Assumptions_NoFinalizableSubclass_klass, jdk_vm_ci_meta_Assumptions_NoFinalizableSubclass ) \
+ do_klass(Assumptions_ConcreteSubtype_klass, jdk_vm_ci_meta_Assumptions_ConcreteSubtype ) \
+ do_klass(Assumptions_LeafType_klass, jdk_vm_ci_meta_Assumptions_LeafType ) \
+ do_klass(Assumptions_CallSiteTargetValue_klass, jdk_vm_ci_meta_Assumptions_CallSiteTargetValue ) \
+ do_klass(Architecture_klass, jdk_vm_ci_code_Architecture ) \
+ do_klass(TargetDescription_klass, jdk_vm_ci_code_TargetDescription ) \
+ do_klass(BytecodePosition_klass, jdk_vm_ci_code_BytecodePosition ) \
+ do_klass(DebugInfo_klass, jdk_vm_ci_code_DebugInfo ) \
+ do_klass(RegisterSaveLayout_klass, jdk_vm_ci_code_RegisterSaveLayout ) \
+ do_klass(BytecodeFrame_klass, jdk_vm_ci_code_BytecodeFrame ) \
+ do_klass(InstalledCode_klass, jdk_vm_ci_code_InstalledCode ) \
+ do_klass(code_Location_klass, jdk_vm_ci_code_Location ) \
+ do_klass(code_Register_klass, jdk_vm_ci_code_Register ) \
+ do_klass(RegisterValue_klass, jdk_vm_ci_code_RegisterValue ) \
+ do_klass(StackSlot_klass, jdk_vm_ci_code_StackSlot ) \
+ do_klass(StackLockValue_klass, jdk_vm_ci_code_StackLockValue ) \
+ do_klass(VirtualObject_klass, jdk_vm_ci_code_VirtualObject ) \
+ do_klass(site_Call_klass, jdk_vm_ci_code_site_Call ) \
+ do_klass(site_ConstantReference_klass, jdk_vm_ci_code_site_ConstantReference ) \
+ do_klass(site_DataPatch_klass, jdk_vm_ci_code_site_DataPatch ) \
+ do_klass(site_DataSectionReference_klass, jdk_vm_ci_code_site_DataSectionReference ) \
+ do_klass(site_ExceptionHandler_klass, jdk_vm_ci_code_site_ExceptionHandler ) \
+ do_klass(site_Mark_klass, jdk_vm_ci_code_site_Mark ) \
+ do_klass(site_Infopoint_klass, jdk_vm_ci_code_site_Infopoint ) \
+ do_klass(site_Site_klass, jdk_vm_ci_code_site_Site ) \
+ do_klass(site_InfopointReason_klass, jdk_vm_ci_code_site_InfopointReason ) \
+ do_klass(InspectedFrameVisitor_klass, jdk_vm_ci_code_stack_InspectedFrameVisitor ) \
+ do_klass(JavaConstant_klass, jdk_vm_ci_meta_JavaConstant ) \
+ do_klass(PrimitiveConstant_klass, jdk_vm_ci_meta_PrimitiveConstant ) \
+ do_klass(RawConstant_klass, jdk_vm_ci_meta_RawConstant ) \
+ do_klass(NullConstant_klass, jdk_vm_ci_meta_NullConstant ) \
+ do_klass(ExceptionHandler_klass, jdk_vm_ci_meta_ExceptionHandler ) \
+ do_klass(JavaKind_klass, jdk_vm_ci_meta_JavaKind ) \
+ do_klass(ValueKind_klass, jdk_vm_ci_meta_ValueKind ) \
+ do_klass(Value_klass, jdk_vm_ci_meta_Value )
#endif
#endif // SHARE_VM_JVMCI_SYSTEMDICTIONARY_JVMCI_HPP
--- a/src/hotspot/share/memory/iterator.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/memory/iterator.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -32,7 +32,7 @@
DoNothingClosure do_nothing_cl;
void CLDToOopClosure::do_cld(ClassLoaderData* cld) {
- cld->oops_do(_oop_closure, _must_claim_cld);
+ cld->oops_do(_oop_closure, _cld_claim);
}
void ObjectToOopClosure::do_object(oop obj) {
--- a/src/hotspot/share/memory/iterator.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/memory/iterator.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -127,12 +127,13 @@
class CLDToOopClosure : public CLDClosure {
OopClosure* _oop_closure;
- bool _must_claim_cld;
+ int _cld_claim;
public:
- CLDToOopClosure(OopClosure* oop_closure, bool must_claim_cld = true) :
+ CLDToOopClosure(OopClosure* oop_closure,
+ int cld_claim) :
_oop_closure(oop_closure),
- _must_claim_cld(must_claim_cld) {}
+ _cld_claim(cld_claim) {}
void do_cld(ClassLoaderData* cld);
};
--- a/src/hotspot/share/memory/iterator.inline.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/memory/iterator.inline.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -39,8 +39,7 @@
#include "utilities/debug.hpp"
inline void MetadataVisitingOopIterateClosure::do_cld(ClassLoaderData* cld) {
- bool claim = true; // Must claim the class loader data before processing.
- cld->oops_do(this, claim);
+ cld->oops_do(this, ClassLoaderData::_claim_strong);
}
inline void MetadataVisitingOopIterateClosure::do_klass(Klass* k) {
--- a/src/hotspot/share/oops/instanceKlass.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -1195,7 +1195,7 @@
// Iterate over all oop fields and metadata.
template <typename T, class OopClosureType>
- inline int oop_oop_iterate(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate(oop obj, OopClosureType* closure);
// Iterate over all oop fields in one oop map.
template <typename T, class OopClosureType>
@@ -1205,7 +1205,7 @@
// Reverse iteration
// Iterate over all oop fields and metadata.
template <typename T, class OopClosureType>
- inline int oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
+ inline void oop_oop_iterate_reverse(oop obj, OopClosureType* closure);
private:
// Iterate over all oop fields in the oop maps.
@@ -1225,7 +1225,7 @@
// Iterate over all oop fields and metadata.
template <typename T, class OopClosureType>
- inline int oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
+ inline void oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr);
private:
// Iterate over all oop fields in one oop map.
--- a/src/hotspot/share/oops/instanceKlass.inline.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/oops/instanceKlass.inline.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -130,28 +130,24 @@
}
template <typename T, class OopClosureType>
-ALWAYSINLINE int InstanceKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
+ALWAYSINLINE void InstanceKlass::oop_oop_iterate(oop obj, OopClosureType* closure) {
if (Devirtualizer::do_metadata(closure)) {
Devirtualizer::do_klass(closure, this);
}
oop_oop_iterate_oop_maps<T>(obj, closure);
-
- return size_helper();
}
template <typename T, class OopClosureType>
-ALWAYSINLINE int InstanceKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
+ALWAYSINLINE void InstanceKlass::oop_oop_iterate_reverse(oop obj, OopClosureType* closure) {
assert(!Devirtualizer::do_metadata(closure),
"Code to handle metadata is not implemented");
oop_oop_iterate_oop_maps_reverse<T>(obj, closure);
-
- return size_helper();
}
template <typename T, class OopClosureType>
-ALWAYSINLINE int InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
+ALWAYSINLINE void InstanceKlass::oop_oop_iterate_bounded(oop obj, OopClosureType* closure, MemRegion mr) {
if (Devirtualizer::do_metadata(closure)) {
if (mr.contains(obj)) {
Devirtualizer::do_klass(closure, this);
@@ -159,8 +155,6 @@
}
oop_oop_iterate_oop_maps_bounded<T>(obj, closure, mr);
-
- return size_helper();
}
#endif // SHARE_VM_OOPS_INSTANCEKLASS_INLINE_HPP
--- a/src/hotspot/share/oops/symbol.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/oops/symbol.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -294,28 +294,20 @@
}
void Symbol::print_on(outputStream* st) const {
- if (this == NULL) {
- st->print_cr("NULL");
- } else {
- st->print("Symbol: '");
- print_symbol_on(st);
- st->print("'");
- st->print(" count %d", refcount());
- }
+ st->print("Symbol: '");
+ print_symbol_on(st);
+ st->print("'");
+ st->print(" count %d", refcount());
}
// The print_value functions are present in all builds, to support the
// disassembler and error reporting.
void Symbol::print_value_on(outputStream* st) const {
- if (this == NULL) {
- st->print("NULL");
- } else {
- st->print("'");
- for (int i = 0; i < utf8_length(); i++) {
- st->print("%c", char_at(i));
- }
- st->print("'");
+ st->print("'");
+ for (int i = 0; i < utf8_length(); i++) {
+ st->print("%c", char_at(i));
}
+ st->print("'");
}
bool Symbol::is_valid(Symbol* s) {
--- a/src/hotspot/share/opto/cfgnode.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/cfgnode.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -714,10 +714,151 @@
}
}
+ if (can_reshape) {
+ modified |= optimize_trichotomy(phase->is_IterGVN());
+ }
+
return modified ? this : NULL;
}
-
+//------------------------------optimize_trichotomy--------------------------
+// Optimize nested comparisons of the following kind:
+//
+// int compare(int a, int b) {
+// return (a < b) ? -1 : (a == b) ? 0 : 1;
+// }
+//
+// Shape 1:
+// if (compare(a, b) == 1) { ... } -> if (a > b) { ... }
+//
+// Shape 2:
+// if (compare(a, b) == 0) { ... } -> if (a == b) { ... }
+//
+// Above code leads to the following IR shapes where both Ifs compare the
+// same value and two out of three region inputs idx1 and idx2 map to
+// the same value and control flow.
+//
+// (1) If (2) If
+// / \ / \
+// Proj Proj Proj Proj
+// | \ | \
+// | If | If If
+// | / \ | / \ / \
+// | Proj Proj | Proj Proj ==> Proj Proj
+// | / / \ | / | /
+// Region / \ | / | /
+// \ / \ | / | /
+// Region Region Region
+//
+// The method returns true if 'this' is modified and false otherwise.
+bool RegionNode::optimize_trichotomy(PhaseIterGVN* igvn) {
+ int idx1 = 1, idx2 = 2;
+ Node* region = NULL;
+ if (req() == 3 && in(1) != NULL && in(2) != NULL) {
+ // Shape 1: Check if one of the inputs is a region that merges two control
+ // inputs and has no other users (especially no Phi users).
+ region = in(1)->isa_Region() ? in(1) : in(2)->isa_Region();
+ if (region == NULL || region->outcnt() != 2 || region->req() != 3) {
+ return false; // No suitable region input found
+ }
+ } else if (req() == 4) {
+ // Shape 2: Check if two control inputs map to the same value of the unique phi
+ // user and treat these as if they would come from another region (shape (1)).
+ PhiNode* phi = has_unique_phi();
+ if (phi == NULL) {
+ return false; // No unique phi user
+ }
+ if (phi->in(idx1) != phi->in(idx2)) {
+ idx2 = 3;
+ if (phi->in(idx1) != phi->in(idx2)) {
+ idx1 = 2;
+ if (phi->in(idx1) != phi->in(idx2)) {
+ return false; // No equal phi inputs found
+ }
+ }
+ }
+ assert(phi->in(idx1) == phi->in(idx2), "must be"); // Region is merging same value
+ region = this;
+ }
+ if (region == NULL || region->in(idx1) == NULL || region->in(idx2) == NULL) {
+ return false; // Region does not merge two control inputs
+ }
+ // At this point we know that region->in(idx1) and region->(idx2) map to the same
+ // value and control flow. Now search for ifs that feed into these region inputs.
+ ProjNode* proj1 = region->in(idx1)->isa_Proj();
+ ProjNode* proj2 = region->in(idx2)->isa_Proj();
+ if (proj1 == NULL || proj1->outcnt() != 1 ||
+ proj2 == NULL || proj2->outcnt() != 1) {
+ return false; // No projection inputs with region as unique user found
+ }
+ assert(proj1 != proj2, "should be different projections");
+ IfNode* iff1 = proj1->in(0)->isa_If();
+ IfNode* iff2 = proj2->in(0)->isa_If();
+ if (iff1 == NULL || iff1->outcnt() != 2 ||
+ iff2 == NULL || iff2->outcnt() != 2) {
+ return false; // No ifs found
+ }
+ if (iff1 == iff2) {
+ igvn->add_users_to_worklist(iff1); // Make sure dead if is eliminated
+ igvn->replace_input_of(region, idx1, iff1->in(0));
+ igvn->replace_input_of(region, idx2, igvn->C->top());
+ return (region == this); // Remove useless if (both projections map to the same control/value)
+ }
+ BoolNode* bol1 = iff1->in(1)->isa_Bool();
+ BoolNode* bol2 = iff2->in(1)->isa_Bool();
+ if (bol1 == NULL || bol2 == NULL) {
+ return false; // No bool inputs found
+ }
+ Node* cmp1 = bol1->in(1);
+ Node* cmp2 = bol2->in(1);
+ bool commute = false;
+ if (!cmp1->is_Cmp() || !cmp2->is_Cmp()) {
+ return false; // No comparison
+ } else if (cmp1->Opcode() == Op_CmpF || cmp1->Opcode() == Op_CmpD ||
+ cmp2->Opcode() == Op_CmpF || cmp2->Opcode() == Op_CmpD ||
+ cmp1->Opcode() == Op_CmpP || cmp1->Opcode() == Op_CmpN ||
+ cmp2->Opcode() == Op_CmpP || cmp2->Opcode() == Op_CmpN) {
+ // Floats and pointers don't exactly obey trichotomy. To be on the safe side, don't transform their tests.
+ return false;
+ } else if (cmp1 != cmp2) {
+ if (cmp1->in(1) == cmp2->in(2) &&
+ cmp1->in(2) == cmp2->in(1)) {
+ commute = true; // Same but swapped inputs, commute the test
+ } else {
+ return false; // Ifs are not comparing the same values
+ }
+ }
+ proj1 = proj1->other_if_proj();
+ proj2 = proj2->other_if_proj();
+ if (!((proj1->unique_ctrl_out() == iff2 &&
+ proj2->unique_ctrl_out() == this) ||
+ (proj2->unique_ctrl_out() == iff1 &&
+ proj1->unique_ctrl_out() == this))) {
+ return false; // Ifs are not connected through other projs
+ }
+ // Found 'iff -> proj -> iff -> proj -> this' shape where all other projs are merged
+ // through 'region' and map to the same value. Merge the boolean tests and replace
+ // the ifs by a single comparison.
+ BoolTest test1 = (proj1->_con == 1) ? bol1->_test : bol1->_test.negate();
+ BoolTest test2 = (proj2->_con == 1) ? bol2->_test : bol2->_test.negate();
+ test1 = commute ? test1.commute() : test1;
+ // After possibly commuting test1, if we can merge test1 & test2, then proj2/iff2/bol2 are the nodes to refine.
+ BoolTest::mask res = test1.merge(test2);
+ if (res == BoolTest::illegal) {
+ return false; // Unable to merge tests
+ }
+ // Adjust iff1 to always pass (only iff2 will remain)
+ igvn->replace_input_of(iff1, 1, igvn->intcon(proj1->_con));
+ if (res == BoolTest::never) {
+ // Merged test is always false, adjust iff2 to always fail
+ igvn->replace_input_of(iff2, 1, igvn->intcon(1 - proj2->_con));
+ } else {
+ // Replace bool input of iff2 with merged test
+ BoolNode* new_bol = new BoolNode(bol2->in(1), res);
+ igvn->replace_input_of(iff2, 1, igvn->transform((proj2->_con == 1) ? new_bol : new_bol->negate(igvn)));
+ }
+ return false;
+}
const RegMask &RegionNode::out_RegMask() const {
return RegMask::Empty;
--- a/src/hotspot/share/opto/cfgnode.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/cfgnode.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -96,6 +96,7 @@
virtual Node *Ideal(PhaseGVN *phase, bool can_reshape);
virtual const RegMask &out_RegMask() const;
bool try_clean_mem_phi(PhaseGVN *phase);
+ bool optimize_trichotomy(PhaseIterGVN* igvn);
};
//------------------------------JProjNode--------------------------------------
--- a/src/hotspot/share/opto/node.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/node.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -899,6 +899,13 @@
return (Node*) this;
}
+bool Node::eqv_uncast(const Node* n) const {
+ BarrierSetC2* bs = BarrierSet::barrier_set()->barrier_set_c2();
+ Node* obj1 = bs->step_over_gc_barrier(const_cast<Node*>(this));
+ Node* obj2 = bs->step_over_gc_barrier(const_cast<Node*>(n));
+ return (obj1->uncast() == obj2->uncast());
+}
+
// Find out of current node that matches opcode.
Node* Node::find_out_with(int opcode) {
for (DUIterator_Fast imax, i = fast_outs(imax); i < imax; i++) {
--- a/src/hotspot/share/opto/node.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/node.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -457,10 +457,9 @@
// Strip away casting. (It is depth-limited.)
Node* uncast() const;
- // Return whether two Nodes are equivalent, after stripping casting.
- bool eqv_uncast(const Node* n) const {
- return (this->uncast() == n->uncast());
- }
+ // Return whether two Nodes are equivalent, after stripping casting
+ // and GC barriers.
+ bool eqv_uncast(const Node* n) const;
// Find out of current node that matches opcode.
Node* find_out_with(int opcode);
--- a/src/hotspot/share/opto/subnode.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/subnode.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -1252,6 +1252,24 @@
st->print("%s", msg[_test]);
}
+// Returns the logical AND of two tests (or 'never' if both tests can never be true).
+// For example, a test for 'le' followed by a test for 'lt' is equivalent with 'lt'.
+BoolTest::mask BoolTest::merge(BoolTest other) const {
+ const mask res[illegal+1][illegal+1] = {
+ // eq, gt, of, lt, ne, le, nof, ge, never, illegal
+ {eq, never, illegal, never, never, eq, illegal, eq, never, illegal}, // eq
+ {never, gt, illegal, never, gt, never, illegal, gt, never, illegal}, // gt
+ {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, never, illegal}, // of
+ {never, never, illegal, lt, lt, lt, illegal, never, never, illegal}, // lt
+ {never, gt, illegal, lt, ne, lt, illegal, gt, never, illegal}, // ne
+ {eq, never, illegal, lt, lt, le, illegal, eq, never, illegal}, // le
+ {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, never, illegal}, // nof
+ {eq, gt, illegal, never, gt, eq, illegal, ge, never, illegal}, // ge
+ {never, never, never, never, never, never, never, never, never, illegal}, // never
+ {illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal, illegal}}; // illegal
+ return res[_test][other._test];
+}
+
//=============================================================================
uint BoolNode::hash() const { return (Node::hash() << 3)|(_test._test+1); }
uint BoolNode::size_of() const { return sizeof(BoolNode); }
--- a/src/hotspot/share/opto/subnode.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/opto/subnode.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -280,7 +280,7 @@
// We pick the values as 3 bits; the low order 2 bits we compare against the
// condition codes, the high bit flips the sense of the result.
struct BoolTest {
- enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, illegal = 8 };
+ enum mask { eq = 0, ne = 4, le = 5, ge = 7, lt = 3, gt = 1, overflow = 2, no_overflow = 6, never = 8, illegal = 9 };
mask _test;
BoolTest( mask btm ) : _test(btm) {}
const Type *cc2logical( const Type *CC ) const;
@@ -293,6 +293,7 @@
bool is_less( ) const { return _test == BoolTest::lt || _test == BoolTest::le; }
bool is_greater( ) const { return _test == BoolTest::gt || _test == BoolTest::ge; }
void dump_on(outputStream *st) const;
+ mask merge(BoolTest other) const;
};
//------------------------------BoolNode---------------------------------------
--- a/src/hotspot/share/prims/jvm.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/prims/jvm.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -3736,8 +3736,8 @@
{
memset(info, 0, info_size);
- info->jvm_version = Abstract_VM_Version::jvm_version();
- info->patch_version = Abstract_VM_Version::vm_patch_version();
+ info->jvm_version = VM_Version::jvm_version();
+ info->patch_version = VM_Version::vm_patch_version();
// when we add a new capability in the jvm_version_info struct, we should also
// consider to expose this new capability in the sun.rt.jvmCapabilities jvmstat
--- a/src/hotspot/share/prims/jvmtiEnv.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiEnv.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -919,7 +919,7 @@
thread_objs = NEW_RESOURCE_ARRAY(Handle, nthreads);
NULL_CHECK(thread_objs, JVMTI_ERROR_OUT_OF_MEMORY);
- for (int i=0; i < nthreads; i++) {
+ for (int i = 0; i < nthreads; i++) {
thread_objs[i] = Handle(tle.get_threadObj(i));
}
@@ -1144,16 +1144,14 @@
Handle context_class_loader;
bool is_daemon;
- { MutexLocker mu(Threads_lock);
-
- name = Handle(current_thread, java_lang_Thread::name(thread_obj()));
- priority = java_lang_Thread::priority(thread_obj());
- thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj()));
- is_daemon = java_lang_Thread::is_daemon(thread_obj());
-
- oop loader = java_lang_Thread::context_class_loader(thread_obj());
- context_class_loader = Handle(current_thread, loader);
- }
+ name = Handle(current_thread, java_lang_Thread::name(thread_obj()));
+ priority = java_lang_Thread::priority(thread_obj());
+ thread_group = Handle(current_thread, java_lang_Thread::threadGroup(thread_obj()));
+ is_daemon = java_lang_Thread::is_daemon(thread_obj());
+
+ oop loader = java_lang_Thread::context_class_loader(thread_obj());
+ context_class_loader = Handle(current_thread, loader);
+
{ const char *n;
if (name() != NULL) {
@@ -1402,13 +1400,10 @@
bool is_daemon;
ThreadPriority max_priority;
- { MutexLocker mu(Threads_lock);
-
- name = java_lang_ThreadGroup::name(group_obj());
- parent_group = Handle(current_thread, java_lang_ThreadGroup::parent(group_obj()));
- is_daemon = java_lang_ThreadGroup::is_daemon(group_obj());
- max_priority = java_lang_ThreadGroup::maxPriority(group_obj());
- }
+ name = java_lang_ThreadGroup::name(group_obj());
+ parent_group = Handle(current_thread, java_lang_ThreadGroup::parent(group_obj()));
+ is_daemon = java_lang_ThreadGroup::is_daemon(group_obj());
+ max_priority = java_lang_ThreadGroup::maxPriority(group_obj());
info_ptr->is_daemon = is_daemon;
info_ptr->max_priority = max_priority;
@@ -1448,7 +1443,7 @@
Handle group_hdl(current_thread, group_obj);
{ // Cannot allow thread or group counts to change.
- MutexLocker mu(Threads_lock);
+ ObjectLocker ol(group_hdl, current_thread);
nthreads = java_lang_ThreadGroup::nthreads(group_hdl());
ngroups = java_lang_ThreadGroup::ngroups(group_hdl());
@@ -1458,7 +1453,7 @@
objArrayOop threads = java_lang_ThreadGroup::threads(group_hdl());
assert(nthreads <= threads->length(), "too many threads");
thread_objs = NEW_RESOURCE_ARRAY(Handle,nthreads);
- for (int i=0, j=0; i<nthreads; i++) {
+ for (int i = 0, j = 0; i < nthreads; i++) {
oop thread_obj = threads->obj_at(i);
assert(thread_obj != NULL, "thread_obj is NULL");
JavaThread *java_thread = NULL;
@@ -1490,15 +1485,14 @@
objArrayOop groups = java_lang_ThreadGroup::groups(group_hdl());
assert(ngroups <= groups->length(), "too many groups");
group_objs = NEW_RESOURCE_ARRAY(Handle,ngroups);
- for (int i=0; i<ngroups; i++) {
+ for (int i = 0; i < ngroups; i++) {
oop group_obj = groups->obj_at(i);
assert(group_obj != NULL, "group_obj != NULL");
group_objs[i] = Handle(current_thread, group_obj);
}
}
- }
-
- // have to make global handles outside of Threads_lock
+ } // ThreadGroup unlocked here
+
*group_count_ptr = ngroups;
*thread_count_ptr = nthreads;
*threads_ptr = new_jthreadArray(nthreads, thread_objs);
@@ -3246,7 +3240,7 @@
// objects that are locked.
int r;
intptr_t recursion = rmonitor->recursions();
- for (intptr_t i=0; i <= recursion; i++) {
+ for (intptr_t i = 0; i <= recursion; i++) {
r = rmonitor->raw_exit(thread);
assert(r == ObjectMonitor::OM_OK, "raw_exit should have worked");
if (r != ObjectMonitor::OM_OK) { // robustness
@@ -3676,7 +3670,7 @@
strcpy(*tmp_value, key);
} else {
// clean up previously allocated memory.
- for (int j=0; j<readable_count; j++) {
+ for (int j = 0; j < readable_count; j++) {
Deallocate((unsigned char*)*property_ptr+j);
}
Deallocate((unsigned char*)property_ptr);
--- a/src/hotspot/share/prims/jvmtiExport.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiExport.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -1044,7 +1044,7 @@
public:
JvmtiObjectAllocEventMark(JavaThread *thread, oop obj) : JvmtiClassEventMark(thread, oop_to_klass(obj)) {
_jobj = (jobject)to_jobject(obj);
- _size = obj->size() * wordSize;
+ _size = Universe::heap()->obj_size(obj) * wordSize;
};
jobject jni_jobject() { return _jobj; }
jlong size() { return _size; }
--- a/src/hotspot/share/prims/jvmtiTagMap.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/prims/jvmtiTagMap.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -105,7 +105,7 @@
}
inline bool equals(oop object) {
- return object == object_peek();
+ return oopDesc::equals(object, object_peek());
}
inline JvmtiTagHashmapEntry* next() const { return _next; }
@@ -186,6 +186,7 @@
// shift right to get better distribution (as these bits will be zero
// with aligned addresses)
+ key = Access<>::resolve(key);
unsigned int addr = (unsigned int)(cast_from_oop<intptr_t>(key));
#ifdef _LP64
return (addr >> 3) % size;
--- a/src/hotspot/share/runtime/arguments.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -106,6 +106,9 @@
AgentLibraryList Arguments::_libraryList;
AgentLibraryList Arguments::_agentList;
+// These are not set by the JDK's built-in launchers, but they can be set by
+// programs that embed the JVM using JNI_CreateJavaVM. See comments around
+// JavaVMOption in jni.h.
abort_hook_t Arguments::_abort_hook = NULL;
exit_hook_t Arguments::_exit_hook = NULL;
vfprintf_hook_t Arguments::_vfprintf_hook = NULL;
--- a/src/hotspot/share/runtime/arguments.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/arguments.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -36,7 +36,7 @@
// Arguments parses the command line and recognizes options
-// Invocation API hook typedefs (these should really be defined in jni.hpp)
+// Invocation API hook typedefs (these should really be defined in jni.h)
extern "C" {
typedef void (JNICALL *abort_hook_t)(void);
typedef void (JNICALL *exit_hook_t)(jint code);
--- a/src/hotspot/share/runtime/mutexLocker.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/mutexLocker.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -166,6 +166,16 @@
fatal("must own lock %s", lock->name());
}
+// a weaker assertion than the above
+void assert_locked_or_safepoint_weak(const Monitor * lock) {
+ if (IgnoreLockingAssertions) return;
+ assert(lock != NULL, "Need non-NULL lock");
+ if (lock->is_locked()) return;
+ if (SafepointSynchronize::is_at_safepoint()) return;
+ if (!Universe::is_fully_initialized()) return;
+ fatal("must own lock %s", lock->name());
+}
+
// a stronger assertion than the above
void assert_lock_strong(const Monitor * lock) {
if (IgnoreLockingAssertions) return;
--- a/src/hotspot/share/runtime/mutexLocker.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/mutexLocker.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -199,9 +199,11 @@
// for debugging: check that we're already owning this lock (or are at a safepoint)
#ifdef ASSERT
void assert_locked_or_safepoint(const Monitor * lock);
+void assert_locked_or_safepoint_weak(const Monitor * lock);
void assert_lock_strong(const Monitor * lock);
#else
#define assert_locked_or_safepoint(lock)
+#define assert_locked_or_safepoint_weak(lock)
#define assert_lock_strong(lock)
#endif
--- a/src/hotspot/share/runtime/perfData.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/perfData.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -323,7 +323,12 @@
}
PerfData* PerfDataManager::find_by_name(const char* name) {
- return _all->find_by_name(name);
+ // if add_item hasn't been called the list won't be initialized
+ if (_all != NULL) {
+ return _all->find_by_name(name);
+ } else {
+ return NULL;
+ }
}
PerfDataList* PerfDataManager::all() {
@@ -591,10 +596,6 @@
PerfData* PerfDataList::find_by_name(const char* name) {
- // if add_item hasn't been called the list won't be initialized
- if (this == NULL)
- return NULL;
-
int i = _set->find((void*)name, PerfDataList::by_name);
if (i >= 0 && i <= _set->length())
--- a/src/hotspot/share/runtime/perfData.inline.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/perfData.inline.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -58,7 +58,11 @@
}
inline bool PerfDataManager::exists(const char* name) {
- return _all->contains(name);
+ if (_all != NULL) {
+ return _all->contains(name);
+ } else {
+ return false;
+ }
}
#endif // SHARE_VM_RUNTIME_PERFDATA_INLINE_HPP
--- a/src/hotspot/share/runtime/reflection.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/reflection.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -503,7 +503,8 @@
}
// Allow all accesses from jdk/internal/reflect/MagicAccessorImpl subclasses to
// succeed trivially.
- if (current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
+ if (SystemDictionary::reflect_MagicAccessorImpl_klass_is_loaded() &&
+ current_class->is_subclass_of(SystemDictionary::reflect_MagicAccessorImpl_klass())) {
return ACCESS_OK;
}
--- a/src/hotspot/share/runtime/thread.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/thread.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -4569,9 +4569,9 @@
st->print_raw_cr(os::local_time_string(buf, sizeof(buf)));
st->print_cr("Full thread dump %s (%s %s):",
- Abstract_VM_Version::vm_name(),
- Abstract_VM_Version::vm_release(),
- Abstract_VM_Version::vm_info_string());
+ VM_Version::vm_name(),
+ VM_Version::vm_release(),
+ VM_Version::vm_info_string());
st->cr();
#if INCLUDE_SERVICES
--- a/src/hotspot/share/runtime/vm_version.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/runtime/vm_version.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,7 @@
// occurred. Examines a variety of the hardware capabilities of
// the platform to determine which features can be used to execute the
// program.
- static void initialize();
+ static void initialize() { }
// This allows for early initialization of VM_Version information
// that may be needed later in the initialization sequence but before
--- a/src/hotspot/share/services/diagnosticCommand.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/services/diagnosticCommand.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -213,8 +213,8 @@
}
void VersionDCmd::execute(DCmdSource source, TRAPS) {
- output()->print_cr("%s version %s", Abstract_VM_Version::vm_name(),
- Abstract_VM_Version::vm_release());
+ output()->print_cr("%s version %s", VM_Version::vm_name(),
+ VM_Version::vm_release());
JDK_Version jdk_version = JDK_Version::current();
if (jdk_version.patch_version() > 0) {
output()->print_cr("JDK %d.%d.%d.%d", jdk_version.major_version(),
--- a/src/hotspot/share/services/memoryService.hpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/services/memoryService.hpp Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
--- a/src/hotspot/share/services/runtimeService.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/services/runtimeService.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -66,7 +66,7 @@
// create performance counters for jvm_version and its capabilities
PerfDataManager::create_constant(SUN_RT, "jvmVersion", PerfData::U_None,
- (jlong) Abstract_VM_Version::jvm_version(), CHECK);
+ (jlong) VM_Version::jvm_version(), CHECK);
// The capabilities counter is a binary representation of the VM capabilities in string.
// This string respresentation simplifies the implementation of the client side
--- a/src/hotspot/share/utilities/internalVMTests.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/utilities/internalVMTests.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -42,9 +42,7 @@
void InternalVMTests::run() {
tty->print_cr("Running internal VM tests");
- run_unit_test(TestReservedSpace_test);
run_unit_test(TestReserveMemorySpecial_test);
- run_unit_test(TestVirtualSpace_test);
run_unit_test(TestMetaspaceUtils_test);
run_unit_test(GCTimer_test);
// These tests require the "C" locale to correctly parse decimal values
--- a/src/hotspot/share/utilities/vmError.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/hotspot/share/utilities/vmError.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -319,18 +319,18 @@
JDK_Version::runtime_name() : "";
const char* runtime_version = JDK_Version::runtime_version() != NULL ?
JDK_Version::runtime_version() : "";
- const char* jdk_debug_level = Abstract_VM_Version::printable_jdk_debug_level() != NULL ?
- Abstract_VM_Version::printable_jdk_debug_level() : "";
+ const char* jdk_debug_level = VM_Version::printable_jdk_debug_level() != NULL ?
+ VM_Version::printable_jdk_debug_level() : "";
st->print_cr("# JRE version: %s (%s) (%sbuild %s)", runtime_name, buf,
jdk_debug_level, runtime_version);
// This is the long version with some default settings added
st->print_cr("# Java VM: %s (%s%s, %s%s%s%s%s, %s, %s)",
- Abstract_VM_Version::vm_name(),
+ VM_Version::vm_name(),
jdk_debug_level,
- Abstract_VM_Version::vm_release(),
- Abstract_VM_Version::vm_info_string(),
+ VM_Version::vm_release(),
+ VM_Version::vm_info_string(),
TieredCompilation ? ", tiered" : "",
#if INCLUDE_JVMCI
EnableJVMCI ? ", jvmci" : "",
@@ -340,7 +340,7 @@
#endif
UseCompressedOops ? ", compressed oops" : "",
GCConfig::hs_err_name(),
- Abstract_VM_Version::vm_platform_string()
+ VM_Version::vm_platform_string()
);
}
@@ -1007,7 +1007,7 @@
STEP("printing internal vm info")
if (_verbose) {
- st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string());
+ st->print_cr("vm_info: %s", VM_Version::internal_vm_info_string());
st->cr();
}
@@ -1170,7 +1170,7 @@
// STEP("printing internal vm info")
- st->print_cr("vm_info: %s", Abstract_VM_Version::internal_vm_info_string());
+ st->print_cr("vm_info: %s", VM_Version::internal_vm_info_string());
st->cr();
// print a defined marker to show that error handling finished correctly.
--- a/src/java.base/share/classes/java/io/FileInputStream.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/io/FileInputStream.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, 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
@@ -79,8 +79,6 @@
private volatile boolean closed;
- private final Object altFinalizer;
-
/**
* Creates a <code>FileInputStream</code> by
* opening a connection to an actual file,
@@ -155,10 +153,7 @@
fd.attach(this);
path = name;
open(name);
- altFinalizer = getFinalizer(this);
- if (altFinalizer == null) {
- FileCleanable.register(fd); // open set the fd, register the cleanup
- }
+ FileCleanable.register(fd); // open set the fd, register the cleanup
}
/**
@@ -195,7 +190,6 @@
}
fd = fdObj;
path = null;
- altFinalizer = null;
/*
* FileDescriptor is being shared by streams.
@@ -438,85 +432,4 @@
static {
initIDs();
}
-
- /**
- * Ensures that the {@link #close} method of this file input stream is
- * called when there are no more references to it.
- * The {@link #finalize} method does not call {@link #close} directly.
- *
- * @apiNote
- * To release resources used by this stream {@link #close} should be called
- * directly or by try-with-resources.
- *
- * @implSpec
- * If this FileInputStream has been subclassed and the {@link #close}
- * method has been overridden, the {@link #close} method will be
- * called when the FileInputStream is unreachable.
- * Otherwise, it is implementation specific how the resource cleanup described in
- * {@link #close} is performed.
- *
- * @deprecated The {@code finalize} method has been deprecated and will be removed.
- * Subclasses that override {@code finalize} in order to perform cleanup
- * should be modified to use alternative cleanup mechanisms and
- * to remove the overriding {@code finalize} method.
- * When overriding the {@code finalize} method, its implementation must explicitly
- * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
- * See the specification for {@link Object#finalize()} for further
- * information about migration options.
- *
- * @exception IOException if an I/O error occurs.
- * @see java.io.FileInputStream#close()
- */
- @Deprecated(since="9", forRemoval = true)
- protected void finalize() throws IOException {
- }
-
- /*
- * Returns a finalizer object if the FIS needs a finalizer; otherwise null.
- * If the FIS has a close method; it needs an AltFinalizer.
- */
- private static Object getFinalizer(FileInputStream fis) {
- Class<?> clazz = fis.getClass();
- while (clazz != FileInputStream.class) {
- try {
- clazz.getDeclaredMethod("close");
- return new AltFinalizer(fis);
- } catch (NoSuchMethodException nsme) {
- // ignore
- }
- clazz = clazz.getSuperclass();
- }
- return null;
- }
- /**
- * Class to call {@code FileInputStream.close} when finalized.
- * If finalization of the stream is needed, an instance is created
- * in its constructor(s). When the set of instances
- * related to the stream is unreachable, the AltFinalizer performs
- * the needed call to the stream's {@code close} method.
- */
- static class AltFinalizer {
- private final FileInputStream fis;
-
- AltFinalizer(FileInputStream fis) {
- this.fis = fis;
- }
-
- @Override
- @SuppressWarnings("deprecation")
- protected final void finalize() {
- try {
- if ((fis.fd != null) && (fis.fd != FileDescriptor.in)) {
- /* if fd is shared, the references in FileDescriptor
- * will ensure that finalizer is only called when
- * safe to do so. All references using the fd have
- * become unreachable. We can call close()
- */
- fis.close();
- }
- } catch (IOException ioe) {
- // ignore
- }
- }
- }
}
--- a/src/java.base/share/classes/java/io/FileOutputStream.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/io/FileOutputStream.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1994, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1994, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -95,8 +95,6 @@
private volatile boolean closed;
- private final Object altFinalizer;
-
/**
* Creates a file output stream to write to the file with the
* specified name. A new <code>FileDescriptor</code> object is
@@ -235,10 +233,7 @@
this.path = name;
open(name, append);
- altFinalizer = getFinalizer(this);
- if (altFinalizer == null) {
- FileCleanable.register(fd); // open sets the fd, register the cleanup
- }
+ FileCleanable.register(fd); // open sets the fd, register the cleanup
}
/**
@@ -274,7 +269,6 @@
}
this.fd = fdObj;
this.path = null;
- this.altFinalizer = null;
fd.attach(this);
}
@@ -457,98 +451,9 @@
return fc;
}
- /**
- * Cleans up the connection to the file, and ensures that the
- * {@link #close} method of this file output stream is
- * called when there are no more references to this stream.
- * The {@link #finalize} method does not call {@link #close} directly.
- *
- * @apiNote
- * To release resources used by this stream {@link #close} should be called
- * directly or by try-with-resources.
- *
- * @implSpec
- * If this FileOutputStream has been subclassed and the {@link #close}
- * method has been overridden, the {@link #close} method will be
- * called when the FileOutputStream is unreachable.
- * Otherwise, it is implementation specific how the resource cleanup described in
- * {@link #close} is performed.
- *
- * @deprecated The {@code finalize} method has been deprecated and will be removed.
- * Subclasses that override {@code finalize} in order to perform cleanup
- * should be modified to use alternative cleanup mechanisms and
- * to remove the overriding {@code finalize} method.
- * When overriding the {@code finalize} method, its implementation must explicitly
- * ensure that {@code super.finalize()} is invoked as described in {@link Object#finalize}.
- * See the specification for {@link Object#finalize()} for further
- * information about migration options.
- *
- * @exception IOException if an I/O error occurs.
- * @see java.io.FileInputStream#close()
- */
- @Deprecated(since="9", forRemoval = true)
- protected void finalize() throws IOException {
- }
-
private static native void initIDs();
static {
initIDs();
}
-
- /*
- * Returns a finalizer object if the FOS needs a finalizer; otherwise null.
- * If the FOS has a close method; it needs an AltFinalizer.
- */
- private static Object getFinalizer(FileOutputStream fos) {
- Class<?> clazz = fos.getClass();
- while (clazz != FileOutputStream.class) {
- try {
- clazz.getDeclaredMethod("close");
- return new AltFinalizer(fos);
- } catch (NoSuchMethodException nsme) {
- // ignore
- }
- clazz = clazz.getSuperclass();
- }
- return null;
- }
-
- /**
- * Class to call {@code FileOutputStream.close} when finalized.
- * If finalization of the stream is needed, an instance is created
- * in its constructor(s). When the set of instances
- * related to the stream is unreachable, the AltFinalizer performs
- * the needed call to the stream's {@code close} method.
- */
- static class AltFinalizer {
- private final FileOutputStream fos;
-
- AltFinalizer(FileOutputStream fos) {
- this.fos = fos;
- }
-
- @Override
- @SuppressWarnings("deprecation")
- protected final void finalize() {
- try {
- if (fos.fd != null) {
- if (fos.fd == FileDescriptor.out || fos.fd == FileDescriptor.err) {
- // Subclass may override flush; otherwise it is no-op
- fos.flush();
- } else {
- /* if fd is shared, the references in FileDescriptor
- * will ensure that finalizer is only called when
- * safe to do so. All references using the fd have
- * become unreachable. We can call close()
- */
- fos.close();
- }
- }
- } catch (IOException ioe) {
- // ignore
- }
- }
- }
-
}
--- a/src/java.base/share/classes/java/lang/AbstractStringBuilder.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/lang/AbstractStringBuilder.java Tue Oct 16 23:21:05 2018 +0530
@@ -69,10 +69,13 @@
*/
int count;
+ private static final byte[] EMPTYVALUE = new byte[0];
+
/**
* This no-arg constructor is necessary for serialization of subclasses.
*/
AbstractStringBuilder() {
+ value = EMPTYVALUE;
}
/**
--- a/src/java.base/share/classes/java/lang/StringConcatHelper.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/lang/StringConcatHelper.java Tue Oct 16 23:21:05 2018 +0530
@@ -139,61 +139,6 @@
}
/**
- * Mix coder into current coder
- * @param current current coder
- * @param value value to mix in
- * @return new coder
- */
- static byte mixCoder(byte current, boolean value) {
- // Booleans are represented with Latin1
- return current;
- }
-
- /**
- * Mix coder into current coder
- * @param current current coder
- * @param value value to mix in
- * @return new coder
- */
- static byte mixCoder(byte current, byte value) {
- // Bytes are represented with Latin1
- return current;
- }
-
- /**
- * Mix coder into current coder
- * @param current current coder
- * @param value value to mix in
- * @return new coder
- */
- static byte mixCoder(byte current, short value) {
- // Shorts are represented with Latin1
- return current;
- }
-
- /**
- * Mix coder into current coder
- * @param current current coder
- * @param value value to mix in
- * @return new coder
- */
- static byte mixCoder(byte current, int value) {
- // Ints are represented with Latin1
- return current;
- }
-
- /**
- * Mix coder into current coder
- * @param current current coder
- * @param value value to mix in
- * @return new coder
- */
- static byte mixCoder(byte current, long value) {
- // Longs are represented with Latin1
- return current;
- }
-
- /**
* Prepends the stringly representation of boolean value into buffer,
* given the coder and final index. Index is measured in chars, not in bytes!
*
--- a/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/lang/invoke/StringConcatFactory.java Tue Oct 16 23:21:05 2018 +0530
@@ -1588,28 +1588,47 @@
Class<?> argClass = ptypes[ac];
MethodHandle lm = lengthMixer(argClass);
- MethodHandle cm = coderMixer(argClass);
+
+ // Read these bottom up:
+
+ if (argClass.isPrimitive() && argClass != char.class) {
+
+ // 3. Drop old index, producing ("new-index", "coder", <args>)
+ mh = MethodHandles.dropArguments(mh, 1, int.class);
- // Read this bottom up:
+ // 2. Compute "new-index", producing ("new-index", "old-index", "coder", <args>)
+ // Length mixer needs old index, plus the appropriate argument
+ mh = MethodHandles.foldArguments(mh, 0, lm,
+ 1, // old-index
+ 3 + ac // selected argument
+ );
- // 4. Drop old index and coder, producing ("new-index", "new-coder", <args>)
- mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class);
+ // 1. The mh shape here is ("old-index", "coder", <args>); we don't need to recalculate
+ // the coder for non-char primitive arguments
+
+ } else {
+ MethodHandle cm = coderMixer(argClass);
- // 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", <args>)
- // Length mixer needs old index, plus the appropriate argument
- mh = MethodHandles.foldArguments(mh, 0, lm,
- 2, // old-index
- 4 + ac // selected argument
- );
+ // 4. Drop old index and coder, producing ("new-index", "new-coder", <args>)
+ mh = MethodHandles.dropArguments(mh, 2, int.class, byte.class);
+
+ // 3. Compute "new-index", producing ("new-index", "new-coder", "old-index", "old-coder", <args>)
+ // Length mixer needs old index, plus the appropriate argument
+ mh = MethodHandles.foldArguments(mh, 0, lm,
+ 2, // old-index
+ 4 + ac // selected argument
+ );
- // 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", <args>)
- // Coder mixer needs old coder, plus the appropriate argument.
- mh = MethodHandles.foldArguments(mh, 0, cm,
- 2, // old-coder
- 3 + ac // selected argument
- );
+ // 2. Compute "new-coder", producing ("new-coder", "old-index", "old-coder", <args>)
+ // Coder mixer needs old coder, plus the appropriate argument.
+ mh = MethodHandles.foldArguments(mh, 0, cm,
+ 2, // old-coder
+ 3 + ac // selected argument
+ );
- // 1. The mh shape here is ("old-index", "old-coder", <args>)
+ // 1. The mh shape here is ("old-index", "old-coder", <args>)
+ }
+
break;
default:
throw new StringConcatException("Unhandled tag: " + el.getTag());
--- a/src/java.base/share/classes/java/lang/ref/Cleaner.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/lang/ref/Cleaner.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -100,8 +100,8 @@
* }
* }
*
- * private final State;
- * private final Cleaner.Cleanable cleanable
+ * private final State state;
+ * private final Cleaner.Cleanable cleanable;
*
* public CleaningExample() {
* this.state = new State(...);
--- a/src/java.base/share/classes/java/net/InetAddress.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/net/InetAddress.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, 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
@@ -35,6 +35,7 @@
import java.io.ObjectStreamException;
import java.io.ObjectStreamField;
import java.io.IOException;
+import java.io.InvalidObjectException;
import java.io.ObjectInputStream;
import java.io.ObjectInputStream.GetField;
import java.io.ObjectOutputStream;
@@ -1727,8 +1728,11 @@
}
GetField gf = s.readFields();
String host = (String)gf.get("hostName", null);
- int address= gf.get("address", 0);
- int family= gf.get("family", 0);
+ int address = gf.get("address", 0);
+ int family = gf.get("family", 0);
+ if (family != IPv4 && family != IPv6) {
+ throw new InvalidObjectException("invalid address family type: " + family);
+ }
InetAddressHolder h = new InetAddressHolder(host, address, family);
UNSAFE.putObject(this, FIELDS_OFFSET, h);
}
--- a/src/java.base/share/classes/java/net/NetworkInterface.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/net/NetworkInterface.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -321,8 +321,20 @@
if (addr == null) {
throw new NullPointerException();
}
- if (!(addr instanceof Inet4Address || addr instanceof Inet6Address)) {
- throw new IllegalArgumentException ("invalid address type");
+ if (addr instanceof Inet4Address) {
+ Inet4Address inet4Address = (Inet4Address) addr;
+ if (inet4Address.holder.family != InetAddress.IPv4) {
+ throw new IllegalArgumentException("invalid family type: "
+ + inet4Address.holder.family);
+ }
+ } else if (addr instanceof Inet6Address) {
+ Inet6Address inet6Address = (Inet6Address) addr;
+ if (inet6Address.holder.family != InetAddress.IPv6) {
+ throw new IllegalArgumentException("invalid family type: "
+ + inet6Address.holder.family);
+ }
+ } else {
+ throw new IllegalArgumentException("invalid address type: " + addr);
}
return getByInetAddress0(addr);
}
--- a/src/java.base/share/classes/java/net/URLClassLoader.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/net/URLClassLoader.java Tue Oct 16 23:21:05 2018 +0530
@@ -535,13 +535,13 @@
* @spec JPMS
*/
protected Package definePackage(String name, Manifest man, URL url) {
- String path = name.replace('.', '/').concat("/");
String specTitle = null, specVersion = null, specVendor = null;
String implTitle = null, implVersion = null, implVendor = null;
String sealed = null;
URL sealBase = null;
- Attributes attr = man.getAttributes(path);
+ Attributes attr = SharedSecrets.javaUtilJarAccess()
+ .getTrustedAttributes(man, name.replace('.', '/').concat("/"));
if (attr != null) {
specTitle = attr.getValue(Name.SPECIFICATION_TITLE);
specVersion = attr.getValue(Name.SPECIFICATION_VERSION);
@@ -585,10 +585,12 @@
/*
* Returns true if the specified package name is sealed according to the
* given manifest.
+ *
+ * @throws SecurityException if the package name is untrusted in the manifest
*/
private boolean isSealed(String name, Manifest man) {
- String path = name.replace('.', '/').concat("/");
- Attributes attr = man.getAttributes(path);
+ Attributes attr = SharedSecrets.javaUtilJarAccess()
+ .getTrustedAttributes(man, name.replace('.', '/').concat("/"));
String sealed = null;
if (attr != null) {
sealed = attr.getValue(Name.SEALED);
--- a/src/java.base/share/classes/java/util/jar/JarFile.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/JarFile.java Tue Oct 16 23:21:05 2018 +0530
@@ -417,10 +417,10 @@
if (manEntry != null) {
if (verify) {
byte[] b = getBytes(manEntry);
- man = new Manifest(new ByteArrayInputStream(b), getName());
if (!jvInitialized) {
jv = new JarVerifier(b);
}
+ man = new Manifest(jv, new ByteArrayInputStream(b), getName());
} else {
man = new Manifest(super.getInputStream(manEntry), getName());
}
@@ -1011,29 +1011,13 @@
int i = match(MULTIRELEASE_CHARS, b, MULTIRELEASE_LASTOCC,
MULTIRELEASE_OPTOSFT);
if (i != -1) {
- i += MULTIRELEASE_CHARS.length;
- if (i < b.length) {
- byte c = b[i++];
- // Check that the value is followed by a newline
- // and does not have a continuation
- if (c == '\n' &&
- (i == b.length || b[i] != ' ')) {
- isMultiRelease = true;
- } else if (c == '\r') {
- if (i == b.length) {
- isMultiRelease = true;
- } else {
- c = b[i++];
- if (c == '\n') {
- if (i == b.length || b[i] != ' ') {
- isMultiRelease = true;
- }
- } else if (c != ' ') {
- isMultiRelease = true;
- }
- }
- }
- }
+ // Read the main attributes of the manifest
+ byte[] lbuf = new byte[512];
+ Attributes attr = new Attributes();
+ attr.read(new Manifest.FastInputStream(
+ new ByteArrayInputStream(b)), lbuf);
+ isMultiRelease = Boolean.parseBoolean(
+ attr.getValue(Attributes.Name.MULTI_RELEASE));
}
}
}
@@ -1041,7 +1025,7 @@
}
}
- private synchronized void ensureInitialization() {
+ synchronized void ensureInitialization() {
try {
maybeInstantiateVerifier();
} catch (IOException e) {
--- a/src/java.base/share/classes/java/util/jar/JarVerifier.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/JarVerifier.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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
@@ -866,4 +866,24 @@
static CodeSource getUnsignedCS(URL url) {
return new VerifierCodeSource(null, url, (java.security.cert.Certificate[]) null);
}
+
+ /**
+ * Returns whether the name is trusted. Used by
+ * {@link Manifest#getTrustedAttributes(String)}.
+ */
+ boolean isTrustedManifestEntry(String name) {
+ // How many signers? MANIFEST.MF is always verified
+ CodeSigner[] forMan = verifiedSigners.get(JarFile.MANIFEST_NAME);
+ if (forMan == null) {
+ return true;
+ }
+ // Check sigFileSigners first, because we are mainly dealing with
+ // non-file entries which will stay in sigFileSigners forever.
+ CodeSigner[] forName = sigFileSigners.get(name);
+ if (forName == null) {
+ forName = verifiedSigners.get(name);
+ }
+ // Returns trusted if all signers sign the entry
+ return forName != null && forName.length == forMan.length;
+ }
}
--- a/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/JavaUtilJarAccessImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, 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,4 +60,12 @@
public List<Object> getManifestDigests(JarFile jar) {
return jar.getManifestDigests();
}
+
+ public Attributes getTrustedAttributes(Manifest man, String name) {
+ return man.getTrustedAttributes(name);
+ }
+
+ public void ensureInitialization(JarFile jar) {
+ jar.ensureInitialization();
+ }
}
--- a/src/java.base/share/classes/java/util/jar/Manifest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/java/util/jar/Manifest.java Tue Oct 16 23:21:05 2018 +0530
@@ -50,10 +50,13 @@
public class Manifest implements Cloneable {
// manifest main attributes
- private Attributes attr = new Attributes();
+ private final Attributes attr = new Attributes();
// manifest entries
- private Map<String, Attributes> entries = new HashMap<>();
+ private final Map<String, Attributes> entries = new HashMap<>();
+
+ // associated JarVerifier, not null when called by JarFile::getManifest.
+ private final JarVerifier jv;
// name of the corresponding jar archive if available.
private final String jarFilename;
@@ -63,6 +66,7 @@
*/
public Manifest() {
jarFilename = null;
+ jv = null;
}
/**
@@ -72,8 +76,7 @@
* @throws IOException if an I/O error has occurred
*/
public Manifest(InputStream is) throws IOException {
- this();
- read(is);
+ this(null, is, null);
}
/**
@@ -84,8 +87,17 @@
* @throws IOException if an I/O error has occured
*/
Manifest(InputStream is, String jarFilename) throws IOException {
+ this(null, is, jarFilename);
+ }
+
+ /**
+ * Constructs a new Manifest from the specified input stream
+ * and associates it with a JarVerifier.
+ */
+ Manifest(JarVerifier jv, InputStream is, String jarFilename) throws IOException {
read(is);
this.jarFilename = jarFilename;
+ this.jv = jv;
}
/**
@@ -94,9 +106,10 @@
* @param man the Manifest to copy
*/
public Manifest(Manifest man) {
- this();
attr.putAll(man.getMainAttributes());
entries.putAll(man.getEntries());
+ jarFilename = null;
+ jv = man.jv;
}
/**
@@ -147,6 +160,27 @@
}
/**
+ * Returns the Attributes for the specified entry name, if trusted.
+ *
+ * @param name entry name
+ * @return returns the same result as {@link #getAttributes(String)}
+ * @throws SecurityException if the associated jar is signed but this entry
+ * has been modified after signing (i.e. the section in the manifest
+ * does not exist in SF files of all signers).
+ */
+ Attributes getTrustedAttributes(String name) {
+ // Note: Before the verification of MANIFEST.MF/.SF/.RSA files is done,
+ // jv.isTrustedManifestEntry() isn't able to detect MANIFEST.MF change.
+ // Users of this method should call SharedSecrets.javaUtilJarAccess()
+ // .ensureInitialization() first.
+ Attributes result = getAttributes(name);
+ if (result != null && jv != null && ! jv.isTrustedManifestEntry(name)) {
+ throw new SecurityException("Untrusted manifest entry: " + name);
+ }
+ return result;
+ }
+
+ /**
* Clears the main Attributes as well as the entries in this Manifest.
*/
public void clear() {
--- a/src/java.base/share/classes/javax/crypto/CipherInputStream.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/javax/crypto/CipherInputStream.java Tue Oct 16 23:21:05 2018 +0530
@@ -50,6 +50,13 @@
* that are not thrown by its ancestor classes. In particular, the
* <code>skip</code> method skips, and the <code>available</code>
* method counts only data that have been processed by the encapsulated Cipher.
+ * This class may catch BadPaddingException and other exceptions thrown by
+ * failed integrity checks during decryption. These exceptions are not
+ * re-thrown, so the client may not be informed that integrity checks
+ * failed. Because of this behavior, this class may not be suitable
+ * for use with decryption in an authenticated mode of operation (e.g. GCM).
+ * Applications that require authenticated encryption can use the Cipher API
+ * directly as an alternative to using this class.
*
* <p> It is crucial for a programmer using this class not to use
* methods that are not defined or overridden in this class (such as a
--- a/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/loader/BuiltinClassLoader.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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,6 +60,7 @@
import java.util.jar.Manifest;
import java.util.stream.Stream;
+import jdk.internal.misc.SharedSecrets;
import jdk.internal.misc.VM;
import jdk.internal.module.ModulePatcher.PatchedModuleReader;
import jdk.internal.module.Resources;
@@ -862,7 +863,8 @@
* Manifest are used to get the package version and sealing information.
*
* @throws IllegalArgumentException if the package name duplicates an
- * existing package either in this class loader or one of its ancestors
+ * existing package either in this class loader or one of its ancestors
+ * @throws SecurityException if the package name is untrusted in the manifest
*/
private Package definePackage(String pn, Manifest man, URL url) {
String specTitle = null;
@@ -875,7 +877,8 @@
URL sealBase = null;
if (man != null) {
- Attributes attr = man.getAttributes(pn.replace('.', '/').concat("/"));
+ Attributes attr = SharedSecrets.javaUtilJarAccess()
+ .getTrustedAttributes(man, pn.replace('.', '/').concat("/"));
if (attr != null) {
specTitle = attr.getValue(Attributes.Name.SPECIFICATION_TITLE);
specVersion = attr.getValue(Attributes.Name.SPECIFICATION_VERSION);
@@ -921,10 +924,12 @@
/**
* Returns {@code true} if the specified package name is sealed according to
* the given manifest.
+ *
+ * @throws SecurityException if the package name is untrusted in the manifest
*/
private boolean isSealed(String pn, Manifest man) {
- String path = pn.replace('.', '/').concat("/");
- Attributes attr = man.getAttributes(path);
+ Attributes attr = SharedSecrets.javaUtilJarAccess()
+ .getTrustedAttributes(man, pn.replace('.', '/').concat("/"));
String sealed = null;
if (attr != null)
sealed = attr.getValue(Attributes.Name.SEALED);
--- a/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/loader/URLClassPath.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2018, 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,6 +34,7 @@
import java.net.HttpURLConnection;
import java.net.JarURLConnection;
import java.net.MalformedURLException;
+import java.net.URI;
import java.net.URL;
import java.net.URLConnection;
import java.net.URLStreamHandler;
@@ -88,6 +89,8 @@
private static final boolean DEBUG;
private static final boolean DISABLE_JAR_CHECKING;
private static final boolean DISABLE_ACC_CHECKING;
+ private static final boolean DISABLE_CP_URL_CHECK;
+ private static final boolean DEBUG_CP_URL_CHECK;
static {
Properties props = GetPropertyAction.privilegedGetProperties();
@@ -98,6 +101,12 @@
p = props.getProperty("jdk.net.URLClassPath.disableRestrictedPermissions");
DISABLE_ACC_CHECKING = p != null ? p.equals("true") || p.equals("") : false;
+
+ // This property will be removed in a later release
+ p = props.getProperty("jdk.net.URLClassPath.disableClassPathURLCheck", "true");
+
+ DISABLE_CP_URL_CHECK = p != null ? p.equals("true") || p.isEmpty() : false;
+ DEBUG_CP_URL_CHECK = "debug".equals(p);
}
/* The original search path of URLs. */
@@ -857,8 +866,10 @@
{ return jar.getInputStream(entry); }
public int getContentLength()
{ return (int)entry.getSize(); }
- public Manifest getManifest() throws IOException
- { return jar.getManifest(); };
+ public Manifest getManifest() throws IOException {
+ SharedSecrets.javaUtilJarAccess().ensureInitialization(jar);
+ return jar.getManifest();
+ }
public Certificate[] getCertificates()
{ return entry.getCertificates(); };
public CodeSigner[] getCodeSigners()
@@ -1081,11 +1092,51 @@
int i = 0;
while (st.hasMoreTokens()) {
String path = st.nextToken();
- urls[i] = new URL(base, path);
- i++;
+ URL url = DISABLE_CP_URL_CHECK ? new URL(base, path) : safeResolve(base, path);
+ if (url != null) {
+ urls[i] = url;
+ i++;
+ }
+ }
+ if (i == 0) {
+ urls = null;
+ } else if (i != urls.length) {
+ // Truncate nulls from end of array
+ urls = Arrays.copyOf(urls, i);
}
return urls;
}
+
+ /*
+ * Return a URL for the given path resolved against the base URL, or
+ * null if the resulting URL is invalid.
+ */
+ static URL safeResolve(URL base, String path) {
+ String child = path.replace(File.separatorChar, '/');
+ try {
+ if (!URI.create(child).isAbsolute()) {
+ URL url = new URL(base, child);
+ if (base.getProtocol().equalsIgnoreCase("file")) {
+ return url;
+ } else {
+ String bp = base.getPath();
+ String urlp = url.getPath();
+ int pos = bp.lastIndexOf('/');
+ if (pos == -1) {
+ pos = bp.length() - 1;
+ }
+ if (urlp.regionMatches(0, bp, 0, pos + 1)
+ && urlp.indexOf("..", pos) == -1) {
+ return url;
+ }
+ }
+ }
+ } catch (MalformedURLException | IllegalArgumentException e) {}
+ if (DEBUG_CP_URL_CHECK) {
+ System.err.println("Class-Path entry: \"" + path + "\" ignored in JAR file " + base);
+ }
+ return null;
+ }
}
/*
--- a/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/jdk/internal/misc/JavaUtilJarAccess.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2002, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -30,8 +30,10 @@
import java.security.CodeSource;
import java.util.Enumeration;
import java.util.List;
+import java.util.jar.Attributes;
import java.util.jar.JarEntry;
import java.util.jar.JarFile;
+import java.util.jar.Manifest;
public interface JavaUtilJarAccess {
public boolean jarFileHasClassPathAttribute(JarFile jar) throws IOException;
@@ -41,4 +43,6 @@
public Enumeration<JarEntry> entries2(JarFile jar);
public void setEagerValidation(JarFile jar, boolean eager);
public List<Object> getManifestDigests(JarFile jar);
+ public Attributes getTrustedAttributes(Manifest man, String name);
+ public void ensureInitialization(JarFile jar);
}
--- a/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/net/www/protocol/http/HttpURLConnection.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1995, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1995, 2018, 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
@@ -2725,6 +2725,8 @@
// doesn't know about proxy.
useProxyResponseCode = true;
} else {
+ final URL prevURL = url;
+
// maintain previous headers, just change the name
// of the file we're getting
url = locUrl;
@@ -2753,6 +2755,14 @@
poster = null;
if (!checkReuseConnection())
connect();
+
+ if (!sameDestination(prevURL, url)) {
+ // Ensures pre-redirect user-set cookie will not be reset.
+ // CookieHandler, if any, will be queried to determine
+ // cookies for redirected URL, if any.
+ userCookies = null;
+ userCookies2 = null;
+ }
} else {
if (!checkReuseConnection())
connect();
@@ -2775,11 +2785,52 @@
}
requests.set("Host", host);
}
+
+ if (!sameDestination(prevURL, url)) {
+ // Redirecting to a different destination will drop any
+ // security-sensitive headers, regardless of whether
+ // they are user-set or not. CookieHandler, if any, will be
+ // queried to determine cookies for redirected URL, if any.
+ userCookies = null;
+ userCookies2 = null;
+ requests.remove("Cookie");
+ requests.remove("Cookie2");
+ requests.remove("Authorization");
+
+ // check for preemptive authorization
+ AuthenticationInfo sauth =
+ AuthenticationInfo.getServerAuth(url, getAuthenticatorKey());
+ if (sauth != null && sauth.supportsPreemptiveAuthorization() ) {
+ // Sets "Authorization"
+ requests.setIfNotSet(sauth.getHeaderName(), sauth.getHeaderValue(url,method));
+ currentServerCredentials = sauth;
+ }
+ }
}
}
return true;
}
+ /* Returns true iff the given URLs have the same host and effective port. */
+ private static boolean sameDestination(URL firstURL, URL secondURL) {
+ assert firstURL.getProtocol().equalsIgnoreCase(secondURL.getProtocol()):
+ "protocols not equal: " + firstURL + " - " + secondURL;
+
+ if (!firstURL.getHost().equalsIgnoreCase(secondURL.getHost()))
+ return false;
+
+ int firstPort = firstURL.getPort();
+ if (firstPort == -1)
+ firstPort = firstURL.getDefaultPort();
+ int secondPort = secondURL.getPort();
+ if (secondPort == -1)
+ secondPort = secondURL.getDefaultPort();
+ if (firstPort != secondPort)
+ return false;
+
+ return true;
+ }
+
/* dummy byte buffer for reading off socket prior to closing */
byte[] cdata = new byte [128];
--- a/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/CertSignAlgsExtension.java Tue Oct 16 23:21:05 2018 +0530
@@ -243,18 +243,16 @@
}
// Produce the extension.
- if (shc.localSupportedSignAlgs == null) {
- shc.localSupportedSignAlgs =
+ List<SignatureScheme> sigAlgs =
SignatureScheme.getSupportedAlgorithms(
- shc.algorithmConstraints, shc.activeProtocols);
- }
+ shc.algorithmConstraints,
+ List.of(shc.negotiatedProtocol));
- int vectorLen = SignatureScheme.sizeInRecord() *
- shc.localSupportedSignAlgs.size();
+ int vectorLen = SignatureScheme.sizeInRecord() * sigAlgs.size();
byte[] extData = new byte[vectorLen + 2];
ByteBuffer m = ByteBuffer.wrap(extData);
Record.putInt16(m, vectorLen);
- for (SignatureScheme ss : shc.localSupportedSignAlgs) {
+ for (SignatureScheme ss : sigAlgs) {
Record.putInt16(m, ss.id);
}
--- a/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/CertificateRequest.java Tue Oct 16 23:21:05 2018 +0530
@@ -31,7 +31,9 @@
import java.security.cert.X509Certificate;
import java.text.MessageFormat;
import java.util.ArrayList;
+import java.util.Collection;
import java.util.Collections;
+import java.util.HashSet;
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
@@ -675,44 +677,85 @@
chc.peerRequestedSignatureSchemes = sss;
chc.peerRequestedCertSignSchemes = sss; // use the same schemes
chc.handshakeSession.setPeerSupportedSignatureAlgorithms(sss);
+ chc.peerSupportedAuthorities = crm.getAuthorities();
- X509ExtendedKeyManager km = chc.sslContext.getX509KeyManager();
- String clientAlias = null;
- if (chc.conContext.transport instanceof SSLSocketImpl) {
- clientAlias = km.chooseClientAlias(crm.getKeyTypes(),
- crm.getAuthorities(), (SSLSocket)chc.conContext.transport);
- } else if (chc.conContext.transport instanceof SSLEngineImpl) {
- clientAlias = km.chooseEngineClientAlias(crm.getKeyTypes(),
- crm.getAuthorities(), (SSLEngine)chc.conContext.transport);
- }
-
- if (clientAlias == null) {
- if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
- SSLLogger.warning("No available client authentication");
- }
+ // For TLS 1.2, we no longer use the certificate_types field
+ // from the CertificateRequest message to directly determine
+ // the SSLPossession. Instead, the choosePossession method
+ // will use the accepted signature schemes in the message to
+ // determine the set of acceptable certificate types to select from.
+ SSLPossession pos = choosePossession(chc);
+ if (pos == null) {
return;
}
- PrivateKey clientPrivateKey = km.getPrivateKey(clientAlias);
- if (clientPrivateKey == null) {
+ chc.handshakePossessions.add(pos);
+ chc.handshakeProducers.put(SSLHandshake.CERTIFICATE_VERIFY.id,
+ SSLHandshake.CERTIFICATE_VERIFY);
+ }
+
+ private static SSLPossession choosePossession(HandshakeContext hc)
+ throws IOException {
+ if (hc.peerRequestedCertSignSchemes == null ||
+ hc.peerRequestedCertSignSchemes.isEmpty()) {
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
- SSLLogger.warning("No available client private key");
+ SSLLogger.warning("No signature and hash algorithms " +
+ "in CertificateRequest");
}
- return;
+ return null;
}
- X509Certificate[] clientCerts = km.getCertificateChain(clientAlias);
- if ((clientCerts == null) || (clientCerts.length == 0)) {
- if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
- SSLLogger.warning("No available client certificate");
+ Collection<String> checkedKeyTypes = new HashSet<>();
+ for (SignatureScheme ss : hc.peerRequestedCertSignSchemes) {
+ if (checkedKeyTypes.contains(ss.keyAlgorithm)) {
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+ SSLLogger.warning(
+ "Unsupported authentication scheme: " + ss.name);
+ }
+ continue;
}
- return;
+
+ // Don't select a signature scheme unless we will be able to
+ // produce a CertificateVerify message later
+ if (SignatureScheme.getPreferableAlgorithm(
+ hc.peerRequestedSignatureSchemes,
+ ss, hc.negotiatedProtocol) == null) {
+
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+ SSLLogger.warning(
+ "Unable to produce CertificateVerify for " +
+ "signature scheme: " + ss.name);
+ }
+ checkedKeyTypes.add(ss.keyAlgorithm);
+ continue;
+ }
+
+ SSLAuthentication ka = X509Authentication.valueOf(ss);
+ if (ka == null) {
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+ SSLLogger.warning(
+ "Unsupported authentication scheme: " + ss.name);
+ }
+ checkedKeyTypes.add(ss.keyAlgorithm);
+ continue;
+ }
+
+ SSLPossession pos = ka.createPossession(hc);
+ if (pos == null) {
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+ SSLLogger.warning(
+ "Unavailable authentication scheme: " + ss.name);
+ }
+ continue;
+ }
+
+ return pos;
}
- chc.handshakePossessions.add(
- new X509Possession(clientPrivateKey, clientCerts));
- chc.handshakeProducers.put(SSLHandshake.CERTIFICATE_VERIFY.id,
- SSLHandshake.CERTIFICATE_VERIFY);
+ if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake")) {
+ SSLLogger.warning("No available authentication scheme");
+ }
+ return null;
}
}
--- a/src/java.base/share/classes/sun/security/ssl/ClientHello.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/ClientHello.java Tue Oct 16 23:21:05 2018 +0530
@@ -35,6 +35,7 @@
import java.util.LinkedList;
import java.util.List;
import java.util.Locale;
+import java.util.Objects;
import javax.net.ssl.SSLException;
import javax.net.ssl.SSLHandshakeException;
import javax.net.ssl.SSLPeerUnverifiedException;
@@ -510,6 +511,23 @@
}
}
+ // ensure that the endpoint identification algorithm matches the
+ // one in the session
+ String identityAlg = chc.sslConfig.identificationProtocol;
+ if (session != null && identityAlg != null) {
+ String sessionIdentityAlg =
+ session.getIdentificationProtocol();
+ if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+ if (SSLLogger.isOn &&
+ SSLLogger.isOn("ssl,handshake,verbose")) {
+ SSLLogger.finest("Can't resume, endpoint id" +
+ " algorithm does not match, requested: " +
+ identityAlg + ", cached: " + sessionIdentityAlg);
+ }
+ session = null;
+ }
+ }
+
if (session != null) {
if (SSLLogger.isOn && SSLLogger.isOn("ssl,handshake,verbose")) {
SSLLogger.finest("Try resuming session", session);
@@ -1011,6 +1029,23 @@
}
}
+ // ensure that the endpoint identification algorithm matches the
+ // one in the session
+ String identityAlg = shc.sslConfig.identificationProtocol;
+ if (resumingSession && identityAlg != null) {
+ String sessionIdentityAlg =
+ previous.getIdentificationProtocol();
+ if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+ if (SSLLogger.isOn &&
+ SSLLogger.isOn("ssl,handshake,verbose")) {
+ SSLLogger.finest("Can't resume, endpoint id" +
+ " algorithm does not match, requested: " +
+ identityAlg + ", cached: " + sessionIdentityAlg);
+ }
+ resumingSession = false;
+ }
+ }
+
// So far so good. Note that the handshake extensions may reset
// the resuming options later.
shc.isResumption = resumingSession;
--- a/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/HandshakeContext.java Tue Oct 16 23:21:05 2018 +0530
@@ -43,6 +43,7 @@
import javax.crypto.SecretKey;
import javax.net.ssl.SNIServerName;
import javax.net.ssl.SSLHandshakeException;
+import javax.security.auth.x500.X500Principal;
import sun.security.ssl.SupportedGroupsExtension.NamedGroup;
import sun.security.ssl.SupportedGroupsExtension.NamedGroupType;
import static sun.security.ssl.SupportedGroupsExtension.NamedGroupType.*;
@@ -136,6 +137,9 @@
List<SignatureScheme> peerRequestedSignatureSchemes;
List<SignatureScheme> peerRequestedCertSignSchemes;
+ // Known authorities
+ X500Principal[] peerSupportedAuthorities = null;
+
// SupportedGroups
List<NamedGroup> clientRequestedNamedGroups;
--- a/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/PostHandshakeContext.java Tue Oct 16 23:21:05 2018 +0530
@@ -50,6 +50,9 @@
this.localSupportedSignAlgs = new ArrayList<SignatureScheme>(
context.conSession.getLocalSupportedSignatureSchemes());
+ this.requestedServerNames =
+ context.conSession.getRequestedServerNames();
+
handshakeConsumers = new LinkedHashMap<>(consumers);
handshakeFinished = true;
}
--- a/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/PreSharedKeyExtension.java Tue Oct 16 23:21:05 2018 +0530
@@ -32,6 +32,7 @@
import java.util.ArrayList;
import java.util.Locale;
import java.util.Arrays;
+import java.util.Objects;
import java.util.Optional;
import java.util.Collection;
import javax.crypto.Mac;
@@ -170,7 +171,7 @@
int getIdsEncodedLength() {
int idEncodedLength = 0;
- for (PskIdentity curId : identities) {
+ for(PskIdentity curId : identities) {
idEncodedLength += curId.getEncodedLength();
}
@@ -193,7 +194,7 @@
byte[] buffer = new byte[encodedLength];
ByteBuffer m = ByteBuffer.wrap(buffer);
Record.putInt16(m, idsEncodedLength);
- for (PskIdentity curId : identities) {
+ for(PskIdentity curId : identities) {
curId.writeEncoded(m);
}
Record.putInt16(m, bindersEncodedLength);
@@ -443,6 +444,23 @@
}
}
+ // ensure that the endpoint identification algorithm matches the
+ // one in the session
+ String identityAlg = shc.sslConfig.identificationProtocol;
+ if (result && identityAlg != null) {
+ String sessionIdentityAlg = s.getIdentificationProtocol();
+ if (!Objects.equals(identityAlg, sessionIdentityAlg)) {
+ if (SSLLogger.isOn &&
+ SSLLogger.isOn("ssl,handshake,verbose")) {
+
+ SSLLogger.finest("Can't resume, endpoint id" +
+ " algorithm does not match, requested: " +
+ identityAlg + ", cached: " + sessionIdentityAlg);
+ }
+ result = false;
+ }
+ }
+
// Ensure cipher suite can be negotiated
if (result && (!shc.isNegotiable(s.getSuite()) ||
!clientHello.cipherSuites.contains(s.getSuite()))) {
--- a/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SSLSessionImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -132,6 +132,10 @@
// Counter used to create unique nonces in NewSessionTicket
private BigInteger ticketNonceCounter = BigInteger.ONE;
+ // The endpoint identification algorithm used to check certificates
+ // in this session.
+ private final String identificationProtocol;
+
/*
* Create a new non-rejoinable session, using the default (null)
* cipher spec. This constructor returns a session which could
@@ -149,6 +153,7 @@
this.requestedServerNames = Collections.<SNIServerName>emptyList();
this.useExtendedMasterSecret = false;
this.creationTime = System.currentTimeMillis();
+ this.identificationProtocol = null;
}
/*
@@ -198,6 +203,7 @@
(!hc.negotiatedProtocol.useTLS13PlusSpec());
}
this.creationTime = creationTime;
+ this.identificationProtocol = hc.sslConfig.identificationProtocol;
if (SSLLogger.isOn && SSLLogger.isOn("session")) {
SSLLogger.finest("Session initialized: " + this);
@@ -259,6 +265,10 @@
return ticketAgeAdd;
}
+ String getIdentificationProtocol() {
+ return this.identificationProtocol;
+ }
+
/*
* Get the PSK identity. Take care not to use it in multiple connections.
*/
--- a/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/SignatureAlgorithmsExtension.java Tue Oct 16 23:21:05 2018 +0530
@@ -410,18 +410,16 @@
}
// Produce the extension.
- if (shc.localSupportedSignAlgs == null) {
- shc.localSupportedSignAlgs =
+ List<SignatureScheme> sigAlgs =
SignatureScheme.getSupportedAlgorithms(
- shc.algorithmConstraints, shc.activeProtocols);
- }
+ shc.algorithmConstraints,
+ List.of(shc.negotiatedProtocol));
- int vectorLen = SignatureScheme.sizeInRecord() *
- shc.localSupportedSignAlgs.size();
+ int vectorLen = SignatureScheme.sizeInRecord() * sigAlgs.size();
byte[] extData = new byte[vectorLen + 2];
ByteBuffer m = ByteBuffer.wrap(extData);
Record.putInt16(m, vectorLen);
- for (SignatureScheme ss : shc.localSupportedSignAlgs) {
+ for (SignatureScheme ss : sigAlgs) {
Record.putInt16(m, ss.id);
}
--- a/src/java.base/share/classes/sun/security/ssl/X509Authentication.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/classes/sun/security/ssl/X509Authentication.java Tue Oct 16 23:21:05 2018 +0530
@@ -170,7 +170,7 @@
return null;
}
- // Used by TLS 1.3 only.
+ // Used by TLS 1.2 and TLS 1.3.
private SSLPossession createClientPossession(
ClientHandshakeContext chc, String keyType) {
X509ExtendedKeyManager km = chc.sslContext.getX509KeyManager();
@@ -178,11 +178,13 @@
if (chc.conContext.transport instanceof SSLSocketImpl) {
clientAlias = km.chooseClientAlias(
new String[] { keyType },
- null, (SSLSocket)chc.conContext.transport);
+ chc.peerSupportedAuthorities,
+ (SSLSocket)chc.conContext.transport);
} else if (chc.conContext.transport instanceof SSLEngineImpl) {
clientAlias = km.chooseEngineClientAlias(
new String[] { keyType },
- null, (SSLEngine)chc.conContext.transport);
+ chc.peerSupportedAuthorities,
+ (SSLEngine)chc.conContext.transport);
}
if (clientAlias == null) {
Binary file src/java.base/share/lib/security/cacerts has changed
--- a/src/java.base/share/native/include/jni.h Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/share/native/include/jni.h Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1996, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1996, 2018, 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
@@ -1871,6 +1871,20 @@
#endif /* __cplusplus */
};
+/*
+ * optionString may be any option accepted by the JVM, or one of the
+ * following:
+ *
+ * -D<name>=<value> Set a system property.
+ * -verbose[:class|gc|jni] Enable verbose output, comma-separated. E.g.
+ * "-verbose:class" or "-verbose:gc,class"
+ * Standard names include: gc, class, and jni.
+ * All nonstandard (VM-specific) names must begin
+ * with "X".
+ * vfprintf extraInfo is a pointer to the vfprintf hook.
+ * exit extraInfo is a pointer to the exit hook.
+ * abort extraInfo is a pointer to the abort hook.
+ */
typedef struct JavaVMOption {
char *optionString;
void *extraInfo;
--- a/src/java.base/unix/native/libnet/NetworkInterface.c Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/unix/native/libnet/NetworkInterface.c Tue Oct 16 23:21:05 2018 +0530
@@ -331,9 +331,16 @@
netif *ifs, *curr;
jobject obj = NULL;
jboolean match = JNI_FALSE;
- int family = (getInetAddress_family(env, iaObj) == java_net_InetAddress_IPv4) ?
- AF_INET : AF_INET6;
+ int family = getInetAddress_family(env, iaObj);
JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+
+ if (family == java_net_InetAddress_IPv4) {
+ family = AF_INET;
+ } else if (family == java_net_InetAddress_IPv6) {
+ family = AF_INET6;
+ } else {
+ return NULL; // Invalid family
+ }
ifs = enumInterfaces(env);
if (ifs == NULL) {
return NULL;
@@ -351,7 +358,9 @@
int address1 = htonl(
((struct sockaddr_in *)addrP->addr)->sin_addr.s_addr);
int address2 = getInetAddress_addr(env, iaObj);
- JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+ if ((*env)->ExceptionCheck(env)) {
+ goto cleanup;
+ }
if (address1 == address2) {
match = JNI_TRUE;
break;
@@ -397,6 +406,7 @@
obj = createNetworkInterface(env, curr);
}
+cleanup:
// release the interface list
freeif(ifs);
--- a/src/java.base/windows/native/libnet/NetworkInterface.c Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/windows/native/libnet/NetworkInterface.c Tue Oct 16 23:21:05 2018 +0530
@@ -280,6 +280,7 @@
if (curr->name == NULL || curr->displayName == NULL) {
if (curr->name) free(curr->name);
if (curr->displayName) free(curr->displayName);
+ free(curr);
curr = NULL;
}
}
@@ -586,7 +587,10 @@
/* default ctor will set family to AF_INET */
setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr));
- JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+ if ((*env)->ExceptionCheck(env)) {
+ free_netaddr(netaddrP);
+ return NULL;
+ }
if (addrs->mask != -1) {
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj == NULL) {
@@ -600,7 +604,10 @@
return NULL;
}
setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr));
- JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+ if ((*env)->ExceptionCheck(env)) {
+ free_netaddr(netaddrP);
+ return NULL;
+ }
(*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
(*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
(*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
@@ -611,6 +618,7 @@
if (iaObj) {
jboolean ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr));
if (ret == JNI_FALSE) {
+ free_netaddr(netaddrP);
return NULL;
}
--- a/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.base/windows/native/libnet/NetworkInterface_winXP.c Tue Oct 16 23:21:05 2018 +0530
@@ -521,8 +521,9 @@
jobjectArray addrArr, bindsArr, childArr;
netaddr *addrs;
jint addr_index;
- int netaddrCount=ifs->naddrs;
- netaddr *netaddrP=ifs->addrs;
+ int netaddrCount = ifs->naddrs;
+ netaddr *netaddrP = ifs->addrs;
+ netaddr *netaddrPToFree = NULL;
jint bind_index;
/*
@@ -553,21 +554,23 @@
* Note that 0 is a valid number of addresses.
*/
if (netaddrCount < 0) {
- netaddrCount = enumAddresses_win(env, ifs, &netaddrP);
+ netaddrCount = enumAddresses_win(env, ifs, &netaddrPToFree);
if (netaddrCount == -1) {
return NULL;
}
+ netaddrP = netaddrPToFree;
}
addrArr = (*env)->NewObjectArray(env, netaddrCount, ia_class, NULL);
if (addrArr == NULL) {
+ free_netaddr(netaddrPToFree);
return NULL;
}
bindsArr = (*env)->NewObjectArray(env, netaddrCount, ni_ibcls, NULL);
if (bindsArr == NULL) {
- free_netaddr(netaddrP);
- return NULL;
+ free_netaddr(netaddrPToFree);
+ return NULL;
}
addrs = netaddrP;
@@ -579,25 +582,32 @@
if (addrs->addr.sa.sa_family == AF_INET) {
iaObj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
if (iaObj == NULL) {
+ free_netaddr(netaddrPToFree);
return NULL;
}
/* default ctor will set family to AF_INET */
setInetAddress_addr(env, iaObj, ntohl(addrs->addr.sa4.sin_addr.s_addr));
- JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+ if ((*env)->ExceptionCheck(env)) {
+ free_netaddr(netaddrPToFree);
+ return NULL;
+ }
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj == NULL) {
- free_netaddr(netaddrP);
- return NULL;
+ free_netaddr(netaddrPToFree);
+ return NULL;
}
(*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
ia2Obj = (*env)->NewObject(env, ia4_class, ia4_ctrID);
if (ia2Obj == NULL) {
- free_netaddr(netaddrP);
- return NULL;
+ free_netaddr(netaddrPToFree);
+ return NULL;
}
setInetAddress_addr(env, ia2Obj, ntohl(addrs->brdcast.sa4.sin_addr.s_addr));
- JNU_CHECK_EXCEPTION_RETURN(env, NULL);
+ if ((*env)->ExceptionCheck(env)) {
+ free_netaddr(netaddrPToFree);
+ return NULL;
+ }
(*env)->SetObjectField(env, ibObj, ni_ibbroadcastID, ia2Obj);
(*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
(*env)->SetObjectArrayElement(env, bindsArr, bind_index++, ibObj);
@@ -606,10 +616,12 @@
jboolean ret;
iaObj = (*env)->NewObject(env, ia6_class, ia6_ctrID);
if (iaObj == NULL) {
+ free_netaddr(netaddrPToFree);
return NULL;
}
ret = setInet6Address_ipaddress(env, iaObj, (jbyte *)&(addrs->addr.sa6.sin6_addr.s6_addr));
if (ret == JNI_FALSE) {
+ free_netaddr(netaddrPToFree);
return NULL;
}
scope = addrs->addr.sa6.sin6_scope_id;
@@ -619,8 +631,8 @@
}
ibObj = (*env)->NewObject(env, ni_ibcls, ni_ibctrID);
if (ibObj == NULL) {
- free_netaddr(netaddrP);
- return NULL;
+ free_netaddr(netaddrPToFree);
+ return NULL;
}
(*env)->SetObjectField(env, ibObj, ni_ibaddressID, iaObj);
(*env)->SetShortField(env, ibObj, ni_ibmaskID, addrs->mask);
@@ -633,6 +645,8 @@
(*env)->SetObjectField(env, netifObj, ni_addrsID, addrArr);
(*env)->SetObjectField(env, netifObj, ni_bindsID, bindsArr);
+ free_netaddr(netaddrPToFree);
+
/*
* Windows doesn't have virtual interfaces, so child array
* is always empty.
@@ -672,7 +686,7 @@
}
/* if found create a NetworkInterface */
- if (curr != NULL) {;
+ if (curr != NULL) {
netifObj = createNetworkInterfaceXP(env, curr);
}
--- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolder2.java Tue Oct 16 23:21:05 2018 +0530
@@ -736,7 +736,7 @@
}
try {
- return invoke(new Callable<File[]>() {
+ File[] files = invoke(new Callable<File[]>() {
public File[] call() throws InterruptedException {
if (!isDirectory()) {
return null;
@@ -791,6 +791,8 @@
: list.toArray(new ShellFolder[list.size()]);
}
}, InterruptedException.class);
+
+ return Win32ShellFolderManager2.checkFiles(files);
} catch (InterruptedException e) {
return new File[0];
}
--- a/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/classes/sun/awt/shell/Win32ShellFolderManager2.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2018, 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
@@ -387,21 +387,30 @@
return null;
}
- private File checkFile(File file) {
+ private static File checkFile(File file) {
SecurityManager sm = System.getSecurityManager();
return (sm == null || file == null) ? file : checkFile(file, sm);
}
- private File checkFile(File file, SecurityManager sm) {
+ private static File checkFile(File file, SecurityManager sm) {
try {
sm.checkRead(file.getPath());
+
+ if (file instanceof Win32ShellFolder2) {
+ Win32ShellFolder2 f = (Win32ShellFolder2)file;
+ if (f.isLink()) {
+ Win32ShellFolder2 link = (Win32ShellFolder2)f.getLinkLocation();
+ if (link != null)
+ sm.checkRead(link.getPath());
+ }
+ }
return file;
} catch (SecurityException se) {
return null;
}
}
- private File[] checkFiles(File[] files) {
+ static File[] checkFiles(File[] files) {
SecurityManager sm = System.getSecurityManager();
if (sm == null || files == null || files.length == 0) {
return files;
@@ -409,7 +418,7 @@
return checkFiles(Arrays.stream(files), sm);
}
- private File[] checkFiles(List<File> files) {
+ private static File[] checkFiles(List<File> files) {
SecurityManager sm = System.getSecurityManager();
if (sm == null || files.isEmpty()) {
return files.toArray(new File[files.size()]);
@@ -417,7 +426,7 @@
return checkFiles(files.stream(), sm);
}
- private File[] checkFiles(Stream<File> filesStream, SecurityManager sm) {
+ private static File[] checkFiles(Stream<File> filesStream, SecurityManager sm) {
return filesStream.filter((file) -> checkFile(file, sm) != null)
.toArray(File[]::new);
}
--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiIn.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -252,7 +252,7 @@
}
INT32 getMidiInCaps(INT32 deviceID, MIDIINCAPSW* caps, INT32* err) {
- (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPS));
+ (*err) = midiInGetDevCapsW(deviceID, caps, sizeof(MIDIINCAPSW));
return ((*err) == MMSYSERR_NOERROR);
}
@@ -260,6 +260,7 @@
MIDIINCAPSW midiInCaps;
INT32 err;
+ memset(&midiInCaps, 0, sizeof(midiInCaps));
if (getMidiInCaps(deviceID, &midiInCaps, &err)) {
UnicodeToUTF8AndCopy(name, midiInCaps.szPname, nameLength);
return MIDI_SUCCESS;
@@ -284,6 +285,7 @@
MIDIINCAPSW midiInCaps;
INT32 err = MIDI_NOT_SUPPORTED;
+ memset(&midiInCaps, 0, sizeof(midiInCaps));
if (getMidiInCaps(deviceID, &midiInCaps, &err) && (nameLength>7)) {
sprintf(name, "%d.%d", (midiInCaps.vDriverVersion & 0xFF00) >> 8, midiInCaps.vDriverVersion & 0xFF);
return MIDI_SUCCESS;
--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_MidiOut.c Tue Oct 16 23:21:05 2018 +0530
@@ -70,12 +70,13 @@
INT32 getMidiOutCaps(INT32 deviceID, MIDIOUTCAPSW* caps, INT32* err) {
+ UINT_PTR id;
if (deviceID == 0) {
- deviceID = MIDI_MAPPER;
+ id = MIDI_MAPPER;
} else {
- deviceID--;
+ id = (UINT_PTR)(deviceID-1);
}
- (*err) = (INT32) midiOutGetDevCapsW(deviceID, caps, sizeof(MIDIOUTCAPS));
+ (*err) = (INT32) midiOutGetDevCapsW(id, caps, sizeof(MIDIOUTCAPSW));
return ((*err) == MMSYSERR_NOERROR);
}
@@ -84,6 +85,7 @@
MIDIOUTCAPSW midiOutCaps;
INT32 err;
+ memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
UnicodeToUTF8AndCopy(name, midiOutCaps.szPname, nameLength);
return MIDI_SUCCESS;
@@ -103,6 +105,7 @@
char *desc;
INT32 err;
+ memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err)) {
int tech = (int)midiOutCaps.wTechnology;
switch(tech) {
@@ -139,6 +142,7 @@
MIDIOUTCAPSW midiOutCaps;
INT32 err;
+ memset(&midiOutCaps, 0, sizeof(midiOutCaps));
if (getMidiOutCaps(deviceID, &midiOutCaps, &err) && nameLength>7) {
sprintf(name, "%d.%d", (midiOutCaps.vDriverVersion & 0xFF00) >> 8, midiOutCaps.vDriverVersion & 0xFF);
return MIDI_SUCCESS;
--- a/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.desktop/windows/native/libjsound/PLATFORM_API_WinOS_Ports.c Tue Oct 16 23:21:05 2018 +0530
@@ -357,7 +357,7 @@
INT32 PORT_GetPortMixerDescription(INT32 mixerIndex, PortMixerDescription* description) {
MIXERCAPSW mixerCaps;
- if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
+ if (mixerGetDevCapsW(mixerIndex, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) {
UnicodeToUTF8AndCopy(description->name, mixerCaps.szPname, PORT_STRING_LENGTH);
sprintf(description->version, "%d.%d", (mixerCaps.vDriverVersion & 0xFF00) >> 8, mixerCaps.vDriverVersion & 0xFF);
strncpy(description->description, "Port Mixer", PORT_STRING_LENGTH-1);
@@ -368,9 +368,9 @@
int getDestinationCount(HMIXER handle) {
int ret = 0;
- MIXERCAPS mixerCaps;
+ MIXERCAPSW mixerCaps;
- if (mixerGetDevCaps((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPS)) == MMSYSERR_NOERROR) {
+ if (mixerGetDevCapsW((UINT_PTR) handle, &mixerCaps, sizeof(MIXERCAPSW)) == MMSYSERR_NOERROR) {
ret = mixerCaps.cDestinations;
}
return ret;
--- a/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.logging/share/classes/java/util/logging/SimpleFormatter.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2000, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2000, 2018, 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
@@ -38,8 +38,7 @@
* <p>
* <a id="formatting">
* <b>Configuration:</b></a>
- * The {@code SimpleFormatter} is initialized with the
- * <a href="../Formatter.html#syntax">format string</a>
+ * The {@code SimpleFormatter} is initialized with the format string
* specified in the {@code java.util.logging.SimpleFormatter.format}
* property to {@linkplain #format(LogRecord) format} the log messages.
* This property can be defined
@@ -69,8 +68,7 @@
/**
* Format the given LogRecord.
* <p>
- * The formatting can be customized by specifying the
- * <a href="../Formatter.html#syntax">format string</a>
+ * The formatting can be customized by specifying the format string
* in the <a href="#formatting">
* {@code java.util.logging.SimpleFormatter.format}</a> property.
* The given {@code LogRecord} will be formatted as if by calling:
--- a/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.management/share/classes/sun/management/StackTraceElementCompositeData.java Tue Oct 16 23:21:05 2018 +0530
@@ -78,14 +78,16 @@
// CONTENTS OF THIS ARRAY MUST BE SYNCHRONIZED WITH
// STACK_TRACE_ELEMENT_ATTRIBUTES!
final Object[] stackTraceElementItemValues = {
- ste.getClassLoaderName(),
- ste.getModuleName(),
- ste.getModuleVersion(),
+ // JDK 5 attributes
ste.getClassName(),
ste.getMethodName(),
ste.getFileName(),
ste.getLineNumber(),
ste.isNativeMethod(),
+ // JDK 9 attributes
+ ste.getClassLoaderName(),
+ ste.getModuleName(),
+ ste.getModuleVersion(),
};
try {
return new CompositeDataSupport(STACK_TRACE_ELEMENT_COMPOSITE_TYPE,
--- a/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.naming/share/classes/com/sun/naming/internal/VersionHelper.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1999, 2014, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1999, 2018, 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
@@ -53,6 +53,20 @@
public final class VersionHelper {
private static final VersionHelper helper = new VersionHelper();
+ /**
+ * Determines whether classes may be loaded from an arbitrary URL code base.
+ */
+ private static final boolean TRUST_URL_CODE_BASE;
+
+ static {
+ // System property to control whether classes may be loaded from an
+ // arbitrary URL code base
+ PrivilegedAction<String> act
+ = () -> System.getProperty("com.sun.jndi.ldap.object.trustURLCodebase", "false");
+ String trust = AccessController.doPrivileged(act);
+ TRUST_URL_CODE_BASE = "true".equalsIgnoreCase(trust);
+ }
+
final static String[] PROPS = new String[]{
javax.naming.Context.INITIAL_CONTEXT_FACTORY,
javax.naming.Context.OBJECT_FACTORIES,
@@ -88,12 +102,14 @@
*/
public Class<?> loadClass(String className, String codebase)
throws ClassNotFoundException, MalformedURLException {
-
- ClassLoader parent = getContextClassLoader();
- ClassLoader cl =
- URLClassLoader.newInstance(getUrlArray(codebase), parent);
-
- return loadClass(className, cl);
+ if (TRUST_URL_CODE_BASE) {
+ ClassLoader parent = getContextClassLoader();
+ ClassLoader cl
+ = URLClassLoader.newInstance(getUrlArray(codebase), parent);
+ return loadClass(className, cl);
+ } else {
+ return null;
+ }
}
/**
--- a/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.net.http/share/classes/jdk/internal/net/http/MultiExchange.java Tue Oct 16 23:21:05 2018 +0530
@@ -26,21 +26,26 @@
package jdk.internal.net.http;
import java.io.IOException;
+import java.io.UncheckedIOException;
import java.net.ConnectException;
import java.net.http.HttpConnectTimeoutException;
import java.util.Iterator;
import java.util.LinkedList;
import java.security.AccessControlContext;
import java.util.concurrent.CompletableFuture;
+import java.util.concurrent.CompletionStage;
import java.util.concurrent.CompletionException;
import java.util.concurrent.ExecutionException;
import java.util.concurrent.Executor;
+import java.util.concurrent.Flow;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
import java.net.http.HttpRequest;
import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodySubscriber;
import java.net.http.HttpResponse.PushPromiseHandler;
import java.net.http.HttpTimeoutException;
import jdk.internal.net.http.common.Log;
@@ -200,11 +205,60 @@
return cf;
}
+ // return true if the response is a type where a response body is never possible
+ // and therefore doesn't have to include header information which indicates no
+ // body is present. This is distinct from responses that also do not contain
+ // response bodies (possibly ever) but which are required to have content length
+ // info in the header (eg 205). Those cases do not have to be handled specially
+
+ private static boolean bodyNotPermitted(Response r) {
+ return r.statusCode == 204;
+ }
+
+ private boolean bodyIsPresent(Response r) {
+ HttpHeaders headers = r.headers();
+ if (headers.firstValue("Content-length").isPresent())
+ return true;
+ if (headers.firstValue("Transfer-encoding").isPresent())
+ return true;
+ return false;
+ }
+
+ // Call the user's body handler to get an empty body object
+
+ private CompletableFuture<HttpResponse<T>> handleNoBody(Response r, Exchange<T> exch) {
+ BodySubscriber<T> bs = responseHandler.apply(new ResponseInfoImpl(r.statusCode(),
+ r.headers(), r.version()));
+ CompletionStage<T> cs = bs.getBody();
+ bs.onSubscribe(new NullSubscription());
+ bs.onComplete();
+ MinimalFuture<HttpResponse<T>> result = new MinimalFuture<>();
+ cs.whenComplete((nullBody, exception) -> {
+ if (exception != null)
+ result.completeExceptionally(exception);
+ else {
+ this.response =
+ new HttpResponseImpl<>(r.request(), r, this.response, nullBody, exch);
+ result.complete(this.response);
+ }
+ });
+ return result;
+ }
+
private CompletableFuture<HttpResponse<T>>
responseAsync0(CompletableFuture<Void> start) {
return start.thenCompose( v -> responseAsyncImpl())
.thenCompose((Response r) -> {
Exchange<T> exch = getExchange();
+ if (bodyNotPermitted(r)) {
+ if (bodyIsPresent(r)) {
+ IOException ioe = new IOException(
+ "unexpected content length header with 204 response");
+ exch.cancel(ioe);
+ return MinimalFuture.failedFuture(ioe);
+ } else
+ return handleNoBody(r, exch);
+ }
return exch.readBodyAsync(responseHandler)
.thenApply((T body) -> {
this.response =
@@ -214,6 +268,16 @@
});
}
+ static class NullSubscription implements Flow.Subscription {
+ @Override
+ public void request(long n) {
+ }
+
+ @Override
+ public void cancel() {
+ }
+ }
+
private CompletableFuture<Response> responseAsyncImpl() {
CompletableFuture<Response> cf;
if (attempts.incrementAndGet() > max_attempts) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package-info.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005, 2018, 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.
+ */
+
+/**
+ * DOM-specific classes for the {@link javax.xml.crypto} package.
+ * Only users who are using DOM-based XML cryptographic implementations (ex:
+ * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory})
+ * should need to make direct use of this package.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dom;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dom/package.html Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-DOM-specific classes for the {@link javax.xml.crypto} package.
-Only users who are using a DOM-based XML cryptographic implementations (ex:
-{@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory})
-should need to make direct use of this package.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/TransformService.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -68,11 +68,11 @@
* </pre>
* <code>TransformService</code> implementations that support the DOM
* mechanism type must abide by the DOM interoperability requirements defined
- * in the
- * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
- * of the API overview. See the
- * {@extLink security_guide_xmldsig_provider Service Providers} section of
- * the API overview for a list of standard mechanism types.
+ * in the <a href="package-summary.html#dom_req">DOM Mechanism
+ * Requirements</a>. See the {@code TransformService} section in the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names Specification</a> for a list of
+ * standard algorithm URIs and mechanism types.
* <p>
* Once a <code>TransformService</code> has been created, it can be used
* to process <code>Transform</code> or <code>CanonicalizationMethod</code>
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/XMLSignatureFactory.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, 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
@@ -66,10 +66,11 @@
*
* <p>The objects that this factory produces will be based
* on DOM and abide by the DOM interoperability requirements as defined in the
- * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
- * of the API overview. See the
- * {@extLink security_guide_xmldsig_provider Service Providers} section of
- * the API overview for a list of standard mechanism types.
+ * <a href="package-summary.html#dom_req">DOM Mechanism Requirements</a>.
+ * See the {@code XMLSignatureFactory} section in the <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names Specification</a> for a list of
+ * standard mechanism types.
*
* <p><code>XMLSignatureFactory</code> implementations are registered and loaded
* using the {@link java.security.Provider} mechanism.
@@ -180,8 +181,10 @@
* {@link Security#getProviders() Security.getProviders()}.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the {@extLink security_guide_xmldsig_provider
- * Service Providers} section of the API overview for a list of
+ * representation. See the {@code XMLSignatureFactory} section in the
+ * <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names Specification</a> for a list of
* standard mechanism types.
* @return a new <code>XMLSignatureFactory</code>
* @throws NullPointerException if <code>mechanismType</code> is
@@ -225,8 +228,10 @@
* provider list.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the {@extLink security_guide_xmldsig_provider
- * Service Providers} section of the API overview for a list of
+ * representation. See the {@code XMLSignatureFactory} section in the
+ * <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names Specification</a> for a list of
* standard mechanism types.
* @param provider the <code>Provider</code> object
* @return a new <code>XMLSignatureFactory</code>
@@ -276,8 +281,10 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the {@extLink security_guide_xmldsig_provider
- * Service Providers} section of the API overview for a list of
+ * representation. See the {@code XMLSignatureFactory} section in the
+ * <a href=
+ * "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
+ * Java Security Standard Algorithm Names Specification</a> for a list of
* standard mechanism types.
* @param provider the string name of the provider
* @return a new <code>XMLSignatureFactory</code>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package-info.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,47 @@
+/*
+ * Copyright (c) 2005, 2018, 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.
+ */
+
+/**
+ * DOM-specific classes for the {@link javax.xml.crypto.dsig} package.
+ * Only users who are using a DOM-based {@link
+ * javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory}
+ * should need to make direct use of this package.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dsig.dom;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/dom/package.html Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,50 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-DOM-specific classes for the {@link javax.xml.crypto.dsig} package.
-Only users who are using a DOM-based {@link
-javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} or
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory}
-should need to make direct use of this package.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/KeyInfoFactory.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2005, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -61,11 +61,11 @@
*
* <p>The objects that this factory produces will be based
* on DOM and abide by the DOM interoperability requirements as defined in the
- * {@extLink security_guide_xmldsig_rqmts DOM Mechanism Requirements} section
- * of the API overview. See the <a href=
+ * <a href="../package-summary.html#dom_req">DOM Mechanism Requirements</a>.
+ * See the {@code KeyInfoFactory} section in the <a href=
* "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
- * Java Security Standard Algorithm Names</a> document
- * for more information.
+ * Java Security Standard Algorithm Names Specification</a> for a list of
+ * standard mechanism types.
*
* <p><code>KeyInfoFactory</code> implementations are registered and loaded
* using the {@link java.security.Provider} mechanism.
@@ -137,10 +137,11 @@
* {@link Security#getProviders() Security.getProviders()}.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a href=
+ * representation. See the {@code KeyInfoFactory} section in the
+ * <a href=
* "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
- * Java Security Standard Algorithm Names</a> document
- * for more information.
+ * Java Security Standard Algorithm Names Specification</a> for a list
+ * of standard mechanism types.
* @return a new <code>KeyInfoFactory</code>
* @throws NullPointerException if <code>mechanismType</code> is
* <code>null</code>
@@ -182,10 +183,11 @@
* provider list.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a href=
+ * representation. See the {@code KeyInfoFactory} section in the
+ * <a href=
* "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
- * Java Security Standard Algorithm Names</a> document
- * for more information.
+ * Java Security Standard Algorithm Names Specification</a> for a list
+ * of standard mechanism types.
* @param provider the <code>Provider</code> object
* @return a new <code>KeyInfoFactory</code>
* @throws NullPointerException if <code>mechanismType</code> or
@@ -233,10 +235,11 @@
* the {@link Security#getProviders() Security.getProviders()} method.
*
* @param mechanismType the type of the XML processing mechanism and
- * representation. See the <a href=
+ * representation. See the {@code KeyInfoFactory} section in the
+ * <a href=
* "{@docRoot}/../specs/security/standard-names.html#xml-signature-xmlsignaturefactorykeyinfofactorytransformservice-mechanisms">
- * Java Security Standard Algorithm Names</a> document
- * for more information.
+ * Java Security Standard Algorithm Names Specification</a> for a list
+ * of standard mechanism types.
* @param provider the string name of the provider
* @return a new <code>KeyInfoFactory</code>
* @throws NoSuchProviderException if the specified provider is not
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package-info.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,59 @@
+/*
+ * Copyright (c) 2005, 2018, 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.
+ */
+
+/**
+ * Classes for parsing and processing {@link
+ * javax.xml.crypto.dsig.keyinfo.KeyInfo KeyInfo} elements and structures.
+ * <code>KeyInfo</code> is an optional element that enables the recipient(s) to
+ * obtain the key needed to validate an {@link
+ * javax.xml.crypto.dsig.XMLSignature XMLSignature}. <code>KeyInfo</code> may
+ * contain keys, names, certificates and other public key management
+ * information, such as in-band key distribution or key agreement data. This
+ * package contains classes representing types defined in the W3C specification
+ * for XML Signatures, such as
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyName KeyName},
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyValue KeyValue},
+ * {@link javax.xml.crypto.dsig.keyinfo.RetrievalMethod RetrievalMethod},
+ * {@link javax.xml.crypto.dsig.keyinfo.X509Data X509Data},
+ * {@link javax.xml.crypto.dsig.keyinfo.X509IssuerSerial X509IssuerSerial}, and
+ * {@link javax.xml.crypto.dsig.keyinfo.PGPData PGPData}.
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory} is an
+ * abstract factory that creates <code>KeyInfo</code> objects from scratch.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dsig.keyinfo;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/keyinfo/package.html Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-Classes for parsing and processing {@link javax.xml.crypto.dsig.keyinfo.KeyInfo
-KeyInfo} elements and structures. <code>KeyInfo</code> is an optional element
-that enables the recipient(s) to obtain the key needed to validate an
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature}. <code>KeyInfo</code>
-may contain keys, names, certificates and other public key management
-information, such as in-band key distribution or key agreement data. This
-package contains classes representing types defined in the W3C specification
-for XML Signatures, such as
-{@link javax.xml.crypto.dsig.keyinfo.KeyName KeyName},
-{@link javax.xml.crypto.dsig.keyinfo.KeyValue KeyValue},
-{@link javax.xml.crypto.dsig.keyinfo.RetrievalMethod RetrievalMethod},
-{@link javax.xml.crypto.dsig.keyinfo.X509Data X509Data},
-{@link javax.xml.crypto.dsig.keyinfo.X509IssuerSerial X509IssuerSerial}, and
-{@link javax.xml.crypto.dsig.keyinfo.PGPData PGPData}.
-{@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory}
-is an abstract factory that creates <code>KeyInfo</code> objects from scratch.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package-info.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,169 @@
+/*
+ * Copyright (c) 2005, 2018, 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.
+ */
+
+/**
+ * Classes for generating and validating XML digital
+ * signatures. This package includes classes that represent the core elements
+ * defined in the W3C XML digital signature specification:
+ * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature},
+ * {@link javax.xml.crypto.dsig.SignedInfo SignedInfo},
+ * {@link javax.xml.crypto.dsig.CanonicalizationMethod CanonicalizationMethod},
+ * {@link javax.xml.crypto.dsig.SignatureMethod SignatureMethod},
+ * {@link javax.xml.crypto.dsig.Reference Reference},
+ * {@link javax.xml.crypto.dsig.DigestMethod DigestMethod},
+ * {@link javax.xml.crypto.dsig.XMLObject XMLObject},
+ * {@link javax.xml.crypto.dsig.Manifest Manifest},
+ * {@link javax.xml.crypto.dsig.SignatureProperties SignatureProperties}, and
+ * {@link javax.xml.crypto.dsig.SignatureProperty SignatureProperty}.
+ * {@code KeyInfo} types are defined in the
+ * {@link javax.xml.crypto.dsig.keyinfo} subpackage.
+ * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory}
+ * is an abstract factory that creates
+ * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature} objects from scratch
+ * or from a pre-existing XML representation, such as a DOM node.
+ * {@link javax.xml.crypto.dsig.TransformService} is a service provider
+ * interface for creating and plugging in implementations of
+ * transform and canonicalization algorithms.
+ *
+ * <p>Of primary significance in this package is the
+ * {@link javax.xml.crypto.dsig.XMLSignature XMLSignature} class,
+ * which allows you to sign and validate an XML digital signature.
+ *
+ * <h2><a id="service_providers"></a>Service Providers</h2>
+ * A service provider is a concrete implementation of the abstract
+ * {@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory} and
+ * {@link javax.xml.crypto.dsig.keyinfo.KeyInfoFactory KeyInfoFactory} classes
+ * and is responsible for creating objects and algorithms that parse, generate
+ * and validate XML Signatures and KeyInfo structures. A concrete implementation
+ * of {@code XMLSignatureFactory} MUST provide support for each of the REQUIRED
+ * algorithms as specified by the W3C recommendation for XML Signatures. It MAY
+ * support other algorithms as defined by the W3C recommendation or other
+ * specifications.
+ *
+ * <p>The API leverages the JCA provider model (see
+ * {@link java.security.Provider the Provider class}) for registering and
+ * loading {@code XMLSignatureFactory} and {@code KeyInfoFactory}
+ * implementations.
+ *
+ * <p>Each concrete {@code XMLSignatureFactory} or {@code KeyInfoFactory}
+ * implementation supports a specific XML mechanism type that identifies the XML
+ * processing mechanism that an implementation uses internally to parse and
+ * generate XML signature and KeyInfo structures.
+ *
+ * <p>A service provider implementation SHOULD use underlying JCA engine
+ * classes, such as {@link java.security.Signature} and
+ * {@link java.security.MessageDigest} to perform cryptographic operations.
+ *
+ * <p>In addition to the {@code XMLSignatureFactory} and {@code KeyInfoFactory}
+ * classes, the API supports a service provider interface for transform and
+ * canonicalization algorithms. The {@link
+ * javax.xml.crypto.dsig.TransformService TransformService} class allows you to
+ * develop and plug in an implementation of a specific transform or
+ * canonicalization algorithm for a particular XML mechanism type. The {@code
+ * TransformService} class uses the standard JCA provider model for registering
+ * and loading implementations. Each service provider implementation SHOULD use
+ * the {@code TransformService} class to find a provider that supports transform
+ * and canonicalization algorithms in XML Signatures that it is generating or
+ * validating.
+ *
+ * <h3><a id="dom_req"></a>DOM Mechanism Requirements</h3>
+ * The following requirements MUST be abided by when implementing a DOM-based
+ * {@code XMLSignatureFactory}, {@code KeyInfoFactory} or {@code
+ * TransformService} in order to minimize interoperability problems:
+ * <ol>
+ * <li>The {@code unmarshalXMLSignature} method of {@code XMLSignatureFactory}
+ * MUST support {@code DOMValidateContext} types. If the type is
+ * {@code DOMValidateContext}, it SHOULD contain an {@code Element} of type
+ * Signature. Additionally, the {@code unmarshalXMLSignature} method MAY
+ * populate the Id/Element mappings of the passed-in {@code DOMValidateContext}.
+ * </li>
+ *
+ * <li>The {@code sign} method of {@code XMLSignature}s produced by
+ * {@code XMLSignatureFactory} MUST support {@code DOMSignContext} types and the
+ * {@code validate} method MUST support {@code DOMValidateContext} types. This
+ * requirement also applies to the {@code validate} method of {@code
+ * SignatureValue} and the {@code validate} method of {@code Reference}.</li>
+ *
+ * <li>The implementation MUST support {@code DOMStructure}s as the mechanism
+ * for the application to specify extensible content (any elements or mixed
+ * content).</li>
+ *
+ * <li>If the {@code dereference} method of user-specified {@code
+ * URIDereferencer}s returns {@code NodeSetData} objects, the {@code iterator}
+ * method MUST return an iteration over objects of type {@code
+ * org.w3c.dom.Node}.</li>
+ *
+ * <li>{@code URIReference} objects passed to the {@code dereference} method of
+ * user-specified {@code URIDereferencer}s MUST be of type {@code
+ * DOMURIReference} and {@code XMLCryptoContext} objects MUST implement {@code
+ * DOMCryptoContext}.</li>
+ *
+ * <li>The previous 2 requirements also apply to {@code URIDereferencer}s
+ * returned by the {@code getURIDereferencer} method of {@code
+ * XMLSignatureFactory} and {@code KeyInfoFactory}.</li>
+ *
+ * <li>The {@code unmarshalKeyInfo} method of {@code KeyInfoFactory} MUST
+ * support {@code DOMStructure} types. If the type is {@code DOMStructure}, it
+ * SHOULD contain an {@code Element} of type {@code KeyInfo}.</li>
+ *
+ * <li>The {@code transform} method of {@code Transform} MUST support
+ * {@code DOMCryptoContext} context parameter types.</li>
+ *
+ * <li>The {@code newtransform} and {@code newCanonicalizationMethod} methods of
+ * {@code XMLSignatureFactory} MUST support {@code DOMStructure} parameter
+ * types.</li>
+ *
+ * <li>The {@code init}, and {@code marshalParams} methods of
+ * {@code TransformService} MUST support {@code DOMStructure} and
+ * {@code DOMCryptoContext} types.</li>
+ *
+ * <li>The {@code unmarshalXMLSignature} method of {@code XMLSignatureFactory}
+ * MUST support {@code DOMStructure} types. If the type is {@code DOMStructure},
+ * it SHOULD contain an {@code Element} of type {@code Signature}.</li>
+ *
+ * <li>The {@code marshal} method of {@code KeyInfo} MUST support
+ * {@code DOMStructure} and {@code DOMCryptoContext} parameter types.</li>
+ * </ol>
+ *
+ * <p>Note that a DOM implementation MAY internally use other XML parsing APIs
+ * other than DOM as long as it doesn't affect interoperability. For example, a
+ * DOM implementation of {@code XMLSignatureFactory} might use a SAX parser
+ * internally to canonicalize data.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dsig;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/package.html Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,71 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-Classes for generating and validating XML digital
-signatures. This package includes classes that represent the core elements
-defined in the W3C XML digital signature specification:
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature},
-{@link javax.xml.crypto.dsig.SignedInfo SignedInfo},
-{@link javax.xml.crypto.dsig.CanonicalizationMethod CanonicalizationMethod},
-{@link javax.xml.crypto.dsig.SignatureMethod SignatureMethod},
-{@link javax.xml.crypto.dsig.Reference Reference},
-{@link javax.xml.crypto.dsig.DigestMethod DigestMethod},
-{@link javax.xml.crypto.dsig.XMLObject XMLObject},
-{@link javax.xml.crypto.dsig.Manifest Manifest},
-{@link javax.xml.crypto.dsig.SignatureProperties SignatureProperties}, and
-{@link javax.xml.crypto.dsig.SignatureProperty SignatureProperty}.
-<code>KeyInfo</code> types
-are defined in the {@link javax.xml.crypto.dsig.keyinfo} subpackage.
-{@link javax.xml.crypto.dsig.XMLSignatureFactory XMLSignatureFactory}
-is an abstract factory that creates
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature} objects from scratch
-or from a pre-existing XML representation, such as a DOM node.
-{@link javax.xml.crypto.dsig.TransformService} is a service provider
-interface for creating and plugging in implementations of
-transform and canonicalization algorithms.
-
-<p>Of primary significance in this package is the
-{@link javax.xml.crypto.dsig.XMLSignature XMLSignature} class,
-which allows you to sign and validate an XML digital signature.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package-info.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,52 @@
+/*
+ * Copyright (c) 2005, 2018, 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.
+ */
+
+/**
+ * Parameter classes for XML digital signatures. This package
+ * contains interfaces and classes representing input parameters for the
+ * digest, signature, transform, or canonicalization algorithms used in
+ * the processing of XML signatures.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * <li>
+ * <a href="http://www.w3.org/TR/xml-exc-c14n/">
+ * Exclusive XML Canonicalization algorithm: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-filter2/">
+ * XPath Filter 2.0 Transform Algorithm: W3C Recommendation</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto.dsig.spec;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/dsig/spec/package.html Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,55 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-Parameter classes for XML digital signatures. This package
-contains interfaces and classes representing input parameters for the
-digest, signature, transform, or canonicalization algorithms used in
-the processing of XML signatures.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-<li>
-<a href="http://www.w3.org/TR/xml-exc-c14n/">
-Exclusive XML Canonicalization algorithm: W3C Recommendation</a>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-filter2/">
-XPath Filter 2.0 Transform Algorithm: W3C Recommendation</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/src/java.xml.crypto/share/classes/javax/xml/crypto/package-info.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,45 @@
+/*
+ * Copyright (c) 2005, 2018, 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.
+ */
+
+/**
+ * Common classes for XML cryptography. This package includes common classes
+ * that are used to perform XML cryptographic operations, such as generating
+ * an XML signature or encrypting XML data.
+ *
+ * <h2>Package Specification</h2>
+ *
+ * <ul>
+ * <li>
+ * <a href="http://www.w3.org/TR/xmldsig-core/">
+ * XML-Signature Syntax and Processing: W3C Recommendation</a>
+ * <li>
+ * <a href="http://www.ietf.org/rfc/rfc3275.txt">
+ * RFC 3275: XML-Signature Syntax and Processing</a>
+ * </ul>
+ *
+ * @since 1.6
+ */
+
+package javax.xml.crypto;
--- a/src/java.xml.crypto/share/classes/javax/xml/crypto/package.html Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,48 +0,0 @@
-<html>
-<head>
-<!--
-Copyright (c) 2005, 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.
--->
-
-</head>
-<body>
-Common classes for XML cryptography. This package includes common classes that
-are used to perform XML cryptographic operations, such as generating
-an XML signature or encrypting XML data.
-
-<h2>Package Specification</h2>
-
-<ul>
-<li>
-<a href="http://www.w3.org/TR/xmldsig-core/">
-XML-Signature Syntax and Processing: W3C Recommendation</a>
-<li>
-<a href="http://www.ietf.org/rfc/rfc3275.txt">
-RFC 3275: XML-Signature Syntax and Processing</a>
-</ul>
-
-@since 1.6
-
-</body>
-</html>
--- a/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/java.xml/share/classes/com/sun/org/apache/xerces/internal/jaxp/datatype/XMLGregorianCalendarImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2004, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2004, 2018, 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
@@ -190,6 +190,7 @@
* @author Sunitha Reddy
* @see javax.xml.datatype.Duration
* @since 1.5
+ * @LastModified: June 2018
*/
public class XMLGregorianCalendarImpl
@@ -2755,7 +2756,7 @@
if ((fractional.compareTo(DECIMAL_ZERO) < 0) ||
(fractional.compareTo(DECIMAL_ONE) > 0)) {
throw new IllegalArgumentException(DatatypeMessageFormatter.formatMessage(null,
- "InvalidFractional", new Object[]{fractional}));
+ "InvalidFractional", new Object[]{fractional.toString()}));
}
}
this.fractionalSecond = fractional;
--- a/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.crypto.mscapi/windows/native/libsunmscapi/security.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -250,7 +250,6 @@
{
HCRYPTPROV hCryptProv = NULL;
- BYTE* pbData = NULL;
jbyte* reseedBytes = NULL;
jbyte* seedBytes = NULL;
jbyteArray result = NULL;
@@ -294,28 +293,17 @@
result = NULL;
- } else if (length > 0) {
+ } else {
- pbData = new (env) BYTE[length];
- if (pbData == NULL) {
- __leave;
+ if (length > 0) {
+ seed = env->NewByteArray(length);
+ if (seed == NULL) {
+ __leave;
+ }
+ } else {
+ length = env->GetArrayLength(seed);
}
- if (::CryptGenRandom(
- hCryptProv,
- length,
- pbData) == FALSE) {
-
- ThrowException(env, PROVIDER_EXCEPTION, GetLastError());
- __leave;
- }
-
- result = env->NewByteArray(length);
- env->SetByteArrayRegion(result, 0, length, (jbyte*) pbData);
-
- } else { // length == 0
-
- length = env->GetArrayLength(seed);
if ((seedBytes = env->GetByteArrayElements(seed, 0)) == NULL) {
__leave;
}
@@ -340,9 +328,6 @@
if (reseedBytes)
env->ReleaseByteArrayElements(seed, reseedBytes, JNI_ABORT);
- if (pbData)
- delete [] pbData;
-
if (seedBytes)
env->ReleaseByteArrayElements(seed, seedBytes, 0); // update orig
--- a/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.httpserver/share/classes/sun/net/httpserver/ExchangeImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -255,9 +255,7 @@
noContentToSend = true;
contentLen = 0;
}
- if (noContentLengthHeader) {
- rspHdrs.remove("Content-length");
- } else {
+ if (!noContentLengthHeader) {
rspHdrs.set("Content-length", Long.toString(contentLen));
}
o.setWrappedStream (new FixedLengthOutputStream (this, ros, contentLen));
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/Utils.java Tue Oct 16 23:21:05 2018 +0530
@@ -30,6 +30,8 @@
import java.net.URI;
import java.text.CollationKey;
import java.text.Collator;
+import java.text.ParseException;
+import java.text.RuleBasedCollator;
import java.util.*;
import java.util.AbstractMap.SimpleEntry;
import java.util.Map.Entry;
@@ -1483,7 +1485,7 @@
return false;
}
- if (!getBlockTags(m).isEmpty())
+ if (!getBlockTags(m).isEmpty() || isDeprecated(m))
return false;
List<? extends DocTree> fullBody = getFullBody(m);
@@ -1588,7 +1590,7 @@
private final Collator instance;
private final int MAX_SIZE = 1000;
private DocCollator(Locale locale, int strength) {
- instance = Collator.getInstance(locale);
+ instance = createCollator(locale);
instance.setStrength(strength);
keys = new LinkedHashMap<String, CollationKey>(MAX_SIZE + 1, 0.75f, true) {
@@ -1607,6 +1609,21 @@
public int compare(String s1, String s2) {
return getKey(s1).compareTo(getKey(s2));
}
+
+ private Collator createCollator(Locale locale) {
+ Collator baseCollator = Collator.getInstance(locale);
+ if (baseCollator instanceof RuleBasedCollator) {
+ // Extend collator to sort signatures with additional args and var-args in a well-defined order:
+ // () < (int) < (int, int) < (int...)
+ try {
+ return new RuleBasedCollator(((RuleBasedCollator) baseCollator).getRules()
+ + "& ')' < ',' < '.','['");
+ } catch (ParseException e) {
+ throw new RuntimeException(e);
+ }
+ }
+ return baseCollator;
+ }
}
private Comparator<Element> moduleComparator = null;
--- a/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.javadoc/share/classes/jdk/javadoc/internal/doclets/toolkit/util/VisibleMemberTable.java Tue Oct 16 23:21:05 2018 +0530
@@ -248,7 +248,7 @@
* @param e the method to check
* @return the overridden method or null
*/
- public ExecutableElement getsimplyOverriddenMethod(ExecutableElement e) {
+ public ExecutableElement getSimplyOverriddenMethod(ExecutableElement e) {
ensureInitialized();
OverridingMethodInfo found = overriddenMethodTable.get(e);
@@ -869,7 +869,7 @@
public List<ExecutableElement> getImplementedMethods(ExecutableElement method) {
ImplementedMethods imf = getImplementedMethodsFinder(method);
return imf.getImplementedMethods().stream()
- .filter(m -> getsimplyOverriddenMethod(m) == null)
+ .filter(m -> getSimplyOverriddenMethod(m) == null)
.collect(Collectors.toList());
}
--- a/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Fri Oct 19 11:15:57 2018 -0700
+++ b/src/jdk.scripting.nashorn/share/classes/jdk/nashorn/internal/objects/Global.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -1601,13 +1601,14 @@
}
}
- switch (nameStr) {
- case "context":
+ if ("context".equals(nameStr)) {
return sctxt;
- case "engine":
- return global.engine;
- default:
- break;
+ } else if ("engine".equals(nameStr)) {
+ // expose "engine" variable only when there is no security manager
+ // or when no class filter is set.
+ if (System.getSecurityManager() == null || global.getClassFilter() == null) {
+ return global.engine;
+ }
}
if (self == UNDEFINED) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/gtest/memory/test_virtualspace.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,339 @@
+/*
+ * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * This code is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
+ * version 2 for more details (a copy is included in the LICENSE file that
+ * accompanied this code).
+ *
+ * You should have received a copy of the GNU General Public License version
+ * 2 along with this work; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
+ *
+ * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
+ * or visit www.oracle.com if you need additional information or have any
+ * questions.
+ */
+
+#include "precompiled.hpp"
+#include "memory/virtualspace.hpp"
+#include "runtime/os.hpp"
+#include "oops/oop.hpp"
+#include "utilities/align.hpp"
+#include "unittest.hpp"
+
+namespace {
+ class MemoryReleaser {
+ ReservedSpace* const _rs;
+ public:
+ MemoryReleaser(ReservedSpace* rs) : _rs(rs) { }
+ ~MemoryReleaser() {
+ if (_rs->special()) {
+ EXPECT_TRUE(os::release_memory_special(_rs->base(), _rs->size()));
+ } else {
+ EXPECT_TRUE(os::release_memory(_rs->base(), _rs->size()));
+ }
+ }
+ };
+
+ static void small_page_write(void* addr, size_t size) {
+ size_t page_size = os::vm_page_size();
+
+ char* end = (char*) addr + size;
+ for (char* p = (char*) addr; p < end; p += page_size) {
+ *p = 1;
+ }
+ }
+
+ // have to use these functions, as gtest's _PRED macros don't like is_aligned
+ // nor (is_aligned<size_t, size_t>)
+ static bool is_size_aligned(size_t size, size_t alignment) {
+ return is_aligned(size, alignment);
+ }
+ static bool is_ptr_aligned(void* ptr, size_t alignment) {
+ return is_aligned(ptr, alignment);
+ }
+
+ static void test_reserved_size(size_t size) {
+ ASSERT_PRED2(is_size_aligned, size, os::vm_allocation_granularity());
+
+ ReservedSpace rs(size);
+ MemoryReleaser releaser(&rs);
+
+ EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special();
+ EXPECT_EQ(size, rs.size()) << "rs.special: " << rs.special();
+
+ if (rs.special()) {
+ small_page_write(rs.base(), size);
+ }
+ }
+
+ static void test_reserved_size_alignment(size_t size, size_t alignment) {
+ ASSERT_PRED2(is_size_aligned, size, alignment) << "Incorrect input parameters";
+
+ ReservedSpace rs(size, alignment, UseLargePages, (char *) NULL);
+
+ ASSERT_TRUE(rs.base() != NULL) << "rs.special = " << rs.special();
+ ASSERT_EQ(size, rs.size()) << "rs.special = " << rs.special();
+
+ EXPECT_PRED2(is_ptr_aligned, rs.base(), alignment)
+ << "aligned sizes should always give aligned addresses";
+ EXPECT_PRED2(is_ptr_aligned, (void*) rs.size(), alignment)
+ << "aligned sizes should always give aligned addresses";
+
+ if (rs.special()) {
+ small_page_write(rs.base(), size);
+ }
+ }
+
+ static void test_reserved_size_alignment_page_type(size_t size, size_t alignment, bool maybe_large) {
+ if (size < alignment) {
+ // Tests might set -XX:LargePageSizeInBytes=<small pages> and cause unexpected input arguments for this test.
+ ASSERT_EQ((size_t) os::vm_page_size(), os::large_page_size()) << "Test needs further refinement";
+ return;
+ }
+
+ ASSERT_PRED2(is_size_aligned, size, os::vm_allocation_granularity()) << "Must be at least AG aligned";
+ ASSERT_PRED2(is_size_aligned, size, alignment) << "Must be at least AG aligned";
+
+ bool large = maybe_large && UseLargePages && size >= os::large_page_size();
+
+ ReservedSpace rs(size, alignment, large, false);
+ MemoryReleaser releaser(&rs);
+
+ EXPECT_TRUE(rs.base() != NULL) << "rs.special: " << rs.special();
+ EXPECT_EQ(size, rs.size()) << "rs.special: " << rs.special();
+
+ if (rs.special()) {
+ small_page_write(rs.base(), size);
+ }
+ }
+}
+
+TEST_VM(ReservedSpace, size_alignment) {
+ size_t size = 2 * 1024 * 1024;
+ size_t ag = os::vm_allocation_granularity();
+
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size, ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size * 2, ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment(size * 10, ag));
+}
+
+TEST_VM(ReservedSpace, size) {
+ size_t size = 2 * 1024 * 1024;
+ size_t ag = os::vm_allocation_granularity();
+
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 1));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size - ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size + ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2 - ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 2 + ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3 - ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 3 + ag));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size(size * 10 + size / 2));
+}
+
+TEST_VM(ReservedSpace, size_alignment_page_type) {
+ size_t ag = os::vm_allocation_granularity();
+
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag, ag , false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 2, ag , false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 3, ag , false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 2, ag * 2, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 4, ag * 2, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 8, ag * 2, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 4, ag * 4, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 8, ag * 4, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(ag * 16, ag * 4, false));
+}
+
+TEST_VM(ReservedSpace, size_alignment_page_type_large_page) {
+ if (!UseLargePages) {
+ return;
+ }
+
+ size_t ag = os::vm_allocation_granularity();
+ size_t lp = os::large_page_size();
+
+ // Without large pages
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, ag * 4, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, ag * 4, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, ag * 4, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, lp , false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp , false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 3, lp , false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp * 2, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, lp * 2, false));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 8, lp * 2, false));
+
+ // With large pages
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, ag * 4 , true));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, ag * 4, true));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, ag * 4, true));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp, lp , true));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp , true));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 3, lp , true));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 2, lp * 2, true));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 4, lp * 2, true));
+ EXPECT_NO_FATAL_FAILURE(test_reserved_size_alignment_page_type(lp * 8, lp * 2, true));
+}
+
+namespace {
+ enum TestLargePages {
+ Default,
+ Disable,
+ Reserve,
+ Commit
+ };
+
+ class ReservedSpaceReleaser {
+ ReservedSpace* const _rs;
+ public:
+ ReservedSpaceReleaser(ReservedSpace* rs) : _rs(rs) { }
+ ~ReservedSpaceReleaser() {
+ _rs->release();
+ }
+ };
+
+ ReservedSpace reserve_memory(size_t reserve_size_aligned, TestLargePages mode) {
+ switch(mode) {
+ default:
+ case Default:
+ case Reserve:
+ return ReservedSpace(reserve_size_aligned);
+ case Disable:
+ case Commit:
+ return ReservedSpace(reserve_size_aligned,
+ os::vm_allocation_granularity(),
+ /* large */ false, /* exec */ false);
+ }
+ }
+
+ bool initialize_virtual_space(VirtualSpace& vs, ReservedSpace rs, TestLargePages mode) {
+ switch(mode) {
+ default:
+ case Default:
+ case Reserve:
+ return vs.initialize(rs, 0);
+ case Disable:
+ return vs.initialize_with_granularity(rs, 0, os::vm_page_size());
+ case Commit:
+ return vs.initialize_with_granularity(rs, 0, os::page_size_for_region_unaligned(rs.size(), 1));
+ }
+ }
+
+ void test_virtual_space_actual_committed_space(size_t reserve_size, size_t commit_size,
+ TestLargePages mode = Default) {
+ size_t granularity = os::vm_allocation_granularity();
+ size_t reserve_size_aligned = align_up(reserve_size, granularity);
+
+ ReservedSpace reserved = reserve_memory(reserve_size_aligned, mode);
+ ReservedSpaceReleaser releaser(&reserved);
+
+ ASSERT_TRUE(reserved.is_reserved());
+
+ VirtualSpace vs;
+ ASSERT_TRUE(initialize_virtual_space(vs, reserved, mode)) << "Failed to initialize VirtualSpace";
+ vs.expand_by(commit_size, false);
+
+ if (vs.special()) {
+ EXPECT_EQ(reserve_size_aligned, vs.actual_committed_size());
+ } else {
+ EXPECT_GE(vs.actual_committed_size(), commit_size);
+ // Approximate the commit granularity.
+ // Make sure that we don't commit using large pages
+ // if large pages has been disabled for this VirtualSpace.
+ size_t commit_granularity = (mode == Disable || !UseLargePages) ?
+ os::vm_page_size() : os::large_page_size();
+ EXPECT_LT(vs.actual_committed_size(), commit_size + commit_granularity);
+ }
+ }
+}
+
+TEST_VM(VirtualSpace, actual_committed_space) {
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(4 * K, 0));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(4 * K, 4 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K, 0));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K, 4 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(8 * K, 8 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 0));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 4 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 8 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(12 * K, 12 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 0));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 32 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(64 * K, 64 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 0));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 4 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 64 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 1 * M));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(2 * M, 2 * M));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M));
+}
+
+TEST_VM(VirtualSpace, actual_committed_space_one_large_page) {
+ if (!UseLargePages) {
+ return;
+ }
+
+ size_t large_page_size = os::large_page_size();
+
+ ReservedSpace reserved(large_page_size, large_page_size, true, false);
+ ReservedSpaceReleaser releaser(&reserved);
+ ASSERT_TRUE(reserved.is_reserved());
+
+ VirtualSpace vs;
+ ASSERT_TRUE(vs.initialize(reserved, 0)) << "Failed to initialize VirtualSpace";
+ vs.expand_by(large_page_size, false);
+
+ EXPECT_EQ(large_page_size, vs.actual_committed_size());
+}
+
+TEST_VM(VirtualSpace, disable_large_pages) {
+ if (!UseLargePages) {
+ return;
+ }
+ // These test cases verify that if we force VirtualSpace to disable large pages
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0, Disable));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K, Disable));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K, Disable));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M, Disable));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M, Disable));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M, Disable));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Disable));
+
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0, Reserve));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K, Reserve));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K, Reserve));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M, Reserve));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M, Reserve));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M, Reserve));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Reserve));
+
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 0, Commit));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 4 * K, Commit));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 8 * K, Commit));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 1 * M, Commit));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 2 * M, Commit));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 5 * M, Commit));
+ EXPECT_NO_FATAL_FAILURE(test_virtual_space_actual_committed_space(10 * M, 10 * M, Commit));
+}
--- a/test/hotspot/jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/compiler/aot/cli/MultipleAOTLibraryTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -54,6 +54,7 @@
package compiler.aot.cli;
import compiler.aot.HelloWorldPrinter;
+import java.io.File;
import java.util.Arrays;
import jdk.test.lib.process.ExitCode;
import jdk.test.lib.cli.CommandLineOptionTest;
@@ -75,8 +76,11 @@
boolean addTestVMOptions = true;
String[] allArgs = Arrays.copyOf(args, args.length + 4);
allArgs[args.length] = "-XX:AOTLibrary="
- + "./libMultipleAOTLibraryTest1.so:"
- + "./libMultipleAOTLibraryTest2.so";
+ + "." + File.separator
+ + "libMultipleAOTLibraryTest1.so"
+ + File.pathSeparator
+ + "." + File.separator
+ + "libMultipleAOTLibraryTest2.so";
allArgs[args.length + 1] = "-XX:+PrintAOT";
allArgs[args.length + 2] = "-XX:+UseAOT";
allArgs[args.length + 3] = HelloWorldPrinter.class.getName();
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/compiler/codegen/TestTrichotomyExpressions.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,2516 @@
+/*
+ * Copyright (c) 2018, 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 8210215
+ * @summary Test that C2 correctly optimizes trichotomy expressions.
+ * @library /test/lib
+ * @run main/othervm/timeout=240 -XX:-TieredCompilation -Xbatch
+ * -XX:CompileCommand=dontinline,compiler.codegen.TestTrichotomyExpressions::test*
+ * compiler.codegen.TestTrichotomyExpressions
+ */
+
+package compiler.codegen;
+
+import java.lang.annotation.ElementType;
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+import java.lang.annotation.Target;
+import java.lang.reflect.Method;
+import java.util.Random;
+
+import jdk.test.lib.Asserts;
+import jdk.test.lib.Utils;
+
+enum Operation { SMALLER, SMALLER_EQUAL, EQUAL, GREATER_EQUAL, GREATER, ALWAYS_FALSE }
+
+@Retention(RetentionPolicy.RUNTIME)
+@Target(ElementType.METHOD)
+@interface Test {
+ Operation op();
+}
+
+public class TestTrichotomyExpressions {
+
+ public static int compare1(int a, int b) {
+ return (a < b) ? -1 : (a == b) ? 0 : 1;
+ }
+
+ public static int compare2(int a, int b) {
+ return (a < b) ? -1 : (a <= b) ? 0 : 1;
+ }
+
+ public static int compare3(int a, int b) {
+ return (a < b) ? -1 : (a > b) ? 1 : 0;
+ }
+
+ public static int compare4(int a, int b) {
+ return (a < b) ? -1 : (a != b) ? 1 : 0;
+ }
+
+ public static int compare5(int a, int b) {
+ return (a > b) ? 1 : (a < b) ? -1 : 0;
+ }
+
+ public static int compare6(int a, int b) {
+ return (a > b) ? 1 : (a == b) ? 0 : -1;
+ }
+
+ public static int compare7(int a, int b) {
+ return (a > b) ? 1 : (a >= b) ? 0 : -1;
+ }
+
+ public static int compare8(int a, int b) {
+ return (a > b) ? 1 : (a != b) ? -1 : 0;
+ }
+
+ public static int compare9(int a, int b) {
+ return (a == b) ? 0 : (a < b) ? -1 : 1;
+ }
+
+ public static int compare10(int a, int b) {
+ return (a == b) ? 0 : (a <= b) ? -1 : 1;
+ }
+
+ public static int compare11(int a, int b) {
+ return (a == b) ? 0 : (a > b) ? 1 : -1;
+ }
+
+ public static int compare12(int a, int b) {
+ return (a == b) ? 0 : (a >= b) ? 1 : -1;
+ }
+
+ public static int compare13(int a, int b) {
+ return (a <= b) ? ((a == b) ? 0 : -1) : 1;
+ }
+
+ public static int compare14(int a, int b) {
+ return (a <= b) ? ((a < b) ? -1 : 0) : 1;
+ }
+
+ public static int compare15(int a, int b) {
+ return (a <= b) ? ((a >= b) ? 0 : -1) : 1;
+ }
+
+ public static int compare16(int a, int b) {
+ return (a <= b) ? ((a != b) ? -1 : 0) : 1;
+ }
+
+ public static int compare17(int a, int b) {
+ return (a >= b) ? ((a <= b) ? 0 : 1) : -1;
+ }
+
+ public static int compare18(int a, int b) {
+ return (a >= b) ? ((a == b) ? 0 : 1) : -1;
+ }
+
+ public static int compare19(int a, int b) {
+ return (a >= b) ? ((a > b) ? 1 : 0) : -1;
+ }
+
+ public static int compare20(int a, int b) {
+ return (a >= b) ? ((a != b) ? 1 : 0) : -1;
+ }
+
+ public static int compare21(int a, int b) {
+ return (a != b) ? ((a < b) ? -1 : 1) : 0;
+ }
+
+ public static int compare22(int a, int b) {
+ return (a != b) ? ((a <= b) ? -1 : 1) : 0;
+ }
+
+ public static int compare23(int a, int b) {
+ return (a != b) ? ((a > b) ? 1 : -1) : 0;
+ }
+
+ public static int compare24(int a, int b) {
+ return (a != b) ? ((a >= b) ? 1 : -1) : 0;
+ }
+
+ public static int compare25(int a, int b) {
+ return (a < b) ? -1 : (b == a) ? 0 : 1;
+ }
+
+ public static int compare26(int a, int b) {
+ return (a < b) ? -1 : (b >= a) ? 0 : 1;
+ }
+
+ public static int compare27(int a, int b) {
+ return (a < b) ? -1 : (b < a) ? 1 : 0;
+ }
+
+ public static int compare28(int a, int b) {
+ return (a < b) ? -1 : (b != a) ? 1 : 0;
+ }
+
+ public static int compare29(int a, int b) {
+ return (a > b) ? 1 : (b > a) ? -1 : 0;
+ }
+
+ public static int compare30(int a, int b) {
+ return (a > b) ? 1 : (b == a) ? 0 : -1;
+ }
+
+ public static int compare31(int a, int b) {
+ return (a > b) ? 1 : (b <= a) ? 0 : -1;
+ }
+
+ public static int compare32(int a, int b) {
+ return (a > b) ? 1 : (b != a) ? -1 : 0;
+ }
+
+ public static int compare33(int a, int b) {
+ return (a == b) ? 0 : (b > a) ? -1 : 1;
+ }
+
+ public static int compare34(int a, int b) {
+ return (a == b) ? 0 : (b >= a) ? -1 : 1;
+ }
+
+ public static int compare35(int a, int b) {
+ return (a == b) ? 0 : (b < a) ? 1 : -1;
+ }
+
+ public static int compare36(int a, int b) {
+ return (a == b) ? 0 : (b <= a) ? 1 : -1;
+ }
+
+ public static int compare37(int a, int b) {
+ return (a <= b) ? ((b == a) ? 0 : -1) : 1;
+ }
+
+ public static int compare38(int a, int b) {
+ return (a <= b) ? ((b > a) ? -1 : 0) : 1;
+ }
+
+ public static int compare39(int a, int b) {
+ return (a <= b) ? ((b <= a) ? 0 : -1) : 1;
+ }
+
+ public static int compare40(int a, int b) {
+ return (a <= b) ? ((b != a) ? -1 : 0) : 1;
+ }
+
+ public static int compare41(int a, int b) {
+ return (a >= b) ? ((b >= a) ? 0 : 1) : -1;
+ }
+
+ public static int compare42(int a, int b) {
+ return (a >= b) ? ((b == a) ? 0 : 1) : -1;
+ }
+
+ public static int compare43(int a, int b) {
+ return (a >= b) ? ((b < a) ? 1 : 0) : -1;
+ }
+
+ public static int compare44(int a, int b) {
+ return (a >= b) ? ((b != a) ? 1 : 0) : -1;
+ }
+
+ public static int compare45(int a, int b) {
+ return (a != b) ? ((b > a) ? -1 : 1) : 0;
+ }
+
+ public static int compare46(int a, int b) {
+ return (a != b) ? ((b >= a) ? -1 : 1) : 0;
+ }
+
+ public static int compare47(int a, int b) {
+ return (a != b) ? ((b < a) ? 1 : -1) : 0;
+ }
+
+ public static int compare48(int a, int b) {
+ return (a != b) ? ((b <= a) ? 1 : -1) : 0;
+ }
+
+
+ public static int compareAlwaysFalse1(int a, int b) {
+ return (a >= b) ? 1 : (a > b) ? 2 : -1;
+ }
+
+ public static int compareAlwaysFalse2(int a, int b) {
+ return (a <= b) ? 1 : (a < b) ? 2 : -1;
+ }
+
+ public static int compareAlwaysFalse3(int a, int b) {
+ return (a == b) ? 1 : (a == b) ? 2 : -1;
+ }
+
+ public static int compareAlwaysFalse4(int a, int b) {
+ return (a != b) ? 1 : (a < b) ? 2 : -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller1(int a, int b) {
+ return compare1(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller2(int a, int b) {
+ return compare1(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller3(int a, int b) {
+ return compare1(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller4(int a, int b) {
+ return compare2(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller5(int a, int b) {
+ return compare2(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller6(int a, int b) {
+ return compare2(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller7(int a, int b) {
+ return compare3(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller8(int a, int b) {
+ return compare3(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller9(int a, int b) {
+ return compare3(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller10(int a, int b) {
+ return compare4(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller11(int a, int b) {
+ return compare4(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller12(int a, int b) {
+ return compare4(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller13(int a, int b) {
+ return compare5(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller14(int a, int b) {
+ return compare5(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller15(int a, int b) {
+ return compare5(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller16(int a, int b) {
+ return compare6(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller17(int a, int b) {
+ return compare6(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller18(int a, int b) {
+ return compare6(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller19(int a, int b) {
+ return compare7(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller20(int a, int b) {
+ return compare7(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller21(int a, int b) {
+ return compare7(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller22(int a, int b) {
+ return compare8(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller23(int a, int b) {
+ return compare8(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller24(int a, int b) {
+ return compare8(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller25(int a, int b) {
+ return compare9(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller26(int a, int b) {
+ return compare9(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller27(int a, int b) {
+ return compare9(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller28(int a, int b) {
+ return compare10(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller29(int a, int b) {
+ return compare10(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller30(int a, int b) {
+ return compare10(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller31(int a, int b) {
+ return compare11(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller32(int a, int b) {
+ return compare11(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller33(int a, int b) {
+ return compare11(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller34(int a, int b) {
+ return compare12(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller35(int a, int b) {
+ return compare12(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller36(int a, int b) {
+ return compare12(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller37(int a, int b) {
+ return compare13(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller38(int a, int b) {
+ return compare13(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller39(int a, int b) {
+ return compare13(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller40(int a, int b) {
+ return compare14(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller41(int a, int b) {
+ return compare14(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller42(int a, int b) {
+ return compare14(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller43(int a, int b) {
+ return compare15(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller44(int a, int b) {
+ return compare15(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller45(int a, int b) {
+ return compare15(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller46(int a, int b) {
+ return compare16(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller47(int a, int b) {
+ return compare16(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller48(int a, int b) {
+ return compare16(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller49(int a, int b) {
+ return compare17(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller50(int a, int b) {
+ return compare17(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller51(int a, int b) {
+ return compare17(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller52(int a, int b) {
+ return compare18(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller53(int a, int b) {
+ return compare18(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller54(int a, int b) {
+ return compare18(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller55(int a, int b) {
+ return compare19(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller56(int a, int b) {
+ return compare19(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller57(int a, int b) {
+ return compare19(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller58(int a, int b) {
+ return compare20(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller59(int a, int b) {
+ return compare20(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller60(int a, int b) {
+ return compare20(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller61(int a, int b) {
+ return compare21(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller62(int a, int b) {
+ return compare21(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller63(int a, int b) {
+ return compare21(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller64(int a, int b) {
+ return compare22(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller65(int a, int b) {
+ return compare22(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller66(int a, int b) {
+ return compare22(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller67(int a, int b) {
+ return compare23(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller68(int a, int b) {
+ return compare23(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller69(int a, int b) {
+ return compare23(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller70(int a, int b) {
+ return compare24(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller71(int a, int b) {
+ return compare24(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller72(int a, int b) {
+ return compare24(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller73(int a, int b) {
+ return compare25(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller74(int a, int b) {
+ return compare25(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller75(int a, int b) {
+ return compare25(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller76(int a, int b) {
+ return compare26(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller77(int a, int b) {
+ return compare26(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller78(int a, int b) {
+ return compare26(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller79(int a, int b) {
+ return compare27(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller80(int a, int b) {
+ return compare27(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller81(int a, int b) {
+ return compare27(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller82(int a, int b) {
+ return compare28(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller83(int a, int b) {
+ return compare28(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller84(int a, int b) {
+ return compare28(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller85(int a, int b) {
+ return compare29(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller86(int a, int b) {
+ return compare29(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller87(int a, int b) {
+ return compare29(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller88(int a, int b) {
+ return compare30(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller89(int a, int b) {
+ return compare30(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller90(int a, int b) {
+ return compare30(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller91(int a, int b) {
+ return compare31(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller92(int a, int b) {
+ return compare31(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller93(int a, int b) {
+ return compare31(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller94(int a, int b) {
+ return compare32(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller95(int a, int b) {
+ return compare32(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller96(int a, int b) {
+ return compare32(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller97(int a, int b) {
+ return compare33(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller98(int a, int b) {
+ return compare33(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller99(int a, int b) {
+ return compare33(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller100(int a, int b) {
+ return compare34(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller101(int a, int b) {
+ return compare34(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller102(int a, int b) {
+ return compare34(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller103(int a, int b) {
+ return compare35(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller104(int a, int b) {
+ return compare35(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller105(int a, int b) {
+ return compare35(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller106(int a, int b) {
+ return compare36(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller107(int a, int b) {
+ return compare36(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller108(int a, int b) {
+ return compare36(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller109(int a, int b) {
+ return compare37(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller110(int a, int b) {
+ return compare37(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller111(int a, int b) {
+ return compare37(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller112(int a, int b) {
+ return compare38(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller113(int a, int b) {
+ return compare38(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller114(int a, int b) {
+ return compare38(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller115(int a, int b) {
+ return compare39(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller116(int a, int b) {
+ return compare39(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller117(int a, int b) {
+ return compare39(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller118(int a, int b) {
+ return compare40(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller119(int a, int b) {
+ return compare40(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller120(int a, int b) {
+ return compare40(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller121(int a, int b) {
+ return compare41(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller122(int a, int b) {
+ return compare41(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller123(int a, int b) {
+ return compare41(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller124(int a, int b) {
+ return compare42(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller125(int a, int b) {
+ return compare42(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller126(int a, int b) {
+ return compare42(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller127(int a, int b) {
+ return compare43(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller128(int a, int b) {
+ return compare43(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller129(int a, int b) {
+ return compare43(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller130(int a, int b) {
+ return compare44(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller131(int a, int b) {
+ return compare44(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller132(int a, int b) {
+ return compare44(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller133(int a, int b) {
+ return compare45(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller134(int a, int b) {
+ return compare45(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller135(int a, int b) {
+ return compare45(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller136(int a, int b) {
+ return compare46(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller137(int a, int b) {
+ return compare46(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller138(int a, int b) {
+ return compare46(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller139(int a, int b) {
+ return compare47(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller140(int a, int b) {
+ return compare47(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller141(int a, int b) {
+ return compare47(a, b) <= -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller142(int a, int b) {
+ return compare48(a, b) == -1;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller143(int a, int b) {
+ return compare48(a, b) < 0;
+ }
+
+ @Test(op = Operation.SMALLER)
+ public static boolean testSmaller144(int a, int b) {
+ return compare48(a, b) <= -1;
+ }
+
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual1(int a, int b) {
+ return compare1(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual2(int a, int b) {
+ return compare2(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual3(int a, int b) {
+ return compare3(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual4(int a, int b) {
+ return compare4(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual5(int a, int b) {
+ return compare5(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual6(int a, int b) {
+ return compare6(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual7(int a, int b) {
+ return compare7(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual8(int a, int b) {
+ return compare8(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual9(int a, int b) {
+ return compare9(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual10(int a, int b) {
+ return compare10(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual11(int a, int b) {
+ return compare11(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual12(int a, int b) {
+ return compare12(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual13(int a, int b) {
+ return compare13(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual14(int a, int b) {
+ return compare14(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual15(int a, int b) {
+ return compare15(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual16(int a, int b) {
+ return compare16(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual17(int a, int b) {
+ return compare17(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual18(int a, int b) {
+ return compare18(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual19(int a, int b) {
+ return compare19(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual20(int a, int b) {
+ return compare20(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual21(int a, int b) {
+ return compare21(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual22(int a, int b) {
+ return compare22(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual23(int a, int b) {
+ return compare23(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual24(int a, int b) {
+ return compare24(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual25(int a, int b) {
+ return compare2(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual26(int a, int b) {
+ return compare26(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual27(int a, int b) {
+ return compare27(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual28(int a, int b) {
+ return compare28(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual29(int a, int b) {
+ return compare29(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual30(int a, int b) {
+ return compare30(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual31(int a, int b) {
+ return compare31(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual32(int a, int b) {
+ return compare32(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual33(int a, int b) {
+ return compare33(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual34(int a, int b) {
+ return compare34(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual35(int a, int b) {
+ return compare35(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual36(int a, int b) {
+ return compare36(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual37(int a, int b) {
+ return compare37(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual38(int a, int b) {
+ return compare38(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual39(int a, int b) {
+ return compare39(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual40(int a, int b) {
+ return compare40(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual41(int a, int b) {
+ return compare41(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual42(int a, int b) {
+ return compare42(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual43(int a, int b) {
+ return compare43(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual44(int a, int b) {
+ return compare44(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual45(int a, int b) {
+ return compare45(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual46(int a, int b) {
+ return compare46(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual47(int a, int b) {
+ return compare47(a, b) <= 0;
+ }
+
+ @Test(op = Operation.SMALLER_EQUAL)
+ public static boolean testSmallerEqual48(int a, int b) {
+ return compare48(a, b) <= 0;
+ }
+
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual1(int a, int b) {
+ return compare1(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual2(int a, int b) {
+ return compare2(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual3(int a, int b) {
+ return compare3(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual4(int a, int b) {
+ return compare4(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual5(int a, int b) {
+ return compare5(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual6(int a, int b) {
+ return compare6(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual7(int a, int b) {
+ return compare7(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual8(int a, int b) {
+ return compare8(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual9(int a, int b) {
+ return compare9(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual10(int a, int b) {
+ return compare10(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual11(int a, int b) {
+ return compare11(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual12(int a, int b) {
+ return compare12(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual13(int a, int b) {
+ return compare13(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual14(int a, int b) {
+ return compare14(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual15(int a, int b) {
+ return compare15(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual16(int a, int b) {
+ return compare16(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual17(int a, int b) {
+ return compare17(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual18(int a, int b) {
+ return compare18(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual19(int a, int b) {
+ return compare19(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual20(int a, int b) {
+ return compare20(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual21(int a, int b) {
+ return compare21(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual22(int a, int b) {
+ return compare22(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual23(int a, int b) {
+ return compare23(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual24(int a, int b) {
+ return compare24(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual25(int a, int b) {
+ return compare25(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual26(int a, int b) {
+ return compare26(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual27(int a, int b) {
+ return compare27(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual28(int a, int b) {
+ return compare28(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual29(int a, int b) {
+ return compare29(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual30(int a, int b) {
+ return compare30(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual31(int a, int b) {
+ return compare31(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual32(int a, int b) {
+ return compare32(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual33(int a, int b) {
+ return compare33(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual34(int a, int b) {
+ return compare34(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual35(int a, int b) {
+ return compare35(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual36(int a, int b) {
+ return compare36(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual37(int a, int b) {
+ return compare37(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual38(int a, int b) {
+ return compare38(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual39(int a, int b) {
+ return compare39(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual40(int a, int b) {
+ return compare40(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual41(int a, int b) {
+ return compare41(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual42(int a, int b) {
+ return compare42(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual43(int a, int b) {
+ return compare43(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual44(int a, int b) {
+ return compare44(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual45(int a, int b) {
+ return compare45(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual46(int a, int b) {
+ return compare46(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual47(int a, int b) {
+ return compare47(a, b) == 0;
+ }
+
+ @Test(op = Operation.EQUAL)
+ public static boolean testEqual48(int a, int b) {
+ return compare48(a, b) == 0;
+ }
+
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual1(int a, int b) {
+ return compare1(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual2(int a, int b) {
+ return compare2(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual3(int a, int b) {
+ return compare3(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual4(int a, int b) {
+ return compare4(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual5(int a, int b) {
+ return compare5(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual6(int a, int b) {
+ return compare6(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual7(int a, int b) {
+ return compare7(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual8(int a, int b) {
+ return compare8(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual9(int a, int b) {
+ return compare9(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual10(int a, int b) {
+ return compare10(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual11(int a, int b) {
+ return compare11(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual12(int a, int b) {
+ return compare12(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual13(int a, int b) {
+ return compare13(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual14(int a, int b) {
+ return compare14(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual15(int a, int b) {
+ return compare15(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual16(int a, int b) {
+ return compare16(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual17(int a, int b) {
+ return compare17(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual18(int a, int b) {
+ return compare18(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual19(int a, int b) {
+ return compare19(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual20(int a, int b) {
+ return compare20(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual21(int a, int b) {
+ return compare21(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual22(int a, int b) {
+ return compare22(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual23(int a, int b) {
+ return compare23(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual24(int a, int b) {
+ return compare24(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual25(int a, int b) {
+ return compare25(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual26(int a, int b) {
+ return compare26(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual27(int a, int b) {
+ return compare27(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual28(int a, int b) {
+ return compare28(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual29(int a, int b) {
+ return compare29(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual30(int a, int b) {
+ return compare30(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual31(int a, int b) {
+ return compare31(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual32(int a, int b) {
+ return compare32(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual33(int a, int b) {
+ return compare33(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual34(int a, int b) {
+ return compare34(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual35(int a, int b) {
+ return compare35(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual36(int a, int b) {
+ return compare36(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual37(int a, int b) {
+ return compare37(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual38(int a, int b) {
+ return compare38(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual39(int a, int b) {
+ return compare39(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual40(int a, int b) {
+ return compare40(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual41(int a, int b) {
+ return compare41(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual42(int a, int b) {
+ return compare42(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual43(int a, int b) {
+ return compare43(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual44(int a, int b) {
+ return compare44(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual45(int a, int b) {
+ return compare45(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual46(int a, int b) {
+ return compare46(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual47(int a, int b) {
+ return compare47(a, b) >= 0;
+ }
+
+ @Test(op = Operation.GREATER_EQUAL)
+ public static boolean testGreaterEqual48(int a, int b) {
+ return compare48(a, b) >= 0;
+ }
+
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater1(int a, int b) {
+ return compare1(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater2(int a, int b) {
+ return compare1(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater3(int a, int b) {
+ return compare1(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater4(int a, int b) {
+ return compare2(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater5(int a, int b) {
+ return compare2(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater6(int a, int b) {
+ return compare2(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater7(int a, int b) {
+ return compare3(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater8(int a, int b) {
+ return compare3(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater9(int a, int b) {
+ return compare3(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater10(int a, int b) {
+ return compare4(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater11(int a, int b) {
+ return compare4(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater12(int a, int b) {
+ return compare4(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater13(int a, int b) {
+ return compare5(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater14(int a, int b) {
+ return compare5(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater15(int a, int b) {
+ return compare5(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater16(int a, int b) {
+ return compare6(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater17(int a, int b) {
+ return compare6(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater18(int a, int b) {
+ return compare6(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater19(int a, int b) {
+ return compare7(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater20(int a, int b) {
+ return compare7(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater21(int a, int b) {
+ return compare7(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater22(int a, int b) {
+ return compare8(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater23(int a, int b) {
+ return compare8(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater24(int a, int b) {
+ return compare8(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater25(int a, int b) {
+ return compare9(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater26(int a, int b) {
+ return compare9(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater27(int a, int b) {
+ return compare9(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater28(int a, int b) {
+ return compare10(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater29(int a, int b) {
+ return compare10(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater30(int a, int b) {
+ return compare10(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater31(int a, int b) {
+ return compare11(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater32(int a, int b) {
+ return compare11(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater33(int a, int b) {
+ return compare11(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater34(int a, int b) {
+ return compare12(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater35(int a, int b) {
+ return compare12(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater36(int a, int b) {
+ return compare12(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater37(int a, int b) {
+ return compare13(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater38(int a, int b) {
+ return compare13(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater39(int a, int b) {
+ return compare13(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater40(int a, int b) {
+ return compare14(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater41(int a, int b) {
+ return compare14(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater42(int a, int b) {
+ return compare14(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater43(int a, int b) {
+ return compare15(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater44(int a, int b) {
+ return compare15(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater45(int a, int b) {
+ return compare15(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater46(int a, int b) {
+ return compare16(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater47(int a, int b) {
+ return compare16(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater48(int a, int b) {
+ return compare16(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater49(int a, int b) {
+ return compare17(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater50(int a, int b) {
+ return compare17(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater51(int a, int b) {
+ return compare17(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater52(int a, int b) {
+ return compare18(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater53(int a, int b) {
+ return compare18(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater54(int a, int b) {
+ return compare18(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater55(int a, int b) {
+ return compare19(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater56(int a, int b) {
+ return compare19(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater57(int a, int b) {
+ return compare19(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater58(int a, int b) {
+ return compare20(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater59(int a, int b) {
+ return compare20(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater60(int a, int b) {
+ return compare20(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater61(int a, int b) {
+ return compare21(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater62(int a, int b) {
+ return compare21(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater63(int a, int b) {
+ return compare21(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater64(int a, int b) {
+ return compare22(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater65(int a, int b) {
+ return compare22(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater66(int a, int b) {
+ return compare22(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater67(int a, int b) {
+ return compare23(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater68(int a, int b) {
+ return compare23(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater69(int a, int b) {
+ return compare23(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater70(int a, int b) {
+ return compare24(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater71(int a, int b) {
+ return compare24(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater72(int a, int b) {
+ return compare24(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater73(int a, int b) {
+ return compare25(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater74(int a, int b) {
+ return compare25(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater75(int a, int b) {
+ return compare25(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater76(int a, int b) {
+ return compare26(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater77(int a, int b) {
+ return compare26(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater78(int a, int b) {
+ return compare26(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater79(int a, int b) {
+ return compare27(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater80(int a, int b) {
+ return compare27(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater81(int a, int b) {
+ return compare27(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater82(int a, int b) {
+ return compare28(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater83(int a, int b) {
+ return compare28(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater84(int a, int b) {
+ return compare28(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater85(int a, int b) {
+ return compare29(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater86(int a, int b) {
+ return compare29(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater87(int a, int b) {
+ return compare29(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater88(int a, int b) {
+ return compare30(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater89(int a, int b) {
+ return compare30(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater90(int a, int b) {
+ return compare30(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater91(int a, int b) {
+ return compare31(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater92(int a, int b) {
+ return compare31(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater93(int a, int b) {
+ return compare31(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater94(int a, int b) {
+ return compare32(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater95(int a, int b) {
+ return compare32(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater96(int a, int b) {
+ return compare32(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater97(int a, int b) {
+ return compare33(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater98(int a, int b) {
+ return compare33(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater99(int a, int b) {
+ return compare33(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater100(int a, int b) {
+ return compare34(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater101(int a, int b) {
+ return compare34(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater102(int a, int b) {
+ return compare34(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater103(int a, int b) {
+ return compare35(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater104(int a, int b) {
+ return compare35(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater105(int a, int b) {
+ return compare35(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater106(int a, int b) {
+ return compare36(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater107(int a, int b) {
+ return compare36(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater108(int a, int b) {
+ return compare36(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater109(int a, int b) {
+ return compare37(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater110(int a, int b) {
+ return compare37(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater111(int a, int b) {
+ return compare37(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater112(int a, int b) {
+ return compare38(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater113(int a, int b) {
+ return compare38(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater114(int a, int b) {
+ return compare38(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater115(int a, int b) {
+ return compare39(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater116(int a, int b) {
+ return compare39(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater117(int a, int b) {
+ return compare39(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater118(int a, int b) {
+ return compare40(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater119(int a, int b) {
+ return compare40(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater120(int a, int b) {
+ return compare40(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater121(int a, int b) {
+ return compare41(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater122(int a, int b) {
+ return compare41(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater123(int a, int b) {
+ return compare41(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater124(int a, int b) {
+ return compare42(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater125(int a, int b) {
+ return compare42(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater126(int a, int b) {
+ return compare42(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater127(int a, int b) {
+ return compare43(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater128(int a, int b) {
+ return compare43(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater129(int a, int b) {
+ return compare43(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater130(int a, int b) {
+ return compare44(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater131(int a, int b) {
+ return compare44(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater132(int a, int b) {
+ return compare44(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater133(int a, int b) {
+ return compare45(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater134(int a, int b) {
+ return compare45(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater135(int a, int b) {
+ return compare45(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater136(int a, int b) {
+ return compare46(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater137(int a, int b) {
+ return compare46(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater138(int a, int b) {
+ return compare46(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater139(int a, int b) {
+ return compare47(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater140(int a, int b) {
+ return compare47(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater141(int a, int b) {
+ return compare47(a, b) >= 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater142(int a, int b) {
+ return compare48(a, b) == 1;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater143(int a, int b) {
+ return compare48(a, b) > 0;
+ }
+
+ @Test(op = Operation.GREATER)
+ public static boolean testGreater144(int a, int b) {
+ return compare48(a, b) >= 1;
+ }
+
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse1(int a, int b) {
+ return compareAlwaysFalse1(a, b) == 2;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse2(int a, int b) {
+ return compareAlwaysFalse1(a, b) > 1;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse3(int a, int b) {
+ return compareAlwaysFalse1(a, b) >= 2;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse4(int a, int b) {
+ return compareAlwaysFalse2(a, b) == 2;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse5(int a, int b) {
+ return compareAlwaysFalse2(a, b) > 1;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse6(int a, int b) {
+ return compareAlwaysFalse2(a, b) >= 2;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse7(int a, int b) {
+ return compareAlwaysFalse3(a, b) == 2;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse8(int a, int b) {
+ return compareAlwaysFalse3(a, b) > 1;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse9(int a, int b) {
+ return compareAlwaysFalse3(a, b) >= 2;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse10(int a, int b) {
+ return compareAlwaysFalse4(a, b) == 2;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse11(int a, int b) {
+ return compareAlwaysFalse4(a, b) > 1;
+ }
+
+ @Test(op = Operation.ALWAYS_FALSE)
+ public static boolean testAlwaysFalse12(int a, int b) {
+ return compareAlwaysFalse4(a, b) >= 2;
+ }
+
+ public static void main(String[] args) throws Exception {
+ Random rand = Utils.getRandomInstance();
+ for (int i = 0; i < 20_000; ++i) {
+ int low = rand.nextInt();
+ int high = rand.nextInt();
+ if (low == high) {
+ --low;
+ }
+ if (low > high) {
+ int tmp = low;
+ low = high;
+ high = tmp;
+ }
+ for (Method m : TestTrichotomyExpressions.class.getMethods()) {
+ if (m.isAnnotationPresent(Test.class)) {
+ Operation op = m.getAnnotation(Test.class).op();
+ boolean result = (boolean)m.invoke(null, low, low);
+ Asserts.assertEquals(result, (op == Operation.EQUAL || op == Operation.SMALLER_EQUAL || op == Operation.GREATER_EQUAL) ? true : false, m + " failed");
+ result = (boolean)m.invoke(null, low, high);
+ Asserts.assertEquals(result, (op == Operation.SMALLER || op == Operation.SMALLER_EQUAL) ? true : false, m + " failed");
+ result = (boolean)m.invoke(null, high, low);
+ Asserts.assertEquals(result, (op == Operation.GREATER || op == Operation.GREATER_EQUAL) ? true : false, m + " failed");
+ }
+ }
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/hotspot/jtreg/gc/epsilon/TestMaxTLAB.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,50 @@
+/*
+ * Copyright (c) 2018, Red Hat, Inc. 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 TestMaxTLAB
+ * @key gc
+ * @requires vm.gc.Epsilon & !vm.graal.enabled
+ * @summary Check EpsilonMaxTLAB options
+ * @bug 8212177
+ *
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1 TestMaxTLAB
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1K TestMaxTLAB
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1M TestMaxTLAB
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=12345 TestMaxTLAB
+ *
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1 -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1K -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=1M -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB
+ * @run main/othervm -XX:+UnlockExperimentalVMOptions -Xmx128m -XX:+UseEpsilonGC -XX:EpsilonMaxTLABSize=12345 -XX:+IgnoreUnrecognizedVMOptions -XX:ObjectAlignmentInBytes=16 TestMaxTLAB
+ */
+
+public class TestMaxTLAB {
+ static Object sink;
+
+ public static void main(String[] args) throws Exception {
+ for (int c = 0; c < 1000; c++) {
+ sink = new byte[c];
+ }
+ }
+}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t006/em02t006.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -57,7 +57,7 @@
Java_nsk_jvmti_scenarios_events_EM02_em02t006_setTag(JNIEnv *env,
jobject o, jobject object, jlong tag) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, object, tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(object, tag))) {
NSK_COMPLAIN0("TEST FAILED: unable to set tag for a tested object\n");
return NSK_FALSE;
}
@@ -148,12 +148,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -173,8 +173,7 @@
if (!checkEvents(STEP_NUMBER))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -329,16 +328,13 @@
if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_OBJECT_FREE)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -431,10 +427,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -495,8 +488,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -507,7 +499,7 @@
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t007/em02t007.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -133,12 +133,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -158,8 +158,7 @@
if (!checkEvents(STEP_NUMBER))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -184,9 +183,7 @@
char *sign;
char *genc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti_env, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -197,17 +194,14 @@
changeCount(JVMTI_EVENT_SINGLE_STEP, &eventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -219,9 +213,7 @@
char *sign;
char *genc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti_env, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -232,17 +224,14 @@
changeCount(JVMTI_EVENT_SINGLE_STEP, &newEventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -368,16 +357,13 @@
if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_SINGLE_STEP)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -477,10 +463,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -541,8 +524,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -552,7 +534,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_single_step_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t008/em02t008.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -132,12 +132,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -157,8 +157,7 @@
if (!checkEvents(STEP_NUMBER))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -170,9 +169,7 @@
jvmtiThreadInfo info_ptr;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- GetThreadInfo, jvmti_env, thread, &info_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info_ptr))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -183,8 +180,7 @@
changeCount(JVMTI_EVENT_EXCEPTION, &eventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)info_ptr.name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info_ptr.name))) {
nsk_jvmti_setFailStatus();
}
}
@@ -196,9 +192,7 @@
jvmtiThreadInfo info_ptr;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- GetThreadInfo, jvmti_env, thread, &info_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info_ptr))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -209,8 +203,7 @@
changeCount(JVMTI_EVENT_EXCEPTION, &newEventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)info_ptr.name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info_ptr.name))) {
nsk_jvmti_setFailStatus();
}
}
@@ -221,9 +214,7 @@
jvmtiThreadInfo info_ptr;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- GetThreadInfo, jvmti_env, thread, &info_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info_ptr))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -234,8 +225,7 @@
changeCount(JVMTI_EVENT_EXCEPTION_CATCH, &eventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)info_ptr.name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info_ptr.name))) {
nsk_jvmti_setFailStatus();
}
}
@@ -246,9 +236,7 @@
jvmtiThreadInfo info_ptr;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- GetThreadInfo, jvmti_env, thread, &info_ptr))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info_ptr))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -259,8 +247,7 @@
changeCount(JVMTI_EVENT_EXCEPTION_CATCH, &newEventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)info_ptr.name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)info_ptr.name))) {
nsk_jvmti_setFailStatus();
}
}
@@ -390,16 +377,13 @@
&& (event != JVMTI_EVENT_EXCEPTION)
&& (event != JVMTI_EVENT_EXCEPTION_CATCH)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -493,10 +477,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -555,8 +536,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -566,7 +546,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_exception_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t009/em02t009.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -143,12 +143,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -168,8 +168,7 @@
if (!checkEvents(STEP_NUMBER))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -229,9 +228,7 @@
char *sign;
char *genc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti_env, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -240,17 +237,14 @@
changeCount(event, &eventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -276,9 +270,7 @@
char *sign;
char *genc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti_env, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -287,17 +279,14 @@
changeCount(event, &newEventCount[0]);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -395,16 +384,13 @@
&& (event != JVMTI_EVENT_METHOD_ENTRY)
&& (event != JVMTI_EVENT_METHOD_EXIT)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -498,10 +484,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -560,8 +543,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -572,7 +554,7 @@
caps.can_generate_method_entry_events = 1;
caps.can_generate_method_exit_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t010/em02t010.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -148,12 +148,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -173,8 +173,7 @@
if (!checkEvents(STEP_NUMBER))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -340,16 +339,13 @@
&& (event != JVMTI_EVENT_FIELD_MODIFICATION)
&& (event != JVMTI_EVENT_FIELD_ACCESS)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -443,10 +439,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -466,26 +459,21 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- if (!NSK_JNI_VERIFY(agentJNI, (cls =
- NSK_CPP_STUB2(FindClass, agentJNI, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(agentJNI, (cls = agentJNI->FindClass(CLASS_NAME)) != NULL))
return;
if (!NSK_JNI_VERIFY(agentJNI, (field_accID =
- NSK_CPP_STUB4(GetStaticFieldID, agentJNI, cls, FIELD_ACC_NAME,
- "I")) != NULL))
+ agentJNI->GetStaticFieldID(cls, FIELD_ACC_NAME, "I")) != NULL))
return;
if (!NSK_JNI_VERIFY(agentJNI, (field_modID =
- NSK_CPP_STUB4(GetStaticFieldID, agentJNI, cls, FIELD_MOD_NAME,
- "I")) != NULL))
+ agentJNI->GetStaticFieldID(cls, FIELD_MOD_NAME, "I")) != NULL))
return;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetFieldModificationWatch, jvmti, cls, field_modID)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetFieldModificationWatch(cls, field_modID)))
return;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetFieldAccessWatch, jvmti, cls, field_accID)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetFieldAccessWatch(cls, field_accID)))
return;
if (!nsk_jvmti_resumeSync())
@@ -536,8 +524,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -548,7 +535,7 @@
caps.can_generate_field_modification_events = 1;
caps.can_generate_field_access_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t011/em02t011.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -144,12 +144,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -169,8 +169,7 @@
if (!checkEvents(STEP_NUMBER))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -326,16 +325,13 @@
if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_BREAKPOINT)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -428,10 +424,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -451,17 +444,14 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- if (!NSK_JNI_VERIFY(agentJNI, (cls =
- NSK_CPP_STUB2(FindClass, agentJNI, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(agentJNI, (cls = agentJNI->FindClass(CLASS_NAME)) != NULL))
return;
if (!NSK_JNI_VERIFY(agentJNI, (methodID =
- NSK_CPP_STUB4(GetStaticMethodID, agentJNI, cls, METHOD_NAME,
- "()I")) != NULL))
+ agentJNI->GetStaticMethodID(cls, METHOD_NAME, "()I")) != NULL))
return;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetBreakpoint, jvmti, methodID, 0)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(methodID, 0)))
return;
if (!nsk_jvmti_resumeSync())
@@ -512,8 +502,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -523,7 +512,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_breakpoint_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM02/em02t012/em02t012.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -52,8 +52,7 @@
jobject o, jthread thrd) {
/* make thread accessable for a long time */
- NSK_JNI_VERIFY(jni_env, (testedThread =
- NSK_CPP_STUB2(NewGlobalRef, jni_env, thrd)) != NULL);
+ NSK_JNI_VERIFY(jni_env, (testedThread = jni_env->NewGlobalRef(thrd)) != NULL);
}
static void
@@ -151,12 +150,12 @@
static void
changeCount(jvmtiEvent event, int *currentCounts) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
currentCounts[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -176,8 +175,7 @@
if (!checkEvents(STEP_NUMBER))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -331,16 +329,13 @@
if (nsk_jvmti_isOptionalEvent(event)
&& (event != JVMTI_EVENT_FRAME_POP)) {
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
}
} else {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
return NSK_FALSE;
@@ -433,10 +428,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -455,18 +447,15 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, testedThread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(testedThread)))
return;
for (j = 2; j < 1002; j++) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(NotifyFramePop, jvmti, testedThread, j)))
+ if (!NSK_JVMTI_VERIFY(jvmti->NotifyFramePop(testedThread, j)))
return;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, testedThread)))
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(testedThread)))
return;
if (!nsk_jvmti_resumeSync())
@@ -489,7 +478,7 @@
return;
}
- NSK_CPP_STUB2(DeleteGlobalRef, agentJNI, testedThread);
+ agentJNI->DeleteGlobalRef(testedThread);
}
/* ============================================================================= */
@@ -516,8 +505,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -528,7 +516,7 @@
caps.can_suspend = 1;
caps.can_generate_frame_pop_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM04/em04t001/em04t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -111,9 +111,7 @@
static int
enableEvent(jvmtiEventMode enable, jvmtiEvent event) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
- event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -129,10 +127,7 @@
eventCallbacks.DynamicCodeGenerated = (stage == 1) ?
cbDynamicCodeGenerated1 : cbDynamicCodeGenerated2;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -153,9 +148,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti,
- JVMTI_EVENT_DYNAMIC_CODE_GENERATED)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_DYNAMIC_CODE_GENERATED)))
nsk_jvmti_setFailStatus();
{
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t001/em05t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -127,9 +127,7 @@
int i;
for (i = 0; i < EVENTS_COUNT; i++) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
- eventsList[i], NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, eventsList[i], NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -156,28 +154,24 @@
methodsDesc[i].unloadEvents = 0;
}
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL))
+ jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (thread = (jthread)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadFieldID)) != NULL))
+ jni->GetStaticObjectField(debugeeClass, threadFieldID)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (threadClass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Find tested methods:\n");
for (i = 0; i < METHODS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (methodsDesc[i].method =
- NSK_CPP_STUB4(GetMethodID, jni, threadClass,
- methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL))
+ jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY3(" method #%d (%s): 0x%p\n",
i, methodsDesc[i].methodName, (void*)methodsDesc[i].method);
@@ -327,8 +321,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -337,9 +330,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM05/em05t002/em05t002.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -152,8 +152,7 @@
* Generate tested events (COMPILED_METHOD_LOAD only).
*/
static int generateEvents() {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GenerateEvents, jvmti, JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -183,28 +182,24 @@
}
}
- if (!NSK_JNI_VERIFY(jni, (debugeeClass =
- NSK_CPP_STUB2(FindClass, jni, DEBUGEE_CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (debugeeClass = jni->FindClass(DEBUGEE_CLASS_NAME)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (threadFieldID =
- NSK_CPP_STUB4(GetStaticFieldID, jni, debugeeClass,
- THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL))
+ jni->GetStaticFieldID(debugeeClass, THREAD_FIELD_NAME, THREAD_FIELD_SIG)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (thread = (jthread)
- NSK_CPP_STUB3(GetStaticObjectField, jni, debugeeClass, threadFieldID)) != NULL))
+ jni->GetStaticObjectField(debugeeClass, threadFieldID)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (threadClass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (threadClass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
NSK_DISPLAY0("Find tested methods:\n");
for (i = 0; i < METHODS_COUNT; i++) {
if (!NSK_JNI_VERIFY(jni, (methodsDesc[i].method =
- NSK_CPP_STUB4(GetMethodID, jni, threadClass,
- methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL))
+ jni->GetMethodID(threadClass, methodsDesc[i].methodName, methodsDesc[i].methodSig)) != NULL))
return NSK_FALSE;
NSK_DISPLAY3(" method #%d (%s): 0x%p\n",
i, methodsDesc[i].methodName, (void*)methodsDesc[i].method);
@@ -395,8 +390,7 @@
jvmtiCapabilities caps;
memset(&caps, 0, sizeof(caps));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -405,9 +399,7 @@
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.CompiledMethodLoad = callbackCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = callbackCompiledMethodUnload;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM06/em06t001/em06t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -60,26 +60,24 @@
jstring jclassName;
const char *className;
- if (!NSK_JNI_VERIFY(jni_env, (classObject =
- NSK_CPP_STUB2(GetObjectClass, jni_env, klass)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (classObject = jni_env->GetObjectClass(klass)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
if (!NSK_JNI_VERIFY(jni_env, (methodID =
- NSK_CPP_STUB4(GetMethodID, jni_env, classObject,
- "getName", "()Ljava/lang/String;")) != NULL)) {
+ jni_env->GetMethodID(classObject, "getName", "()Ljava/lang/String;")) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
- jclassName = (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, klass, methodID);
+ jclassName = (jstring) jni_env->CallObjectMethod(klass, methodID);
- className = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jclassName, 0);
+ className = jni_env->GetStringUTFChars(jclassName, 0);
if ( className != NULL && (strcmp(className, EXPECTED_CLASS_NAME)==0) ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
switch (event) {
@@ -92,12 +90,12 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
- NSK_CPP_STUB3(ReleaseStringUTFChars, jni_env, jclassName, className);
+ jni_env->ReleaseStringUTFChars(jclassName, className);
}
JNIEXPORT void JNICALL
@@ -116,9 +114,7 @@
static int
enableEvent(jvmtiEventMode enable, jvmtiEvent event) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
- event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -171,10 +167,7 @@
eventCallbacks.ClassLoad = cbClassLoad;
eventCallbacks.ClassPrepare = cbClassPrepare;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -186,8 +179,7 @@
static void JNICALL
agentProc(jvmtiEnv* jvmti, JNIEnv* agentJNI, void* arg) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -230,8 +222,7 @@
if (!nsk_jvmti_resumeSync())
return;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t001/em07t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -64,12 +64,12 @@
void changeCount(jvmtiEvent event) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
eventCount[event - JVMTI_MIN_EVENT_TYPE_VAL]++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -87,8 +87,7 @@
cbVMDeath(jvmtiEnv* jvmti, JNIEnv* jni_env) {
changeCount(JVMTI_EVENT_VM_DEATH);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -234,8 +233,7 @@
jvmtiEvent event = (jvmtiEvent)(i + JVMTI_MIN_EVENT_TYPE_VAL);
if (nsk_jvmti_isOptionalEvent(event))
if (!NSK_JVMTI_VERIFY_CODE(JVMTI_ERROR_MUST_POSSESS_CAPABILITY,
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_ENABLE, event, NULL))) {
+ jvmti->SetEventNotificationMode(JVMTI_ENABLE, event, NULL))) {
NSK_COMPLAIN1("Unexpected error enabling %s\n",
TranslateEvent(event));
result = NSK_FALSE;
@@ -309,10 +307,7 @@
eventCallbacks.ObjectFree = cbObjectFree;
eventCallbacks.VMObjectAlloc = cbVMObjectAlloc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return NSK_FALSE;
return NSK_TRUE;
@@ -363,8 +358,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/events/EM07/em07t002/em07t002.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -63,9 +63,7 @@
char *sign;
char *genc;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB5(
- GetMethodName, jvmti_env, method, &name, &sign, &genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sign, &genc))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -86,28 +84,25 @@
NSK_DISPLAY0(">>>JVMTI_EVENT_COMPILED_METHOD_LOAD received for\n");
NSK_DISPLAY1("\t\tmethod: %s\n", rec->name);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
methodLoadCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)name))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)sign))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)sign))) {
nsk_jvmti_setFailStatus();
}
if (genc != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)genc))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)genc))) {
nsk_jvmti_setFailStatus();
}
}
@@ -127,12 +122,12 @@
NSK_DISPLAY0(">>>JVMTI_EVENT_COMPILED_METHOD_UNLOAD received for\n");
NSK_DISPLAY1("\t\tmethod: %s\n", rec->name);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(syncLock)))
nsk_jvmti_setFailStatus();
methodUnloadCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(syncLock)))
nsk_jvmti_setFailStatus();
free(rec);
@@ -148,9 +143,7 @@
static int
enableEvent(jvmtiEventMode enable, jvmtiEvent event) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti, enable,
- event, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(enable, event, NULL))) {
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
@@ -191,9 +184,7 @@
eventCallbacks.CompiledMethodLoad = cbCompiledMethodLoad;
eventCallbacks.CompiledMethodUnload = cbCompiledMethodUnload;
- return NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks,
- sizeof(eventCallbacks)));
+ return NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)));
}
/* ============================================================================= */
@@ -230,8 +221,7 @@
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(DestroyRawMonitor, jvmti, syncLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->DestroyRawMonitor(syncLock)))
nsk_jvmti_setFailStatus();
}
@@ -260,8 +250,7 @@
if (!NSK_VERIFY((jvmti = nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "_syncLock", &syncLock))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_syncLock", &syncLock))) {
nsk_jvmti_setFailStatus();
return JNI_ERR;
}
@@ -274,7 +263,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_compiled_method_load_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/extension/EX03/ex03t001/ex03t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -61,16 +61,13 @@
}
/* Notify main agent thread */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, eventMon))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventMon))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorNotify, jvmti, eventMon))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorNotify(eventMon))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, eventMon))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventMon))) {
nsk_jvmti_setFailStatus();
}
}
@@ -84,8 +81,7 @@
NSK_DISPLAY0("Get extension functions list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetExtensionFunctions, jvmti, &extCount, &extList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionFunctions(&extCount, &extList))) {
nsk_jvmti_setFailStatus();
return JNI_FALSE;
}
@@ -117,8 +113,7 @@
jboolean found = JNI_FALSE;
NSK_DISPLAY0("Get extension events list\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetExtensionEvents, jvmti, &extCount, &extList))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetExtensionEvents(&extCount, &extList))) {
nsk_jvmti_setFailStatus();
return JNI_FALSE;
}
@@ -128,8 +123,8 @@
found = JNI_TRUE;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetExtensionEventCallback, jvmti, extList[i].extension_event_index,
- enable ? (jvmtiExtensionEvent)ClassUnload : NULL ))) {
+ jvmti->SetExtensionEventCallback(extList[i].extension_event_index,
+ enable ? (jvmtiExtensionEvent)ClassUnload : NULL ))) {
nsk_jvmti_setFailStatus();
return JNI_FALSE;
}
@@ -175,16 +170,13 @@
break;
/* Wait for notifying from event's thread */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, eventMon))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventMon))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, jvmti, eventMon, timeout))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(eventMon, timeout))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, eventMon))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventMon))) {
nsk_jvmti_setFailStatus();
}
@@ -202,16 +194,13 @@
return;
/* Wait during 10 secs for notifying from event's thread */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorEnter, jvmti, eventMon))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventMon))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RawMonitorWait, jvmti, eventMon, 10000))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorWait(eventMon, 10000))) {
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(RawMonitorExit, jvmti, eventMon))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventMon))) {
nsk_jvmti_setFailStatus();
}
@@ -230,7 +219,7 @@
} while (0);
- NSK_TRACE(NSK_CPP_STUB2(DestroyRawMonitor, jvmti, eventMon));
+ NSK_TRACE(jvmti->DestroyRawMonitor(eventMon));
NSK_DISPLAY0("Let debugee to finish\n");
if (!NSK_VERIFY(nsk_jvmti_resumeSync()))
@@ -262,8 +251,7 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(CreateRawMonitor, jvmti, "eventMon", &eventMon))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventMon", &eventMon))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF01/gf01t001/gf01t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -77,8 +77,7 @@
NSK_DISPLAY1("%s: Getting system property keys ...\n",
stepMsg);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetSystemProperties,
- jvmti_env, &count, &propKeys))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetSystemProperties(&count, &propKeys))) {
result = STATUS_FAILED;
return;
}
@@ -94,8 +93,7 @@
for (i=0; i< count; i++) {
NSK_DISPLAY2("%d) getting property for the key \"%s\":\n",
i+1, propKeys[i]);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetSystemProperty,
- jvmti_env, (const char*) propKeys[i], &prop))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetSystemProperty((const char*) propKeys[i], &prop))) {
result = STATUS_FAILED;
return;
}
@@ -105,23 +103,20 @@
foundProps += findProp(propKeys[i]);
NSK_DISPLAY0("\tdeallocating system property\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) prop))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) prop))) {
result = STATUS_FAILED;
return;
}
NSK_DISPLAY0("\tdeallocating the system property key\n\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) propKeys[i]))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) propKeys[i]))) {
result = STATUS_FAILED;
return;
}
}
/* NSK_DISPLAY0("Deallocating the property key array ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) &propKeys))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) &propKeys))) {
result = STATUS_FAILED;
return;
}*/
@@ -185,17 +180,14 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
callbacks.VMInit = &VMInit;
callbacks.VMDeath = &VMDeath;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
NSK_DISPLAY0("enabling events done\n\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF04/gf04t001/gf04t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -52,8 +52,7 @@
void* storage = NULL;
NSK_DISPLAY1("Add segment: %s\n", segment);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddToBootstrapClassLoaderSearch, jvmti, segment))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddToBootstrapClassLoaderSearch(segment))) {
return NSK_FALSE;
}
NSK_DISPLAY0(" ... added\n");
@@ -62,17 +61,13 @@
}
static void setupLock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to enter a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorEnter(countLock)))
+ jni_env->FatalError("failed to enter a raw monitor\n");
}
static void setoffLock(jvmtiEnv *jvmti_env, JNIEnv *jni_env) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti_env, countLock)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "failed to exit a raw monitor\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RawMonitorExit(countLock)))
+ jni_env->FatalError("failed to exit a raw monitor\n");
}
JNIEXPORT jint JNICALL
@@ -93,8 +88,7 @@
setupLock(jvmti_env, env);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &sig, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) {
result = STATUS_FAILED;
}
@@ -103,8 +97,7 @@
sig);
classLoadReceived = JNI_TRUE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) {
result = STATUS_FAILED;
} else {
NSK_DISPLAY0("ClassLoad event disabled\n");
@@ -121,8 +114,7 @@
setupLock(jvmti_env, env);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &sig, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &sig, &generic))) {
result = STATUS_FAILED;
}
@@ -131,8 +123,7 @@
sig);
classPrepareReceived = JNI_TRUE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) {
result = STATUS_FAILED;
} else {
NSK_DISPLAY0("ClassPrepare event disabled\n");
@@ -172,8 +163,7 @@
nsk_jvmti_createJVMTIEnv(jvm, reserved)) != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti, "eventLock", &countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("eventLock", &countLock)))
return JNI_ERR;
NSK_DISPLAY0("Add bootstrap class load segment in Agent_OnLoad()\n");
@@ -189,22 +179,19 @@
memset(&callbacks, 0, sizeof(callbacks));
callbacks.ClassLoad = &ClassLoad;
callbacks.ClassPrepare = &ClassPrepare;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti, &callbacks, size))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, size))) {
return JNI_ERR;
}
}
NSK_DISPLAY0(" ... set\n");
NSK_DISPLAY0("Enabling events: \n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_LOAD, NULL))) {
return JNI_ERR;
} else {
NSK_DISPLAY0(" ... ClassLoad enabled\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_PREPARE, NULL))) {
return JNI_ERR;
} else {
NSK_DISPLAY0(" ... ClassPrepare enabled\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF06/gf06t001/gf06t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -75,8 +75,7 @@
void* storage = NULL;
NSK_DISPLAY0("Calling GetEnvironmentLocalStorage():");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(GetEnvironmentLocalStorage, jvmti, &storage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetEnvironmentLocalStorage(&storage))) {
return NSK_FALSE;
}
NSK_DISPLAY1(" ... got storage: 0x%p\n", (void*)storage);
@@ -115,9 +114,9 @@
jmethodID cid;
jthread res;
- thrClass = NSK_CPP_STUB2(FindClass, env, "java/lang/Thread");
- cid = NSK_CPP_STUB4(GetMethodID, env, thrClass, "<init>", "()V");
- res = NSK_CPP_STUB3(NewObject, env, thrClass, cid);
+ thrClass = env->FindClass("java/lang/Thread");
+ cid = env->GetMethodID(thrClass, "<init>", "()V");
+ res = env->NewObject(thrClass, cid);
return res;
}
@@ -193,8 +192,7 @@
}
NSK_DISPLAY1("Set local storage in JVM_OnLoad() for first JVMTI env: 0x%p\n", (void*)initialStorage);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SetEnvironmentLocalStorage, jvmti_1, initialStorage))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_1->SetEnvironmentLocalStorage(initialStorage))) {
return JNI_ERR;
}
NSK_DISPLAY0(" ... ok\n");
@@ -212,8 +210,7 @@
eventCallbacks.VMInit = callbackVMInit;
eventCallbacks.VMDeath = callbackVMDeath;
if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti_2,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ jvmti_2->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t001/gf08t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -70,8 +70,7 @@
setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL);
if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_GC, JNI_TRUE))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_GC, JNI_TRUE))) {
return JNI_ERR;
} else {
NSK_DISPLAY0("JVMTI_VERBOSE_GC mode has been set.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t002/gf08t002.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -70,8 +70,7 @@
setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL);
if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_CLASS, JNI_TRUE))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_CLASS, JNI_TRUE))) {
return JNI_ERR;
} else {
NSK_DISPLAY0("JVMTI_VERBOSE_CLASS mode has been set.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/general_functions/GF08/gf08t003/gf08t003.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -70,8 +70,7 @@
setVerboseMode = nsk_jvmti_findOptionStringValue("setVerboseMode", NULL);
if (strcmp(setVerboseMode, "y") == 0 || strcmp(setVerboseMode, "yes") == 0) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetVerboseFlag, jvmti, JVMTI_VERBOSE_JNI, JNI_TRUE))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetVerboseFlag(JVMTI_VERBOSE_JNI, JNI_TRUE))) {
return JNI_ERR;
} else {
NSK_DISPLAY0("JVMTI_VERBOSE_JNI mode has been set.\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS103/hs103t002/hs103t002.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -57,19 +57,15 @@
testClass = jni->FindClass(MAIN_CLASS);
if (!NSK_JNI_VERIFY(jni, (
- setRedefinitionFailed = NSK_CPP_STUB4(GetStaticMethodID, jni,
- testClass, "setRedefinitionFailed", "()V")) != NULL))
+ setRedefinitionFailed = jni->GetStaticMethodID(testClass, "setRedefinitionFailed", "()V")) != NULL))
{
- NSK_CPP_STUB2(FatalError, jni,
- "TEST FAILED: while getting setRedefinitionFailed()\n");
+ jni->FatalError("TEST FAILED: while getting setRedefinitionFailed()\n");
}
if (!NSK_JNI_VERIFY(jni, (
- setRedefinitionDone = NSK_CPP_STUB4(GetStaticMethodID, jni,
- testClass, "setRedefinitionDone", "()V")) != NULL))
+ setRedefinitionDone = jni->GetStaticMethodID(testClass, "setRedefinitionDone", "()V")) != NULL))
{
- NSK_CPP_STUB2(FatalError, jni,
- "TEST FAILED: while getting setRedefinitionDone()\n");
+ jni->FatalError("TEST FAILED: while getting setRedefinitionDone()\n");
}
nsk_printf("doRedefineInNativeThread\n");
@@ -82,20 +78,16 @@
} else {
nsk_printf("\nMyClass :: Failed to redefine ..\n");
- if (!NSK_JNI_VERIFY_VOID(jni, NSK_CPP_STUB3(CallStaticVoidMethod, jni,
- testClass, setRedefinitionFailed)))
+ if (!NSK_JNI_VERIFY_VOID(jni, jni->CallStaticVoidMethod(testClass, setRedefinitionFailed)))
{
- NSK_CPP_STUB2(FatalError, jni,
- "TEST FAILED: while calling setRedefinitionFailed()\n");
+ jni->FatalError("TEST FAILED: while calling setRedefinitionFailed()\n");
}
}
}
- if (!NSK_JNI_VERIFY_VOID(jni, NSK_CPP_STUB3(CallStaticVoidMethod, jni,
- testClass, setRedefinitionDone)))
+ if (!NSK_JNI_VERIFY_VOID(jni, jni->CallStaticVoidMethod(testClass, setRedefinitionDone)))
{
- NSK_CPP_STUB2(FatalError, jni,
- "TEST FAILED: while calling setRedefinitionDone()\n");
+ jni->FatalError("TEST FAILED: while calling setRedefinitionDone()\n");
}
nsk_printf(" All 30 redefinitions are done..\n");
@@ -150,10 +142,8 @@
name = jni->NewStringUTF(threadName);
clas = jni->FindClass("java/lang/Thread");
- if (!NSK_JNI_VERIFY(jni, (method = NSK_CPP_STUB4(GetMethodID,
- jni, clas, "<init>","(Ljava/lang/String;)V")) != NULL)) {
- NSK_CPP_STUB2(FatalError, jni,
- "failed to get ID for the java method\n");
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(clas, "<init>", "(Ljava/lang/String;)V")) != NULL)) {
+ jni->FatalError("failed to get ID for the java method\n");
}
thread = (jthread) jni->NewObject(clas,method,name);
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS104/hs104t002/hs104t002.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -49,8 +49,7 @@
}
#endif
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved){
- if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm,
- (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+ if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
nsk_printf("#error Agent :: Could not load JVMTI interface.\n");
return JNI_ERR;
} else {
@@ -61,8 +60,7 @@
}
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti,
- &caps) )) {
+ if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) )) {
nsk_printf("#error Agent :: occured while adding capabilities.\n");
return JNI_ERR;
}
@@ -76,8 +74,7 @@
jclass cla;
char fileName[512];
- if ( ! NSK_JNI_VERIFY(jni, ( cla = NSK_CPP_STUB2(FindClass,
- jni, SEARCH_NAME) ) != NULL ) ) {
+ if ( ! NSK_JNI_VERIFY(jni, ( cla = jni->FindClass(SEARCH_NAME) ) != NULL ) ) {
nsk_printf(" Agent :: Failed to get class.\n");
nsk_jvmti_agentFailed();
return;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t001/hs201t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -64,15 +64,12 @@
jfieldID fld;
if (!NSK_JNI_VERIFY(jni_env, (fld =
- NSK_CPP_STUB4(GetStaticFieldID, jni_env, testClass, "currentStep", "I")) != NULL)) {
- NSK_CPP_STUB2(FatalError, jni_env,
- "TEST FAILED: while getting currentStep fieldID\n");
+ jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != NULL)) {
+ jni_env->FatalError("TEST FAILED: while getting currentStep fieldID\n");
}
- if (!NSK_JNI_VERIFY_VOID(jni_env,
- NSK_CPP_STUB4(SetStaticIntField, jni_env, testClass, fld, value))) {
- NSK_CPP_STUB2(FatalError, jni_env,
- "TEST FAILED: while setting value of currentStep fieldID\n");
+ if (!NSK_JNI_VERIFY_VOID(jni_env, jni_env->SetStaticIntField(testClass, fld, value))) {
+ jni_env->FatalError("TEST FAILED: while setting value of currentStep fieldID\n");
}
}
@@ -81,9 +78,7 @@
void enableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti_env, JVMTI_ENABLE,
- event, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, event, thread))) {
NSK_COMPLAIN1("TEST FAILED: enabling %s\n", TranslateEvent(event));
nsk_jvmti_setFailStatus();
}
@@ -93,9 +88,7 @@
void disableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti_env, JVMTI_DISABLE,
- event, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, event, thread))) {
NSK_COMPLAIN1("TEST FAILED: disabling %s\n", TranslateEvent(event));
nsk_jvmti_setFailStatus();
}
@@ -109,9 +102,7 @@
char *className;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass,
- &className, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -127,15 +118,13 @@
classDef.class_bytes = newClassBytes;
NSK_DISPLAY1("\tredefining class %s\n", className);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti_env, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RedefineClasses(1, &classDef))) {
NSK_COMPLAIN1("TEST FAILED: while redefining class %s\n", className);
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
@@ -163,8 +152,8 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testClass));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+ NSK_TRACE(jni->DeleteGlobalRef(testClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedThread));
NSK_DISPLAY0("Let debuggee to finish\n");
if (!nsk_jvmti_resumeSync())
@@ -176,15 +165,11 @@
void setBreakPoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jclass klass) {
jmethodID mid;
- if (!NSK_JNI_VERIFY(jni_env, (mid = NSK_CPP_STUB4(GetMethodID,
- jni_env, klass, METHOD_NAME, METHOD_SIG)) != NULL))
- NSK_CPP_STUB2(FatalError, jni_env,
- "[agent] failed to get ID for the java method\n");
+ if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != NULL))
+ jni_env->FatalError("[agent] failed to get ID for the java method\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint,
- jvmti_env, mid, 1)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "[agent] failed to set breakpoint\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 1)))
+ jni_env->FatalError("[agent] failed to set breakpoint\n");
}
/* ============================================================================= */
@@ -200,9 +185,7 @@
char *className;
char *generic;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass,
- &className, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -215,14 +198,12 @@
setBreakPoint(jvmti_env, jni_env, klass);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (generic != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
}
@@ -253,8 +234,7 @@
char *methodName;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &methodName, NULL, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) {
NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
}
@@ -262,13 +242,11 @@
char *declaringClassName;
jclass declaringClass;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
- jvmti_env, method, &declaringClass))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &declaringClass))) {
NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, declaringClass, &declaringClassName, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, NULL))) {
NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
}
@@ -292,8 +270,7 @@
NSK_DISPLAY1("\n\n>>>> Checking if redefined method is obsolete\n", testStep);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(IsMethodObsolete, jvmti, method, &is_obsolete))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IsMethodObsolete(method, &is_obsolete))) {
NSK_COMPLAIN0("TEST FAILED: unable to check method to be obsolete\n");
nsk_jvmti_setFailStatus();
return;
@@ -326,15 +303,13 @@
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) declaringClassName))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) declaringClassName))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methodName))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methodName))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
}
@@ -362,8 +337,7 @@
className, getThreadName(jni_env, thread));
testStep++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -394,8 +368,7 @@
className, getThreadName(jni_env, thread));
testStep++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -435,8 +408,7 @@
newClassSize = ftell(bytecode);
rewind(bytecode);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti,
- newClassSize, &newClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(newClassSize, &newClassBytes))) {
NSK_COMPLAIN0("buffer couldn't be allocated\n");
return NSK_FALSE;
}
@@ -460,27 +432,24 @@
strcpy(chbuffer, "");
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, thread)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) {
nsk_jvmti_setFailStatus();
return chbuffer;
}
if (!NSK_JNI_VERIFY(jni_env, (methodID =
- NSK_CPP_STUB4(GetMethodID, jni_env, klass,
- "getName", "()Ljava/lang/String;")) != NULL)) {
+ jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != NULL)) {
nsk_jvmti_setFailStatus();
return chbuffer;
}
- jthreadName = (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, thread,
- methodID);
+ jthreadName = (jstring) jni_env->CallObjectMethod(thread, methodID);
- threadName = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jthreadName, 0);
+ threadName = jni_env->GetStringUTFChars(jthreadName, 0);
strcpy(chbuffer, threadName);
- NSK_CPP_STUB3(ReleaseStringUTFChars, jni_env, jthreadName, threadName);
+ jni_env->ReleaseStringUTFChars(jthreadName, threadName);
return chbuffer;
}
@@ -495,29 +464,24 @@
strcpy(chbuffer, "");
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, object)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != NULL)) {
nsk_jvmti_setFailStatus();
return chbuffer;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass,
- &className, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) {
nsk_jvmti_setFailStatus();
return chbuffer;
}
strcpy(chbuffer, className);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (generic != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
@@ -535,8 +499,7 @@
jint value = -1;
/* getting local variable table*/
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetLocalVariableTable,
- jvmti_env, method, &entryCount, &table))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetLocalVariableTable(method, &entryCount, &table))) {
NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n");
}
@@ -545,8 +508,7 @@
for (i = 0; i < entryCount; i++) {
if (strcmp(table[i].name, LOCAL_VARIABLE_NAME) == 0) {
- error = NSK_CPP_STUB5(GetLocalInt, jvmti_env, thread, 0,
- table[i].slot, &value);
+ error = jvmti_env->GetLocalInt(thread, 0, table[i].slot, &value);
if (!NSK_VERIFY(error == JVMTI_ERROR_NONE
|| error == JVMTI_ERROR_INVALID_SLOT))
NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n");
@@ -555,20 +517,17 @@
for (i = 0; i < entryCount; i++) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)table[i].name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table[i].name))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)table[i].signature))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table[i].signature))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)table))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to local variable table\n\n");
}
@@ -583,12 +542,10 @@
Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t001_setThread(JNIEnv *env,
jclass cls, jthread thread) {
- if (!NSK_JNI_VERIFY(env, (testClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, env, cls)) != NULL))
+ if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != NULL))
nsk_jvmti_setFailStatus();
- if (!NSK_JNI_VERIFY(env, (testedThread =
- NSK_CPP_STUB2(NewGlobalRef, env, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL))
nsk_jvmti_setFailStatus();
}
@@ -602,8 +559,7 @@
NSK_DISPLAY0("\tresuming thread...\n");
disableEvent(jvmti, JVMTI_EVENT_SINGLE_STEP, thread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to resume the thread\n");
nsk_jvmti_setFailStatus();
return JNI_FALSE;
@@ -621,8 +577,7 @@
NSK_DISPLAY0("\tsuspending thread...\n");
disableEvent(jvmti, JVMTI_EVENT_SINGLE_STEP, thread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to suspend the thread\n");
nsk_jvmti_setFailStatus();
return JNI_FALSE;
@@ -638,16 +593,14 @@
jclass cls, jthread thread) {
NSK_DISPLAY0("\tpopping frame...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(PopFrame, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to pop the currently executed frame\n");
nsk_jvmti_setFailStatus();
return JNI_FALSE;
}
NSK_DISPLAY0("\tresuming thread...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to resume the thread\n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
@@ -696,8 +649,7 @@
caps.can_pop_frame = 1;
caps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -709,9 +661,7 @@
eventCallbacks.ExceptionCatch = callbackExceptionCatch;
eventCallbacks.Breakpoint = callbackBreakpoint;
eventCallbacks.SingleStep = callbackSingleStep;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t002/hs201t002.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -64,15 +64,12 @@
jfieldID fld;
if (!NSK_JNI_VERIFY(jni_env, (fld =
- NSK_CPP_STUB4(GetStaticFieldID, jni_env, testClass, "currentStep", "I")) != NULL)) {
- NSK_CPP_STUB2(FatalError, jni_env,
- "TEST FAILED: while getting currentStep fieldID\n");
+ jni_env->GetStaticFieldID(testClass, "currentStep", "I")) != NULL)) {
+ jni_env->FatalError("TEST FAILED: while getting currentStep fieldID\n");
}
- if (!NSK_JNI_VERIFY_VOID(jni_env,
- NSK_CPP_STUB4(SetStaticIntField, jni_env, testClass, fld, value))) {
- NSK_CPP_STUB2(FatalError, jni_env,
- "TEST FAILED: while setting value of currentStep fieldID\n");
+ if (!NSK_JNI_VERIFY_VOID(jni_env, jni_env->SetStaticIntField(testClass, fld, value))) {
+ jni_env->FatalError("TEST FAILED: while setting value of currentStep fieldID\n");
}
}
@@ -81,9 +78,7 @@
void enableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti_env, JVMTI_ENABLE,
- event, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_ENABLE, event, thread))) {
NSK_COMPLAIN1("TEST FAILED: enabling %s\n", TranslateEvent(event));
nsk_jvmti_setFailStatus();
}
@@ -93,9 +88,7 @@
void disableEvent(jvmtiEnv *jvmti_env, jvmtiEvent event, jthread thread) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(SetEventNotificationMode, jvmti_env, JVMTI_DISABLE,
- event, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, event, thread))) {
NSK_COMPLAIN1("TEST FAILED: disabling %s\n", TranslateEvent(event));
nsk_jvmti_setFailStatus();
}
@@ -109,9 +102,7 @@
char *className;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass,
- &className, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -127,15 +118,13 @@
classDef.class_bytes = newClassBytes;
NSK_DISPLAY1("\tredefining class %s\n", className);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(RedefineClasses, jvmti_env, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->RedefineClasses(1, &classDef))) {
NSK_COMPLAIN1("TEST FAILED: while redefining class %s\n", className);
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
@@ -163,8 +152,8 @@
if (!nsk_jvmti_waitForSync(timeout))
return;
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testClass));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedThread));
+ NSK_TRACE(jni->DeleteGlobalRef(testClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedThread));
NSK_DISPLAY0("Let debuggee to finish\n");
if (!nsk_jvmti_resumeSync())
@@ -176,15 +165,11 @@
void setBreakPoint(jvmtiEnv *jvmti_env, JNIEnv *jni_env, jclass klass) {
jmethodID mid;
- if (!NSK_JNI_VERIFY(jni_env, (mid = NSK_CPP_STUB4(GetMethodID,
- jni_env, klass, METHOD_NAME, METHOD_SIG)) != NULL))
- NSK_CPP_STUB2(FatalError, jni_env,
- "[agent] failed to get ID for the java method\n");
+ if (!NSK_JNI_VERIFY(jni_env, (mid = jni_env->GetMethodID(klass, METHOD_NAME, METHOD_SIG)) != NULL))
+ jni_env->FatalError("[agent] failed to get ID for the java method\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint,
- jvmti_env, mid, 1)))
- NSK_CPP_STUB2(FatalError, jni_env,
- "[agent] failed to set breakpoint\n");
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetBreakpoint(mid, 1)))
+ jni_env->FatalError("[agent] failed to set breakpoint\n");
}
/* ============================================================================= */
@@ -200,9 +185,7 @@
char *className;
char *generic;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass,
- &className, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -215,14 +198,12 @@
setBreakPoint(jvmti_env, jni_env, klass);
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (generic != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
}
@@ -253,8 +234,7 @@
char *methodName;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &methodName, NULL, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &methodName, NULL, NULL))) {
NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
}
@@ -262,13 +242,11 @@
char *declaringClassName;
jclass declaringClass;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
- jvmti_env, method, &declaringClass))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(method, &declaringClass))) {
NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, declaringClass, &declaringClassName, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(declaringClass, &declaringClassName, NULL))) {
NSK_COMPLAIN0("TEST FAILED: unable to get method name during Breakpoint callback\n\n");
}
@@ -292,8 +270,7 @@
NSK_DISPLAY1("\n\n>>>> Checking if redefined method is not obsolete\n", testStep);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(IsMethodObsolete, jvmti, method, &is_obsolete))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IsMethodObsolete(method, &is_obsolete))) {
NSK_COMPLAIN0("TEST FAILED: unable to check method to be obsolete\n");
nsk_jvmti_setFailStatus();
return;
@@ -326,15 +303,13 @@
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) declaringClassName))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) declaringClassName))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methodName))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methodName))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
}
@@ -362,8 +337,7 @@
className, getThreadName(jni_env, thread));
testStep++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -394,8 +368,7 @@
className, getThreadName(jni_env, thread));
testStep++;
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, exception)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(exception)) != NULL)) {
nsk_jvmti_setFailStatus();
return;
}
@@ -435,8 +408,7 @@
newClassSize = ftell(bytecode);
rewind(bytecode);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate, jvmti,
- newClassSize, &newClassBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->Allocate(newClassSize, &newClassBytes))) {
NSK_COMPLAIN0("buffer couldn't be allocated\n");
return NSK_FALSE;
}
@@ -460,27 +432,24 @@
strcpy(chbuffer, "");
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, thread)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(thread)) != NULL)) {
nsk_jvmti_setFailStatus();
return chbuffer;
}
if (!NSK_JNI_VERIFY(jni_env, (methodID =
- NSK_CPP_STUB4(GetMethodID, jni_env, klass,
- "getName", "()Ljava/lang/String;")) != NULL)) {
+ jni_env->GetMethodID(klass, "getName", "()Ljava/lang/String;")) != NULL)) {
nsk_jvmti_setFailStatus();
return chbuffer;
}
- jthreadName = (jstring) NSK_CPP_STUB3(CallObjectMethod, jni_env, thread,
- methodID);
+ jthreadName = (jstring) jni_env->CallObjectMethod(thread, methodID);
- threadName = NSK_CPP_STUB3(GetStringUTFChars, jni_env, jthreadName, 0);
+ threadName = jni_env->GetStringUTFChars(jthreadName, 0);
strcpy(chbuffer, threadName);
- NSK_CPP_STUB3(ReleaseStringUTFChars, jni_env, jthreadName, threadName);
+ jni_env->ReleaseStringUTFChars(jthreadName, threadName);
return chbuffer;
}
@@ -495,29 +464,24 @@
strcpy(chbuffer, "");
- if (!NSK_JNI_VERIFY(jni_env, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni_env, object)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni_env, (klass = jni_env->GetObjectClass(object)) != NULL)) {
nsk_jvmti_setFailStatus();
return chbuffer;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(GetClassSignature, jvmti_env, klass,
- &className, &generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic))) {
nsk_jvmti_setFailStatus();
return chbuffer;
}
strcpy(chbuffer, className);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)className))) {
nsk_jvmti_setFailStatus();
}
if (generic != NULL)
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)generic))) {
nsk_jvmti_setFailStatus();
}
@@ -535,8 +499,7 @@
jint value = -1;
/* getting local variable table*/
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetLocalVariableTable,
- jvmti_env, method, &entryCount, &table))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetLocalVariableTable(method, &entryCount, &table))) {
NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n");
}
@@ -545,8 +508,7 @@
for (i = 0; i < entryCount; i++) {
if (strcmp(table[i].name, LOCAL_VARIABLE_NAME) == 0) {
- error = NSK_CPP_STUB5(GetLocalInt, jvmti_env, thread, 0,
- table[i].slot, &value);
+ error = jvmti_env->GetLocalInt(thread, 0, table[i].slot, &value);
if (!NSK_VERIFY(error == JVMTI_ERROR_NONE
|| error == JVMTI_ERROR_INVALID_SLOT))
NSK_COMPLAIN0("TEST FAILED: unable to get local variable table\n\n");
@@ -555,20 +517,17 @@
for (i = 0; i < entryCount; i++) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)table[i].name))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table[i].name))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method name\n\n");
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)table[i].signature))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table[i].signature))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to method signature\n\n");
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*)table))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*)table))) {
NSK_COMPLAIN0("TEST FAILED: unable to deallocate memory pointed to local variable table\n\n");
}
@@ -583,12 +542,10 @@
Java_nsk_jvmti_scenarios_hotswap_HS201_hs201t002_setThread(JNIEnv *env,
jclass cls, jthread thread) {
- if (!NSK_JNI_VERIFY(env, (testClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, env, cls)) != NULL))
+ if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(cls)) != NULL))
nsk_jvmti_setFailStatus();
- if (!NSK_JNI_VERIFY(env, (testedThread =
- NSK_CPP_STUB2(NewGlobalRef, env, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL))
nsk_jvmti_setFailStatus();
}
@@ -602,8 +559,7 @@
NSK_DISPLAY0("\tresuming thread...\n");
disableEvent(jvmti, JVMTI_EVENT_SINGLE_STEP, thread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to resume the thread\n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
@@ -621,8 +577,7 @@
NSK_DISPLAY0("\tsuspending thread...\n");
disableEvent(jvmti, JVMTI_EVENT_SINGLE_STEP, thread);
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(SuspendThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to suspend the thread\n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
@@ -638,16 +593,14 @@
jclass cls, jthread thread) {
NSK_DISPLAY0("\tpopping frame...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(PopFrame, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to pop the currently executed frame\n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
}
NSK_DISPLAY0("\tresuming thread...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(ResumeThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to resume the thread\n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
@@ -696,8 +649,7 @@
caps.can_pop_frame = 1;
caps.can_suspend = 1;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
}
@@ -709,9 +661,7 @@
eventCallbacks.ExceptionCatch = callbackExceptionCatch;
eventCallbacks.Breakpoint = callbackBreakpoint;
eventCallbacks.SingleStep = callbackSingleStep;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks))))
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS201/hs201t003/hs201t003.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -63,9 +63,9 @@
(JNIEnv *jni_env, jclass cls, jbyteArray classBytes) {
jboolean isCopy;
- bytesCount = NSK_CPP_STUB2(GetArrayLength, jni_env, classBytes);
+ bytesCount = jni_env->GetArrayLength(classBytes);
clsBytes =
- NSK_CPP_STUB3(GetByteArrayElements, jni_env, classBytes, &isCopy);
+ jni_env->GetByteArrayElements(classBytes, &isCopy);
}
static int expectedMeth(jvmtiEnv *jvmti_env, const char *event,
@@ -74,8 +74,7 @@
char *sig;
int methFound = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &sig, NULL))) {
nsk_jvmti_setFailStatus();
return 0;
}
@@ -90,11 +89,9 @@
else
methFound = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) name)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) name)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) sig)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) sig)))
nsk_jvmti_setFailStatus();
return methFound;
@@ -106,13 +103,11 @@
char *cls_sig;
jvmtiClassDefinition classDef;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetMethodDeclaringClass,
- jvmti_env, tMethodID, &decl_cls))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodDeclaringClass(tMethodID, &decl_cls))) {
nsk_jvmti_setFailStatus();
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, decl_cls, &cls_sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(decl_cls, &cls_sig, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -120,8 +115,7 @@
NSK_DISPLAY2("[%s] tested method class signature: \"%s\"\n\n",
event, cls_sig);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) cls_sig)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) cls_sig)))
nsk_jvmti_setFailStatus();
/* fill the structure jvmtiClassDefinition */
@@ -133,8 +127,7 @@
"[%s] >>>>> Invoke RedefineClasses():\n"
"\tnew class byte count=%d\n",
event, classDef.class_byte_count);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses,
- jvmti, 1, &classDef))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &classDef))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -150,16 +143,14 @@
jint methBytesCount; /* number of bytes of a method */
unsigned char *methBytes; /* bytes defining a method */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, tMethodID, &name, &sig, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(tMethodID, &name, &sig, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
NSK_DISPLAY4("[%s] method ID=0x%p name=\"%s\" signature=\"%s\"\n",
event, (void*) tMethodID, name, sig);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetBytecodes,
- jvmti_env, tMethodID, &methBytesCount, &methBytes))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetBytecodes(tMethodID, &methBytesCount, &methBytes))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -167,12 +158,10 @@
"[%s] method bytes count=%d\n"
"\tbytes count of the redefined method=%d\n",
event, methBytesCount, redefMethBytesCount);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) methBytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) methBytes)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(IsMethodObsolete,
- jvmti_env, tMethodID, &isObsolete))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->IsMethodObsolete(tMethodID, &isObsolete))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -197,20 +186,17 @@
if (expectedMeth(jvmti_env, "MethodEntry",
method, expHSMethod, expHSSignature)==1) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetBytecodes,
- jvmti_env, method, &redefMethBytesCount, &redefMethBytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetBytecodes(method, &redefMethBytesCount, &redefMethBytes)))
nsk_jvmti_setFailStatus();
else {
NSK_DISPLAY2("[MethodEntry] thread=0x%p method bytes count=%d\n",
thr, redefMethBytesCount);
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(NotifyFramePop,
- jvmti_env, thr, 0)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thr, 0)))
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL)))
nsk_jvmti_setFailStatus();
}
}
@@ -277,8 +263,7 @@
return;
/* deallocating used memory */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate,
- jvmti_env, (unsigned char*) redefMethBytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char*) redefMethBytes)))
nsk_jvmti_setFailStatus();
NSK_DISPLAY0("agentProc: final resuming of the debuggee ...\n\n");
@@ -324,8 +309,7 @@
caps.can_generate_method_exit_events = 1;
caps.can_generate_frame_pop_events = 1;
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
/* set event callback */
@@ -335,8 +319,7 @@
callbacks.MethodEntry = &MethodEntry;
callbacks.MethodExit = &MethodExit;
callbacks.FramePop = &FramePop;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &callbacks, sizeof(callbacks))))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("setting event callbacks done\nenabling events ...\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t003/hs203t003.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -60,20 +60,17 @@
redefineNumber=0;
className=NULL;
generic=NULL;
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &className, &generic) ) ) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti_env->GetClassSignature(klass, &className, &generic) ) ) {
nsk_printf("#error Agent :: while getting classname Signature.\n");
nsk_jvmti_agentFailed();
} else {
if (strcmp(className,CLASS_NAME) == 0) {
jfieldID field;
/* get the field id and set watch on that .*/
- if (! NSK_JNI_VERIFY(jni, (field = NSK_CPP_STUB4(GetFieldID,
- jni, klass, FIELDNAME, TYPE)) != NULL) ) {
+ if (! NSK_JNI_VERIFY(jni, (field = jni->GetFieldID(klass, FIELDNAME, TYPE)) != NULL) ) {
nsk_printf(" Agent :: (*JNI)->GetFieldID(jni, ... ) returns `null`.\n");
nsk_jvmti_agentFailed();
- } else if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetFieldAccessWatch,
- jvmti_env, klass, field) ) ) {
+ } else if ( ! NSK_JVMTI_VERIFY(jvmti_env->SetFieldAccessWatch(klass, field) ) ) {
nsk_printf("#error Agent :: occured while jvmti->SetFieldAccessWatch(... ) .\n");
nsk_jvmti_agentFailed();
}
@@ -96,7 +93,7 @@
return;
}
redefineNumber=0;
- if (! NSK_JNI_VERIFY(jni, (clas = NSK_CPP_STUB2(FindClass, jni, SEARCH_NAME)) != NULL) ) {
+ if (! NSK_JNI_VERIFY(jni, (clas = jni->FindClass(SEARCH_NAME)) != NULL) ) {
nsk_printf(" Agent :: (*JNI)->FindClass(jni, %s) returns `null`.\n",SEARCH_NAME);
nsk_jvmti_agentFailed();
} else {
@@ -109,7 +106,7 @@
nsk_printf(" Agent :: Redefined.\n");
nsk_printf(" Agent :: Suspendeding thread.\n");
/* pop the current working frame. */
- if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti_env, thread) ) ) {
+ if ( ! NSK_JVMTI_VERIFY(jvmti_env->SuspendThread(thread) ) ) {
nsk_printf("#error Agent :: occured suspending Thread.\n");
nsk_jvmti_agentFailed();
} else {
@@ -131,8 +128,7 @@
}
#endif
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
- if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm,
- (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+ if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
nsk_printf(" Agent :: Could not load JVMTI interface.\n");
return JNI_ERR;
} else {
@@ -148,16 +144,14 @@
caps.can_pop_frame=1;
caps.can_generate_all_class_hook_events=1;
caps.can_generate_field_access_events=1;
- if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) {
+ if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) ) ) {
nsk_printf("#error Agent :: while adding capabilities.\n");
return JNI_ERR;
}
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ClassPrepare =callbackClassPrepare;
eventCallbacks.FieldAccess= callbackFieldAccess;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
nsk_printf("#error Agent :: while setting event callbacks.\n");
return JNI_ERR;
}
@@ -181,7 +175,7 @@
jboolean retvalue;
jint state;
retvalue = JNI_FALSE;
- if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadState, jvmti, thread, &state) ) ) {
+ if ( ! NSK_JVMTI_VERIFY( jvmti->GetThreadState(thread, &state) ) ) {
nsk_printf(" Agent :: Error while getting thread state.\n");
nsk_jvmti_agentFailed();
} else {
@@ -199,18 +193,18 @@
jboolean retvalue;
jint state;
retvalue = JNI_FALSE;
- if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadState, jvmti, thread, &state) ) ) {
+ if ( ! NSK_JVMTI_VERIFY( jvmti->GetThreadState(thread, &state) ) ) {
nsk_printf(" Agent :: Error while getting thread state.\n");
nsk_jvmti_agentFailed();
} else {
if ( state & JVMTI_THREAD_STATE_SUSPENDED) {
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2( PopFrame, jvmti, thread) ) ) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti->PopFrame(thread) ) ) {
nsk_printf("#error Agent :: while poping thread's frame.\n");
nsk_jvmti_agentFailed();
} else {
nsk_printf(" Agent :: poped thread frame.\n");
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB4 (SetEventNotificationMode, jvmti,
- JVMTI_DISABLE, JVMTI_EVENT_FIELD_ACCESS, NULL) ) ) {
+ if ( ! NSK_JVMTI_VERIFY (
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FIELD_ACCESS, NULL) ) ) {
nsk_printf("#error Agent :: failed to disable notification JVMTI_EVENT_FIELD ACCESS.\n");
nsk_jvmti_agentFailed();
} else {
@@ -232,7 +226,7 @@
jthread thread) {
jboolean retvalue;
retvalue = JNI_FALSE;
- if ( !NSK_JVMTI_VERIFY( NSK_CPP_STUB2 ( ResumeThread, jvmti, thread)) ) {
+ if ( !NSK_JVMTI_VERIFY( jvmti->ResumeThread(thread) ) ) {
nsk_printf("#error Agent :: while resuming thread.\n");
nsk_jvmti_agentFailed();
} else {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS203/hs203t004/hs203t004.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -45,23 +45,21 @@
char * className;
className=NULL;
- if (!NSK_JVMTI_VERIFY (NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &className, NULL) ) ) {
+ if (!NSK_JVMTI_VERIFY (jvmti_env->GetClassSignature(klass, &className, NULL) ) ) {
NSK_COMPLAIN0("#error Agent :: while getting classname.\n");
nsk_jvmti_agentFailed();
} else {
if (strcmp(className, CLASS_NAME) == 0) {
- if (nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) == NSK_TRUE ) {
+ if (nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) == NSK_TRUE) {
NSK_DISPLAY0(" Agent :: notification enabled for COMPILED_METHOD_LOAD.\n");
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(GenerateEvents, jvmti_env,
- JVMTI_EVENT_COMPILED_METHOD_LOAD ) )) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti_env->GenerateEvents(JVMTI_EVENT_COMPILED_METHOD_LOAD) ) ) {
NSK_COMPLAIN0("#error Agent :: occured while enabling compiled method events.\n");
nsk_jvmti_agentFailed();
}
}
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) {
NSK_COMPLAIN1("#error Agent :: failed to Deallocate className = %s.", className);
nsk_jvmti_agentFailed();
}
@@ -78,8 +76,7 @@
const void* compile_info) {
jclass threadClass;
if (redefineNumber == 0) {
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB3(GetMethodDeclaringClass,
- jvmti_env, method, &threadClass) ) ) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti_env->GetMethodDeclaringClass(method, &threadClass) ) ) {
NSK_COMPLAIN0("#error Agent :: while geting the declaring class.\n");
nsk_jvmti_agentFailed();
} else {
@@ -89,15 +86,13 @@
className = NULL;
methodName = NULL;
- if ( ! NSK_JVMTI_VERIFY (NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, threadClass, &className, NULL) ) ) {
+ if ( ! NSK_JVMTI_VERIFY (jvmti_env->GetClassSignature(threadClass, &className, NULL) ) ) {
NSK_COMPLAIN0("#error Agent :: while getting classname.\n");
nsk_jvmti_agentFailed();
return;
}
- if ( ! NSK_JVMTI_VERIFY (NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &methodName, NULL, NULL) ) ) {
+ if ( ! NSK_JVMTI_VERIFY (jvmti_env->GetMethodName(method, &methodName, NULL, NULL) ) ) {
NSK_COMPLAIN0("#error Agent :: while getting methodname.\n");
nsk_jvmti_agentFailed();
return;
@@ -121,13 +116,13 @@
}
if ( className != NULL ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) {
NSK_COMPLAIN1("#error Agent :: failed to Deallocate className = %s.", className);
nsk_jvmti_agentFailed();
}
}
if ( methodName != NULL ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)methodName))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)methodName))) {
NSK_COMPLAIN1("#error Agent :: failed to Deallocate methodName = %s.", methodName);
nsk_jvmti_agentFailed();
}
@@ -149,8 +144,7 @@
#endif
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
redefineNumber=0;
- if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm,
- (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+ if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
NSK_DISPLAY0("#error Agent :: Could not load JVMTI interface.\n");
return JNI_ERR;
} else {
@@ -166,16 +160,14 @@
caps.can_pop_frame = 1;
caps.can_generate_all_class_hook_events = 1;
caps.can_generate_compiled_method_load_events = 1;
- if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) {
+ if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) ) ) {
NSK_DISPLAY0("#error Agent :: occured while adding capabilities.\n");
return JNI_ERR;
}
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ClassPrepare =callbackClassPrepare;
eventCallbacks.CompiledMethodLoad=callbackCompiledMethodLoad;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
NSK_COMPLAIN0("#error Agent :: occured while setting event callback.\n");
return JNI_ERR;
}
@@ -194,7 +186,7 @@
jobject clas,
jthread thread) {
NSK_DISPLAY0(" Agent :: Suspending Thread.\n");
- if ( NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti, thread) ) ) {
+ if ( NSK_JVMTI_VERIFY( jvmti->SuspendThread(thread) ) ) {
NSK_DISPLAY0(" Agent :: Succeded in suspending.\n");
} else {
NSK_COMPLAIN0("#error Agent :: occured while suspending thread.\n");
@@ -211,18 +203,18 @@
NSK_DISPLAY0(" Agent :: nsk.jvmti.scenarios.hotswap.HS203.hs203t004.popThreadFrame(... ).\n");
retvalue = JNI_FALSE;
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB3(GetThreadState, jvmti,
- thread, &state) ) ) {
+ if ( ! NSK_JVMTI_VERIFY (jvmti->GetThreadState(thread, &state) ) ) {
NSK_COMPLAIN0("#error Agent :: while getting thread's state.\n");
nsk_jvmti_agentFailed();
} else {
if ( state & JVMTI_THREAD_STATE_SUSPENDED) {
- if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB2(PopFrame, jvmti, thread) ) ){
+ if ( ! NSK_JVMTI_VERIFY( jvmti->PopFrame(thread) ) ) {
NSK_DISPLAY0("#error Agent :: occured while poping thread's frame.\n");
nsk_jvmti_agentFailed();
} else {
- if ( NSK_JVMTI_VERIFY( NSK_CPP_STUB4(SetEventNotificationMode, jvmti,
- JVMTI_DISABLE, JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) ) ) {
+ if ( NSK_JVMTI_VERIFY(
+ jvmti->SetEventNotificationMode(JVMTI_DISABLE,
+ JVMTI_EVENT_COMPILED_METHOD_LOAD, NULL) ) ) {
NSK_DISPLAY0(" Agent :: Disabled JVMTI_EVENT_COMPILED_METHOD_LOAD.\n");
retvalue = JNI_TRUE;
} else {
@@ -245,7 +237,7 @@
jboolean retvalue;
retvalue = JNI_FALSE;
- if ( NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(ResumeThread, jvmti, thread))) {
+ if ( NSK_JVMTI_VERIFY (jvmti->ResumeThread(thread))) {
NSK_DISPLAY0(" Agent :: Thread resumed.\n");
retvalue= JNI_TRUE;
} else {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t001/hs204t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -51,7 +51,7 @@
char *getClassName(jvmtiEnv *jvmti, jclass klass) {
char * className;
char * generic;
- if( !NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti, klass, &className, &generic))) {
+ if( !NSK_JVMTI_VERIFY(jvmti->GetClassSignature(klass, &className, &generic))) {
nsk_jvmti_setFailStatus();
}
return className;
@@ -75,7 +75,7 @@
} else {
NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n");
}
- /* if( (myTestClass =NSK_CPP_STUB2(NewGlobalRef,jni_env, klass)) == NULL) {
+ /* if ( (myTestClass = jni_env->NewGlobalRef(klass) ) == NULL) {
NSK_COMPLAIN0("Failed to create global ref...");
}
*/
@@ -100,7 +100,7 @@
} else {
NSK_COMPLAIN0("\nMyClass :: Failed to redefine ..\n");
}
- if( (myTestClass = (jclass) NSK_CPP_STUB2(NewGlobalRef,jni_env, klass)) == NULL) {
+ if( (myTestClass = (jclass) jni_env->NewGlobalRef(klass)) == NULL) {
NSK_COMPLAIN0("Failed to create global ref...");
}
}
@@ -240,9 +240,9 @@
jclass klass,
jobject thread) {
NSK_DISPLAY0(" Inside the setThread Method");
- if (!NSK_JNI_VERIFY(env, (testClass =(jclass) NSK_CPP_STUB2(NewGlobalRef, env, klass)) != NULL))
+ if (!NSK_JNI_VERIFY(env, (testClass = (jclass) env->NewGlobalRef(klass)) != NULL))
nsk_jvmti_setFailStatus();
- if (!NSK_JNI_VERIFY(env, (testedThread =NSK_CPP_STUB2(NewGlobalRef, env, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(env, (testedThread = env->NewGlobalRef(thread)) != NULL))
nsk_jvmti_setFailStatus();
}
@@ -252,12 +252,12 @@
jobject thread) {
jint state;
NSK_DISPLAY0("---suspend thread .. \n");
- if (NSK_CPP_STUB3(GetThreadState,jvmti,thread, &state) == JVMTI_ERROR_NONE) {
+ if (jvmti->GetThreadState(thread, &state) == JVMTI_ERROR_NONE) {
NSK_DISPLAY0(" No Errors in finding state of the thread.\n");
if (state & JVMTI_THREAD_STATE_ALIVE) {
NSK_DISPLAY0(" Thread state is alive .. So can be suspend should be possible ..\n");
nsk_jvmti_disableNotification(jvmti, JVMTI_EVENT_SINGLE_STEP, thread);
- if (!NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SuspendThread(thread))) {
NSK_COMPLAIN0("TEST FAILED: unable to suspend the thread \n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
@@ -278,11 +278,11 @@
jthread thread) {
jint state;
NSK_DISPLAY0("Inside pop_Frame method.....\n");
- if (NSK_CPP_STUB3(GetThreadState,jvmti,thread, &state) == JVMTI_ERROR_NONE) {
+ if (jvmti->GetThreadState(thread, &state) == JVMTI_ERROR_NONE) {
NSK_DISPLAY0(" Got the state of thread \n");
if ( state & JVMTI_THREAD_STATE_SUSPENDED) {
NSK_DISPLAY0(" Thread is already in suspended mode..\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(PopFrame, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->PopFrame(thread))) {
NSK_COMPLAIN0(" TEST FAILED: UNABLE TO POP FRAME \n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
@@ -290,7 +290,7 @@
NSK_DISPLAY0(" Poped frame safely..");
}
/* We should resume that thread for next execution.. */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(ResumeThread, jvmti, thread))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->ResumeThread(thread))) {
NSK_COMPLAIN0(" TEST FAILED: UNABLE TO Resume thread \n");
nsk_jvmti_setFailStatus();
return NSK_FALSE;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS204/hs204t003/hs204t003.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -51,27 +51,24 @@
className = NULL;
generic = NULL;
redefineNumber=0;
- if ( !NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- klass, &className, &generic)) ) {
+ if ( !NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic)) ) {
NSK_DISPLAY0(" Agent :: Failed get class signature.\n");
nsk_jvmti_agentFailed();
} else {
if( (strcmp(className, CLASS_NAME) == 0 ) ) {
jfieldID fieldId;
- if ( ! NSK_JNI_VERIFY(jni, (fieldId = NSK_CPP_STUB4(GetStaticFieldID,
- jni, klass, FIELDNAME, TYPE) ) != NULL ) ) {
+ if ( ! NSK_JNI_VERIFY(jni, (fieldId = jni->GetStaticFieldID(klass, FIELDNAME, TYPE) ) != NULL ) ) {
NSK_DISPLAY0(" Agent :: Failed to get FieldId.\n");
nsk_jvmti_agentFailed();
} else {
- if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(SetFieldAccessWatch,
- jvmti_env, klass, fieldId) ) ) {
+ if ( ! NSK_JVMTI_VERIFY(jvmti_env->SetFieldAccessWatch(klass, fieldId) ) ) {
NSK_DISPLAY0(" Agent :: Failed to set watch point on a field.\n");
nsk_jvmti_agentFailed();
} else {
nsk_jvmti_enableNotification(jvmti_env, JVMTI_EVENT_FIELD_ACCESS, NULL);
if (! NSK_JNI_VERIFY(jni,
( watchFieldClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, klass) )
+ jni->NewGlobalRef(klass) )
!= NULL ) ) {
NSK_DISPLAY0(" Agent :: Failed to get global reference for class.\n");
nsk_jvmti_agentFailed();
@@ -84,14 +81,14 @@
}
if ( className != NULL ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) {
NSK_DISPLAY1(" Agent :: #error failed to Deallocate className = %s.", className);
nsk_jvmti_agentFailed();
}
}
if ( generic != NULL ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)generic))) {
NSK_DISPLAY1(" Agent :: #error failed to Deallocate class signature = %s.", generic);
nsk_jvmti_agentFailed();
}
@@ -116,8 +113,7 @@
if (redefineNumber != 0 ) {
return;
}
- if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB4(GetClassSignature, jvmti_env,
- field_klass, &className, &generic)) ) {
+ if ( ! NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(field_klass, &className, &generic)) ) {
NSK_DISPLAY0(" Agent :: Failed get class signature.\n");
nsk_jvmti_agentFailed();
} else {
@@ -133,13 +129,13 @@
nsk_jvmti_agentFailed();
}
NSK_DISPLAY0(" Agent :: Before attempting thread suspend.\n");
- if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadInfo, jvmti_env, thread , &info)) ) {
+ if ( ! NSK_JVMTI_VERIFY(jvmti_env->GetThreadInfo(thread, &info))) {
NSK_DISPLAY0(" Agent :: error getting thread info ");
nsk_jvmti_agentFailed();
} else {
NSK_DISPLAY1(" Agent :: Thread Name = %s .\n", info.name);
}
- if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB2(SuspendThread, jvmti_env, thread)) ) {
+ if ( ! NSK_JVMTI_VERIFY(jvmti_env->SuspendThread(thread))) {
NSK_DISPLAY0(" Agent :: Failed to suspend thread.\n");
nsk_jvmti_agentFailed();
}
@@ -147,14 +143,14 @@
}
if ( className != NULL ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)className))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)className))) {
NSK_DISPLAY1(" Agent :: #error failed to Deallocate className = %s.", className);
nsk_jvmti_agentFailed();
}
}
if ( generic != NULL ) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char *)generic))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Deallocate((unsigned char *)generic))) {
NSK_DISPLAY1(" Agent :: #error failed to Deallocate class signature = %s.", generic);
nsk_jvmti_agentFailed();
}
@@ -173,8 +169,7 @@
}
#endif
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
- if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm,
- (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+ if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
NSK_DISPLAY0("Agent :: Could not load JVMTI interface \n");
return JNI_ERR;
} else {
@@ -189,15 +184,14 @@
caps.can_generate_field_access_events = 1;
caps.can_pop_frame = 1;
caps.can_suspend = 1;
- if ( ! NSK_JVMTI_VERIFY(NSK_CPP_STUB2( AddCapabilities, jvmti, &caps)) ) {
+ if ( ! NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)) ) {
NSK_DISPLAY0(" Agent :: Failed add required capabilities\n.");
return JNI_ERR;
}
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ClassPrepare = callbackClassPrepare;
eventCallbacks.FieldAccess = callbackFieldAccess;
- if (!NSK_JVMTI_VERIFY( NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks) ) ) ) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks) ) ) ) {
NSK_DISPLAY0(" Agent :: Error occured while setting event call back \n");
return JNI_ERR;
}
@@ -213,28 +207,26 @@
jboolean retvalue;
jint state;
retvalue = JNI_FALSE;
- if (! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(GetThreadState, jvmti, thread, &state)) ){
+ if (! NSK_JVMTI_VERIFY(jvmti->GetThreadState(thread, &state))) {
NSK_DISPLAY0(" Agent :: Error getting thread state.\n");
nsk_jvmti_agentFailed();
} else {
if ( state & JVMTI_THREAD_STATE_SUSPENDED) {
NSK_DISPLAY0(" Agent :: Thread state = JVMTI_THREAD_STATE_SUSPENDED.\n");
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(PopFrame, jvmti, thread) ) ) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti->PopFrame(thread) ) ) {
NSK_DISPLAY0("#error Agent :: Jvmti failed to do popFrame.\n");
nsk_jvmti_agentFailed();
} else {
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(ResumeThread, jvmti, thread)) ) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti->ResumeThread(thread) ) ) {
NSK_DISPLAY0(" Agent :: Error occured in resuming a thread.\n");
nsk_jvmti_agentFailed();
} else {
- jfieldID fieldId;
- if ( ! NSK_JNI_VERIFY(jni, (fieldId = NSK_CPP_STUB4(GetStaticFieldID,
- jni, watchFieldClass, FIELDNAME, TYPE) ) != NULL ) ) {
+ jfieldID fieldId = jni->GetStaticFieldID(watchFieldClass, FIELDNAME, TYPE);
+ if ( ! NSK_JNI_VERIFY(jni, fieldId != NULL ) ) {
NSK_DISPLAY0(" Agent :: Failed to get FieldId before droping watchers.\n");
nsk_jvmti_agentFailed();
} else {
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB3(ClearFieldAccessWatch,
- jvmti, watchFieldClass, fieldId)) ) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti->ClearFieldAccessWatch(watchFieldClass, fieldId) ) ) {
NSK_DISPLAY0(" Agent :: failed to drop field watces.\n");
nsk_jvmti_agentFailed();
} else {
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t001/hs301t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -49,8 +49,7 @@
#endif
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
nsk_printf("Agent:: Agent_OnLoad .\n");
- if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm,
- (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+ if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
nsk_printf("Agent:: Could not load JVMTI interface.\n");
return JNI_ERR;
} else {
@@ -62,14 +61,12 @@
}
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) {
+ if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) )) {
nsk_printf(" Agent:: Error occured while adding capabilities.\n");
return JNI_ERR;
}
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
nsk_printf(" Agent:: Error occured while setting event call back.\n");
return JNI_ERR;
}
@@ -86,8 +83,8 @@
redefineNumber=0;
- //cls= NSK_CPP_STUB2(FindClass, jni, SEARCH_NAME);
- if (! NSK_JNI_VERIFY(jni, (cls = NSK_CPP_STUB2(FindClass, jni, SEARCH_NAME)) != NULL) ) {
+ cls = jni->FindClass(SEARCH_NAME);
+ if (! NSK_JNI_VERIFY(jni, cls != NULL) ) {
nsk_printf("Agent:: (*JNI)->FindClass(jni, %s) returns `null`.\n",SEARCH_NAME);
return NSK_FALSE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t002/hs301t002.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -52,8 +52,7 @@
#endif
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
nsk_printf(" Agent:: VM Started.\n");
- if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm,
- (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+ if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
nsk_printf(" Agent ::Agent failed to get jvmti env.\n");
return JNI_ERR;
} else {
@@ -64,7 +63,7 @@
}
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) ) ) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) ) ) {
nsk_printf(" Agent:: Error occured while adding capabilities.\n");
return JNI_ERR;
}
@@ -85,7 +84,7 @@
redefineNumber=0;
ret = JNI_FALSE;
- if (!NSK_JNI_VERIFY(jni, (cls = NSK_CPP_STUB2(FindClass, jni, SEARCH_NAME)) != NULL)) {
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(SEARCH_NAME)) != NULL)) {
nsk_printf("Agent:: (*JNI)->FindClass(jni, %s) returns `null`.\n", SEARCH_NAME);
return NSK_FALSE;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t003/hs301t003.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -36,8 +36,7 @@
jclass klass) {
char * className;
char * generic;
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &className, &generic) ) ) {
+ if ( ! NSK_JVMTI_VERIFY ( jvmti_env->GetClassSignature(klass, &className, &generic) ) ) {
nsk_printf(" Agent:: Error while getting ClassFileName Signature ");
} else {
if (strcmp(className, CLASS_NAME ) == 0) {
@@ -70,8 +69,7 @@
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
jvmtiEnv * jvmti;
nsk_printf("Agent:: Agent_OnLoad.\n");
- if ( ! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv, vm,
- (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+ if ( ! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
nsk_printf("Agent:: Could not load JVMTI interface.\n");
return JNI_ERR;
} else {
@@ -84,15 +82,13 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
caps.can_generate_all_class_hook_events=1;
- if (! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities, jvmti, &caps) )) {
+ if (! NSK_JVMTI_VERIFY ( jvmti->AddCapabilities(&caps) ) ) {
nsk_printf(" Agent:: Error occured while adding capabilities.\n");
return JNI_ERR;
}
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ClassPrepare = &callbackClassPrepare;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(SetEventCallbacks, jvmti,
- &eventCallbacks, sizeof(eventCallbacks)))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)))) {
nsk_printf(" Agent:: Error occured while setting event call back.\n");
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/hotswap/HS301/hs301t004/hs301t004.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -37,8 +37,7 @@
char * className;
char * generic;
int redefineNumber=0;
- if (! NSK_JVMTI_VERIFY( NSK_CPP_STUB4(GetClassSignature,
- jvmti_env, klass, &className, &generic)) ) {
+ if (! NSK_JVMTI_VERIFY(jvmti_env->GetClassSignature(klass, &className, &generic)) ) {
nsk_printf(" Agent :: Error occured in getting class signature.\n");
return;
} else {
@@ -71,8 +70,7 @@
jint Agent_Initialize(JavaVM *vm, char *options, void *reserved) {
jvmtiEnv * jvmti;
nsk_printf("Agent:: VM Started.\n");
- if (! NSK_VERIFY ( JNI_OK == NSK_CPP_STUB3(GetEnv,
- vm, (void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
+ if (! NSK_VERIFY ( JNI_OK == vm->GetEnv((void **)&jvmti, JVMTI_VERSION_1_1) ) ) {
nsk_printf("Agent:: Could not load JVMTI interface \n");
return JNI_ERR;
} else {
@@ -85,15 +83,13 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
caps.can_generate_all_class_hook_events=1;
- if ( ! NSK_JVMTI_VERIFY ( NSK_CPP_STUB2(AddCapabilities,
- jvmti, &caps) )) {
+ if ( ! NSK_JVMTI_VERIFY (jvmti->AddCapabilities(&caps) )) {
nsk_printf(" Agent:: Error occured while adding capabilities.\n");
return JNI_ERR;
}
memset(&eventCallbacks, 0, sizeof(eventCallbacks));
eventCallbacks.ClassPrepare = &callbackClassPrepare;
- if ( ! NSK_JVMTI_VERIFY( NSK_CPP_STUB3(SetEventCallbacks,
- jvmti, &eventCallbacks, sizeof(eventCallbacks)) ) ) {
+ if ( ! NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&eventCallbacks, sizeof(eventCallbacks)) ) ) {
nsk_printf(" Agent:: Error occured while setting event call back \n");
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI01/ji01t001/ji01t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -70,14 +70,7 @@
static jvmtiPhase getVMPhase(jvmtiEnv *jvmti) {
jvmtiPhase phase;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- GetPhase
- , jvmti
- , &phase
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->GetPhase(&phase)))
exit(NSK_STATUS_FAILED);
return phase;
@@ -89,14 +82,8 @@
NSK_DISPLAY0("doRedirect: obtaining the JNI function table ...\n");
// Store original function table
- if (!NSK_VERIFY(
- (err = NSK_CPP_STUB2(
- GetJNIFunctionTable
- , jvmti
- , &orig_jni_functions
- )) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE
- )
- )
+ err = jvmti->GetJNIFunctionTable(&orig_jni_functions);
+ if (!NSK_VERIFY((err == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE)))
{
NSK_COMPLAIN2("TEST FAILED: failed to get original JNI function table during %s: %s\n"
, TranslatePhase(phase)
@@ -116,13 +103,7 @@
// Get a duplicate of the function table for future modification
if (!NSK_VERIFY(
- (err = NSK_CPP_STUB2(
- GetJNIFunctionTable
- , jvmti
- , &redir_jni_functions
- )) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE
- )
- )
+ (err = jvmti->GetJNIFunctionTable(&redir_jni_functions)) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE))
{
NSK_COMPLAIN2("TEST FAILED: failed to get JNI function table for interception during %s: %s\n"
, TranslatePhase(phase)
@@ -148,13 +129,7 @@
// Set new JNI function table
if (!NSK_VERIFY(
- (err = NSK_CPP_STUB2(
- SetJNIFunctionTable
- , jvmti
- , redir_jni_functions
- )) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE
- )
- )
+ (err = jvmti->SetJNIFunctionTable(redir_jni_functions)) == JVMTI_ERROR_NONE || phase != JVMTI_PHASE_LIVE))
{
NSK_COMPLAIN2("TEST FAILED: failed to set redirected JNI function table during %s: %s\n"
, TranslatePhase(phase)
@@ -178,14 +153,7 @@
NSK_DISPLAY0("doRestore: restoring the original JNI function table ...\n");
// Set new JNI function table
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- SetJNIFunctionTable
- , jvmti
- , orig_jni_functions
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetJNIFunctionTable(orig_jni_functions)))
{
NSK_COMPLAIN0("TEST FAILED: failed to restore original JNI function table\n");
@@ -198,14 +166,7 @@
/* ====================================================================== */
static void lock(jvmtiEnv *jvmti) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- RawMonitorEnter
- , jvmti
- , eventLock
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(eventLock)))
{
result = NSK_STATUS_FAILED;
exit(NSK_STATUS_FAILED);
@@ -214,14 +175,7 @@
/* ====================================================================== */
static void unlock(jvmtiEnv *jvmti) {
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(
- RawMonitorExit
- , jvmti
- , eventLock
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(eventLock)))
{
result = NSK_STATUS_FAILED;
exit(NSK_STATUS_FAILED);
@@ -239,15 +193,11 @@
jclass cls;
NSK_TRACE(
- (cls = NSK_CPP_STUB2(
- FindClass
- , env
- , classSig
- ))
+ (cls = env->FindClass(classSig))
);
NSK_TRACE(
- NSK_CPP_STUB1(ExceptionClear, env)
+ env->ExceptionClear()
);
// The check should pass if the actual number of invocations is not less that the expected number (fnd_calls >= exFndCalls).
@@ -329,15 +279,7 @@
(void) memset(&callbacks, 0, sizeof(callbacks));
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetEventCallbacks
- , jvmti
- , &callbacks
- , sizeof(callbacks)
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
result = NSK_STATUS_FAILED;
NSK_TRACE(unlock(jvmti));
@@ -373,28 +315,11 @@
return JNI_ERR;
- if (!NSK_VERIFY(
- NSK_CPP_STUB3(
- GetEnv
- , jvm
- , (void **) &jvmti
- , JVMTI_VERSION_1_1
- ) == JNI_OK
- && jvmti != NULL
- )
- )
+ if (!NSK_VERIFY(jvm->GetEnv((void **) &jvmti, JVMTI_VERSION_1_1) == JNI_OK && jvmti != NULL))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- CreateRawMonitor
- , jvmti
- , "_event_lock"
- , &eventLock
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_event_lock", &eventLock)))
return JNI_ERR;
NSK_DISPLAY1("a) Trying to intercept JNI functions during %s phase ...\n"
@@ -409,43 +334,17 @@
callbacks.VMInit = &VMInit;
callbacks.VMDeath = &VMDeath;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(
- SetEventCallbacks
- , jvmti
- , &callbacks
- , sizeof(callbacks)
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventCallbacks(&callbacks, sizeof(callbacks))))
return JNI_ERR;
NSK_DISPLAY0("Event callbacks are set\nEnabling events...\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- SetEventNotificationMode
- , jvmti
- , JVMTI_ENABLE
- , JVMTI_EVENT_VM_INIT
- , NULL
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB4(
- SetEventNotificationMode
- , jvmti
- , JVMTI_ENABLE
- , JVMTI_EVENT_VM_DEATH
- , NULL
- )
- )
- )
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
NSK_DISPLAY0("Events are enabled\n");
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/jni_interception/JI06/ji06t001/ji06t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -81,14 +81,12 @@
static volatile int monent_calls = 0;
static void lock() {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorEnter,
- jvmti, countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorEnter(countLock)))
exit(STATUS_FAILED);
}
static void unlock() {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(RawMonitorExit,
- jvmti, countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RawMonitorExit(countLock)))
exit(STATUS_FAILED);
}
@@ -482,8 +480,7 @@
vm = jvm;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(CreateRawMonitor,
- jvmti, "_counter_lock", &countLock)))
+ if (!NSK_JVMTI_VERIFY(jvmti->CreateRawMonitor("_counter_lock", &countLock)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -114,12 +114,10 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA02/ma02t001/ma02t001a.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -114,12 +114,10 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA03/ma03t001/ma03t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -126,16 +126,13 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_INIT, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_THREAD_START, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -53,22 +53,18 @@
NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n");
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls,
- FIELD_NAME, FIELD_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fid)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -91,7 +87,7 @@
}
NSK_DISPLAY0("Testcase #1: check that testedObject is not tagged \n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -101,8 +97,7 @@
jlong_to_string(tag, buffer));
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject,
- SAMPLE_TAG))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -112,7 +107,7 @@
return;
NSK_DISPLAY0("Testcase #2: check that testedObject is tagged correctly\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -133,7 +128,7 @@
return;
NSK_DISPLAY0("Testcase #3: check that testedObject is tagged correctly\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -148,7 +143,7 @@
}
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, (jlong)0))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, (jlong)0))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -158,7 +153,7 @@
return;
NSK_DISPLAY0("Testcase #4: check that testedObject is not tagged \n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -174,7 +169,7 @@
return;
NSK_DISPLAY0("Testcase #5: check that testedObject is not tagged\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -184,7 +179,7 @@
jlong_to_string(tag, buffer));
nsk_jvmti_setFailStatus();
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+ NSK_TRACE(jni->DeleteGlobalRef(testedObject));
if (!nsk_jvmti_resumeSync())
return;
@@ -222,7 +217,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t001/ma04t001a.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -53,22 +53,18 @@
NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n");
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls,
- FIELD_NAME, FIELD_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fid)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -91,7 +87,7 @@
}
NSK_DISPLAY0("Testcase #1: check that testedObject is not tagged\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -107,7 +103,7 @@
return;
NSK_DISPLAY0("Testcase #2: check that testedObject is not tagged\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -117,8 +113,7 @@
jlong_to_string(tag, buffer));
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject,
- SAMPLE_TAG))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -128,7 +123,7 @@
return;
NSK_DISPLAY0("Testcase #3: check that testedObject is tagged correctly\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -149,7 +144,7 @@
return;
NSK_DISPLAY0("Testcase #4: check that testedObject is tagged correctly\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -164,7 +159,7 @@
}
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject, (jlong)0))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, (jlong)0))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -174,7 +169,7 @@
return;
NSK_DISPLAY0("Testcase #5: check that testedObject is not tagged\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(GetTag, jvmti, testedObject, &tag))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->GetTag(testedObject, &tag))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -184,7 +179,7 @@
jlong_to_string(tag, buffer));
nsk_jvmti_setFailStatus();
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+ NSK_TRACE(jni->DeleteGlobalRef(testedObject));
if (!nsk_jvmti_resumeSync())
return;
@@ -222,7 +217,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -81,33 +81,28 @@
NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n");
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (testedClass =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass,
- FIELD_NAME, FIELD_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, testedClass, fid)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find class instance: %s:%s\n",
INSTANCE_NAME, INSTANCE_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass,
- INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (testedInstance =
- NSK_CPP_STUB3(GetStaticObjectField, jni, testedClass, fid)) != NULL))
+ jni->GetStaticObjectField(testedClass, fid)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -131,8 +126,7 @@
NSK_DISPLAY0("Testcase #1: check that there are no tagged objects\n");
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -144,8 +138,7 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -157,8 +150,10 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heap_object_callback,
+ &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -170,8 +165,10 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_TAGGED,
+ heap_object_callback,
+ &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -182,8 +179,7 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject,
- SAMPLE_TAG))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -197,8 +193,8 @@
NSK_DISPLAY0("Testcase #2: check that there is only one object tagged\n");
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -209,8 +205,8 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(
+ jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -221,8 +217,7 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -233,8 +228,7 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedInstance,
- SAMPLE_TAG))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedInstance, SAMPLE_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -248,8 +242,10 @@
NSK_DISPLAY0("Testcase #3: check that there is only one class object tagged\n");
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heap_object_callback,
+ &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -261,8 +257,10 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heap_object_callback,
+ &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -274,8 +272,7 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -287,7 +284,7 @@
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
if (!nsk_jvmti_resumeSync())
return;
@@ -326,7 +323,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
@@ -337,8 +334,7 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t002/ma04t002a.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -81,33 +81,28 @@
NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n");
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (testedClass =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass,
- FIELD_NAME, FIELD_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(testedClass, FIELD_NAME, FIELD_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, testedClass, fid)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(testedClass, fid)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find class instance: %s:%s\n",
INSTANCE_NAME, INSTANCE_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, testedClass,
- INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(testedClass, INSTANCE_NAME, INSTANCE_SIGNATURE)) != NULL))
return NSK_FALSE;
if (!NSK_JNI_VERIFY(jni, (testedInstance =
- NSK_CPP_STUB3(GetStaticObjectField, jni, testedClass, fid)) != NULL))
+ jni->GetStaticObjectField(testedClass, fid)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -131,8 +126,7 @@
NSK_DISPLAY0("Testcase #1: check that there are no tagged objects\n");
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -144,8 +138,7 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -157,8 +150,10 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heap_object_callback,
+ &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -170,8 +165,10 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heap_object_callback,
+ &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -182,8 +179,7 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject,
- SAMPLE_TAG))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -197,8 +193,7 @@
NSK_DISPLAY0("Testcase #2: check that there is only one object tagged\n");
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -209,8 +204,7 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_TAGGED, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -221,8 +215,7 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -233,8 +226,7 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedInstance,
- SAMPLE_TAG))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedInstance, SAMPLE_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -248,8 +240,10 @@
NSK_DISPLAY0("Testcase #3: check that there is only one class object tagged\n");
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heap_object_callback,
+ &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -261,8 +255,10 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(IterateOverInstancesOfClass, jvmti,
- testedClass, JVMTI_HEAP_OBJECT_EITHER, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverInstancesOfClass(testedClass,
+ JVMTI_HEAP_OBJECT_EITHER,
+ heap_object_callback,
+ &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -274,8 +270,7 @@
}
ObjectsCount = 0;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(IterateOverHeap, jvmti,
- JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->IterateOverHeap(JVMTI_HEAP_OBJECT_UNTAGGED, heap_object_callback, &dummy))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -287,7 +282,7 @@
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
if (!nsk_jvmti_resumeSync())
return;
@@ -326,7 +321,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
@@ -337,8 +332,7 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -88,22 +88,18 @@
NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n");
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls,
- FIELD_NAME, FIELD_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fid)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -124,13 +120,12 @@
}
NSK_DISPLAY0("Set tag on testedObject\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject,
- SAMPLE_TAG))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+ NSK_TRACE(jni->DeleteGlobalRef(testedObject));
if (!nsk_jvmti_resumeSync())
return;
@@ -169,7 +164,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
@@ -182,12 +177,10 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA04/ma04t003/ma04t003a.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -88,22 +88,18 @@
NSK_DISPLAY0("Obtain tested object from a static field of debugee class\n");
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (cls =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (cls = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
NSK_DISPLAY2("Find field: %s:%s\n", FIELD_NAME, FIELD_SIGNATURE);
if (!NSK_JNI_VERIFY(jni, (fid =
- NSK_CPP_STUB4(GetStaticFieldID, jni, cls,
- FIELD_NAME, FIELD_SIGNATURE)) != NULL))
+ jni->GetStaticFieldID(cls, FIELD_NAME, FIELD_SIGNATURE)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB3(GetStaticObjectField, jni, cls, fid)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->GetStaticObjectField(cls, fid)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedObject =
- NSK_CPP_STUB2(NewGlobalRef, jni, testedObject)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedObject = jni->NewGlobalRef(testedObject)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -124,13 +120,12 @@
}
NSK_DISPLAY0("Set tag on testedObject\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetTag, jvmti, testedObject,
- SAMPLE_TAG))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->SetTag(testedObject, SAMPLE_TAG))) {
nsk_jvmti_setFailStatus();
return;
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedObject));
+ NSK_TRACE(jni->DeleteGlobalRef(testedObject));
if (!nsk_jvmti_resumeSync())
return;
@@ -169,7 +164,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_tag_objects = 1;
caps.can_generate_object_free_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps))) {
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps))) {
return JNI_ERR;
}
@@ -182,12 +177,10 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_OBJECT_FREE, NULL)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_VM_DEATH, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -54,17 +54,16 @@
char *signature = NULL;
BreakpointEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
}
NSK_DISPLAY2("Breakpoint event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
switch(BreakpointEventsCount) {
case 1:
@@ -85,8 +84,7 @@
break;
}
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(NotifyFramePop, jvmti_env, thread, 0))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0))) {
nsk_jvmti_setFailStatus();
}
}
@@ -99,8 +97,7 @@
char *signature = NULL;
FramePopEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -108,9 +105,9 @@
NSK_DISPLAY2("FramePop event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
}
/* ========================================================================== */
@@ -126,8 +123,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -139,8 +135,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -151,15 +146,13 @@
}
if (info.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)info.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
return NSK_FALSE;
}
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -167,29 +160,24 @@
return NSK_FALSE;
}
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'checkPoint' */
- if (!NSK_JNI_VERIFY(jni, (method = NSK_CPP_STUB4(
- GetMethodID, jni, klass, "checkPoint", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (method = jni->GetMethodID(klass, "checkPoint", "()V")) != NULL))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(SetBreakpoint, jvmti, method, 0)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetBreakpoint(method, 0)))
return NSK_FALSE;
/* enable events */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_BREAKPOINT, NULL)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -224,12 +212,11 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL)))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB3(ClearBreakpoint, jvmti, method, 0));
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread));
+ NSK_TRACE(jvmti->ClearBreakpoint(method, 0));
+ NSK_TRACE(jni->DeleteGlobalRef(thread));
if (!nsk_jvmti_resumeSync())
return;
@@ -268,7 +255,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_breakpoint_events = 1;
caps.can_generate_frame_pop_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA05/ma05t001/ma05t001a.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -57,8 +57,7 @@
return;
MethodEntryEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -66,15 +65,14 @@
NSK_DISPLAY2("MethodEntry event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
switch(MethodEntryEventsCount) {
case 1:
NSK_DISPLAY0("Testcase #1: FramePop in both agents\n");
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(NotifyFramePop, jvmti_env, thread, 0)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0)))
nsk_jvmti_setFailStatus();
break;
@@ -84,11 +82,9 @@
case 3:
NSK_DISPLAY0("Testcase #3: FramePop disabled in 2nd agent\n");
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti_env, JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_FRAME_POP, NULL)))
nsk_jvmti_setFailStatus();
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(NotifyFramePop, jvmti_env, thread, 0)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->NotifyFramePop(thread, 0)))
nsk_jvmti_setFailStatus();
break;
@@ -107,8 +103,7 @@
char *signature = NULL;
FramePopEventsCount++;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB5(GetMethodName,
- jvmti_env, method, &name, &signature, NULL))) {
+ if (!NSK_JVMTI_VERIFY(jvmti_env->GetMethodName(method, &name, &signature, NULL))) {
nsk_jvmti_setFailStatus();
return;
}
@@ -116,9 +111,9 @@
NSK_DISPLAY2("FramePop event: %s%s\n", name, signature);
if (name != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)name);
+ jvmti_env->Deallocate((unsigned char*)name);
if (signature != NULL)
- NSK_CPP_STUB2(Deallocate, jvmti_env, (unsigned char*)signature);
+ jvmti_env->Deallocate((unsigned char*)signature);
switch(MethodEntryEventsCount) {
case 1:
@@ -155,8 +150,7 @@
NSK_DISPLAY0("Prepare: find tested thread\n");
/* get all live threads */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetAllThreads, jvmti, &threads_count, &threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetAllThreads(&threads_count, &threads)))
return NSK_FALSE;
if (!NSK_VERIFY(threads_count > 0 && threads != NULL))
@@ -168,8 +162,7 @@
return NSK_FALSE;
/* get thread information */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB3(GetThreadInfo, jvmti, threads[i], &info)))
+ if (!NSK_JVMTI_VERIFY(jvmti->GetThreadInfo(threads[i], &info)))
return NSK_FALSE;
NSK_DISPLAY3(" thread #%d (%s): %p\n", i, info.name, threads[i]);
@@ -180,15 +173,13 @@
}
if (info.name != NULL) {
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(
- Deallocate, jvmti, (unsigned char*)info.name)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)info.name)))
return NSK_FALSE;
}
}
/* deallocate threads list */
- if (!NSK_JVMTI_VERIFY(
- NSK_CPP_STUB2(Deallocate, jvmti, (unsigned char*)threads)))
+ if (!NSK_JVMTI_VERIFY(jvmti->Deallocate((unsigned char*)threads)))
return NSK_FALSE;
if (thread == NULL) {
@@ -196,26 +187,21 @@
return NSK_FALSE;
}
- if (!NSK_JNI_VERIFY(jni, (thread =
- NSK_CPP_STUB2(NewGlobalRef, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (thread = jni->NewGlobalRef(thread)) != NULL))
return NSK_FALSE;
/* get tested thread class */
- if (!NSK_JNI_VERIFY(jni, (klass =
- NSK_CPP_STUB2(GetObjectClass, jni, thread)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (klass = jni->GetObjectClass(thread)) != NULL))
return NSK_FALSE;
/* get tested thread method 'checkPoint' */
- if (!NSK_JNI_VERIFY(jni, (midCheckPoint = NSK_CPP_STUB4(
- GetMethodID, jni, klass, "checkPoint", "()V")) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (midCheckPoint = jni->GetMethodID(klass, "checkPoint", "()V")) != NULL))
return NSK_FALSE;
/* enable events */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_METHOD_ENTRY, NULL)))
return NSK_FALSE;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_FRAME_POP, NULL)))
return NSK_FALSE;
return NSK_TRUE;
@@ -246,9 +232,8 @@
nsk_jvmti_setFailStatus();
}
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, thread));
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL)))
+ NSK_TRACE(jni->DeleteGlobalRef(thread));
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_METHOD_ENTRY, NULL)))
nsk_jvmti_setFailStatus();
if (!nsk_jvmti_resumeSync())
@@ -288,7 +273,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_generate_method_entry_events = 1;
caps.can_generate_frame_pop_events = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -65,8 +65,7 @@
if (class_being_redefined == NULL) {
/* sent by class load */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, class_data_len, &klass_bytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes)))
nsk_jvmti_setFailStatus();
else {
memcpy(klass_bytes, class_data, class_data_len);
@@ -94,12 +93,10 @@
static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) {
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (testedClass =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -126,7 +123,7 @@
class_def.klass = testedClass;
class_def.class_byte_count = klass_byte_count;
class_def.class_bytes = klass_bytes;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -181,11 +178,10 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
if (!nsk_jvmti_resumeSync())
return;
@@ -223,7 +219,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
@@ -234,8 +230,7 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA06/ma06t001/ma06t001a.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -65,8 +65,7 @@
if (class_being_redefined == NULL) {
/* sent by class load */
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, class_data_len, &klass_bytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes)))
nsk_jvmti_setFailStatus();
else {
memcpy(klass_bytes, class_data, class_data_len);
@@ -94,12 +93,10 @@
static int prepare(jvmtiEnv* jvmti, JNIEnv* jni) {
NSK_DISPLAY1("Find class: %s\n", CLASS_NAME);
- if (!NSK_JNI_VERIFY(jni, (testedClass =
- NSK_CPP_STUB2(FindClass, jni, CLASS_NAME)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = jni->FindClass(CLASS_NAME)) != NULL))
return NSK_FALSE;
- if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass)
- NSK_CPP_STUB2(NewGlobalRef, jni, testedClass)) != NULL))
+ if (!NSK_JNI_VERIFY(jni, (testedClass = (jclass) jni->NewGlobalRef(testedClass)) != NULL))
return NSK_FALSE;
return NSK_TRUE;
@@ -126,7 +123,7 @@
class_def.klass = testedClass;
class_def.class_byte_count = klass_byte_count;
class_def.class_bytes = klass_bytes;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(RedefineClasses, jvmti, 1, &class_def)))
+ if (!NSK_JVMTI_VERIFY(jvmti->RedefineClasses(1, &class_def)))
return NSK_FALSE;
return NSK_TRUE;
@@ -181,11 +178,10 @@
nsk_jvmti_setFailStatus();
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_DISABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
nsk_jvmti_setFailStatus();
- NSK_TRACE(NSK_CPP_STUB2(DeleteGlobalRef, jni, testedClass));
+ NSK_TRACE(jni->DeleteGlobalRef(testedClass));
if (!nsk_jvmti_resumeSync())
return;
@@ -223,7 +219,7 @@
memset(&caps, 0, sizeof(caps));
caps.can_redefine_classes = 1;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB2(AddCapabilities, jvmti, &caps)))
+ if (!NSK_JVMTI_VERIFY(jvmti->AddCapabilities(&caps)))
return JNI_ERR;
if (!NSK_VERIFY(nsk_jvmti_setAgentProc(agentProc, NULL)))
@@ -234,8 +230,7 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -71,8 +71,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, class_data_len, &klass_bytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes)))
nsk_jvmti_setFailStatus();
else {
@@ -174,8 +173,7 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp Fri Oct 19 11:15:57 2018 -0700
+++ b/test/hotspot/jtreg/vmTestbase/nsk/jvmti/scenarios/multienv/MA07/ma07t001/ma07t001a.cpp Tue Oct 16 23:21:05 2018 +0530
@@ -71,8 +71,7 @@
return;
}
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB3(Allocate,
- jvmti_env, class_data_len, &klass_bytes)))
+ if (!NSK_JVMTI_VERIFY(jvmti_env->Allocate(class_data_len, &klass_bytes)))
nsk_jvmti_setFailStatus();
else {
@@ -175,8 +174,7 @@
if (!NSK_VERIFY(nsk_jvmti_init_MA(&callbacks)))
return JNI_ERR;
- if (!NSK_JVMTI_VERIFY(NSK_CPP_STUB4(SetEventNotificationMode,
- jvmti, JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
+ if (!NSK_JVMTI_VERIFY(jvmti->SetEventNotificationMode(JVMTI_ENABLE, JVMTI_EVENT_CLASS_FILE_LOAD_HOOK, NULL)))
return JNI_ERR;
return JNI_OK;
--- a/test/jdk/TEST.groups Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/TEST.groups Tue Oct 16 23:21:05 2018 +0530
@@ -218,8 +218,7 @@
-sun/security/krb5 \
-sun/security/jgss \
javax/net \
- com/sun/net/ssl \
- lib/security
+ com/sun/net/ssl
jdk_security4 = \
com/sun/security/jgss \
--- a/test/jdk/com/sun/jdi/DeferredStepTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/com/sun/jdi/DeferredStepTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -114,7 +114,7 @@
* Each "next" produces something like ("Breakpoint hit" line only if the line has BP)
* Step completed:
* Breakpoint hit: "thread=jj2", DeferredStepTestTarg$jj2.run(), line=74 bci=12
- * 74 ++count2; // @2 breakpoint
+ * 74 ++count2; // @ 2 breakpoint
* <empty line>
* jj2[1]
*/
--- a/test/jdk/java/io/FileInputStream/UnreferencedFISClosesFd.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/io/FileInputStream/UnreferencedFISClosesFd.java Tue Oct 16 23:21:05 2018 +0530
@@ -62,15 +62,11 @@
*/
public class UnreferencedFISClosesFd {
- enum CleanupType {
- CLOSE, // Cleanup is handled via calling close
- CLEANER} // Cleanup is handled via Cleaner
-
static final String FILE_NAME = "empty.txt";
/**
* Subclass w/ no overrides; not finalize or close.
- * Cleanup should be via the Cleaner (not close).
+ * Cleanup should be via the Cleaner.
*/
public static class StreamOverrides extends FileInputStream {
@@ -88,7 +84,7 @@
/**
* Subclass overrides close.
- * Cleanup should be via AltFinalizer calling close().
+ * Cleanup should be via the Cleaner.
*/
public static class StreamOverridesClose extends StreamOverrides {
@@ -104,7 +100,7 @@
/**
* Subclass overrides finalize.
- * Cleanup should be via the Cleaner (not close).
+ * Cleanup should be via the Cleaner.
*/
public static class StreamOverridesFinalize extends StreamOverrides {
@@ -113,7 +109,7 @@
}
@SuppressWarnings({"deprecation","removal"})
- protected void finalize() throws IOException {
+ protected void finalize() throws IOException, Throwable {
super.finalize();
}
}
@@ -129,7 +125,7 @@
}
@SuppressWarnings({"deprecation","removal"})
- protected void finalize() throws IOException {
+ protected void finalize() throws IOException, Throwable {
super.finalize();
}
}
@@ -149,15 +145,15 @@
long fdCount0 = getFdCount();
int failCount = 0;
- failCount += test(new FileInputStream(name), CleanupType.CLEANER);
+ failCount += test(new FileInputStream(name));
- failCount += test(new StreamOverrides(name), CleanupType.CLEANER);
+ failCount += test(new StreamOverrides(name));
- failCount += test(new StreamOverridesClose(name), CleanupType.CLOSE);
+ failCount += test(new StreamOverridesClose(name));
- failCount += test(new StreamOverridesFinalize(name), CleanupType.CLEANER);
+ failCount += test(new StreamOverridesFinalize(name));
- failCount += test(new StreamOverridesFinalizeClose(name), CleanupType.CLOSE);
+ failCount += test(new StreamOverridesFinalizeClose(name));
if (failCount > 0) {
throw new AssertionError("Failed test count: " + failCount);
@@ -180,7 +176,7 @@
: -1L;
}
- private static int test(FileInputStream fis, CleanupType cleanType) throws Exception {
+ private static int test(FileInputStream fis) throws Exception {
try {
System.out.printf("%nTesting %s%n", fis.getClass().getName());
@@ -199,35 +195,18 @@
fdField.setAccessible(true);
int ffd = fdField.getInt(fd);
- Field altFinalizerField = FileInputStream.class.getDeclaredField("altFinalizer");
- altFinalizerField.setAccessible(true);
- Object altFinalizer = altFinalizerField.get(fis);
- if ((altFinalizer != null) ^ (cleanType == CleanupType.CLOSE)) {
- throw new RuntimeException("Unexpected AltFinalizer: " + altFinalizer
- + ", for " + cleanType);
- }
-
Field cleanupField = FileDescriptor.class.getDeclaredField("cleanup");
cleanupField.setAccessible(true);
Object cleanup = cleanupField.get(fd);
- System.out.printf(" cleanup: %s, alt: %s, ffd: %d, cf: %s%n",
- cleanup, altFinalizer, ffd, cleanupField);
- if ((cleanup != null) ^ (cleanType == CleanupType.CLEANER)) {
- throw new Exception("unexpected cleanup: "
- + cleanup + ", for " + cleanType);
+ System.out.printf(" cleanup: %s, ffd: %d, cf: %s%n", cleanup, ffd, cleanupField);
+ if (cleanup == null) {
+ throw new RuntimeException("cleanup should not be null");
}
- if (cleanup != null) {
- WeakReference<Object> cleanupWeak = new WeakReference<>(cleanup, queue);
- pending.add(cleanupWeak);
- System.out.printf(" fdWeak: %s%n msWeak: %s%n cleanupWeak: %s%n",
- fdWeak, msWeak, cleanupWeak);
- }
- if (altFinalizer != null) {
- WeakReference<Object> altFinalizerWeak = new WeakReference<>(altFinalizer, queue);
- pending.add(altFinalizerWeak);
- System.out.printf(" fdWeak: %s%n msWeak: %s%n altFinalizerWeak: %s%n",
- fdWeak, msWeak, altFinalizerWeak);
- }
+
+ WeakReference<Object> cleanupWeak = new WeakReference<>(cleanup, queue);
+ pending.add(cleanupWeak);
+ System.out.printf(" fdWeak: %s%n msWeak: %s%n cleanupWeak: %s%n",
+ fdWeak, msWeak, cleanupWeak);
AtomicInteger closeCounter = fis instanceof StreamOverrides
? ((StreamOverrides)fis).closeCounter() : null;
@@ -243,28 +222,16 @@
fis = null;
fd = null;
cleanup = null;
- altFinalizer = null;
System.gc(); // attempt to reclaim them
}
}
Reference.reachabilityFence(fd);
Reference.reachabilityFence(fis);
Reference.reachabilityFence(cleanup);
- Reference.reachabilityFence(altFinalizer);
// Confirm the correct number of calls to close depending on the cleanup type
- switch (cleanType) {
- case CLEANER:
- if (closeCounter != null && closeCounter.get() > 0) {
- throw new RuntimeException("Close should not have been called: count: "
- + closeCounter);
- }
- break;
- case CLOSE:
- if (closeCounter == null || closeCounter.get() == 0) {
- throw new RuntimeException("Close should have been called: count: 0");
- }
- break;
+ if (closeCounter != null && closeCounter.get() > 0) {
+ throw new RuntimeException("Close should not have been called: count: " + closeCounter);
}
} catch (Exception ex) {
ex.printStackTrace(System.out);
--- a/test/jdk/java/io/FileOutputStream/UnreferencedFOSClosesFd.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/io/FileOutputStream/UnreferencedFOSClosesFd.java Tue Oct 16 23:21:05 2018 +0530
@@ -28,8 +28,7 @@
* @library /test/lib
* @build jdk.test.lib.util.FileUtils UnreferencedFOSClosesFd
* @bug 6524062
- * @summary Test to ensure that FOS.finalize() invokes the close() method as per
- * the specification.
+ * @summary Test to ensure that the fd is closed if left unreferenced
* @run main/othervm UnreferencedFOSClosesFd
*/
import java.io.File;
@@ -54,15 +53,11 @@
public class UnreferencedFOSClosesFd {
- enum CleanupType {
- CLOSE, // Cleanup is handled via calling close
- CLEANER} // Cleanup is handled via Cleaner
-
static final String FILE_NAME = "empty.txt";
/**
- * Subclass w/ no overrides; not finalize or close.
- * Cleanup should be via the Cleaner (not close).
+ * Subclass w/ no overrides; not close.
+ * Cleanup should be via the Cleaner.
*/
public static class StreamOverrides extends FileOutputStream {
@@ -96,7 +91,7 @@
/**
* Subclass overrides finalize and close.
- * Cleanup should be via the Cleaner (not close).
+ * Cleanup should be via the Cleaner.
*/
public static class StreamOverridesFinalize extends StreamOverrides {
@@ -105,14 +100,14 @@
}
@SuppressWarnings({"deprecation","removal"})
- protected void finalize() throws IOException {
+ protected void finalize() throws IOException, Throwable {
super.finalize();
}
}
/**
* Subclass overrides finalize and close.
- * Cleanup should be via AltFinalizer calling close().
+ * Cleanup should be via the Cleaner.
*/
public static class StreamOverridesFinalizeClose extends StreamOverridesClose {
@@ -121,7 +116,7 @@
}
@SuppressWarnings({"deprecation","removal"})
- protected void finalize() throws IOException {
+ protected void finalize() throws IOException, Throwable {
super.finalize();
}
}
@@ -131,8 +126,6 @@
*/
public static void main(String argv[]) throws Exception {
-
-
File inFile = new File(System.getProperty("test.dir", "."), FILE_NAME);
inFile.createNewFile();
inFile.deleteOnExit();
@@ -143,15 +136,15 @@
long fdCount0 = getFdCount();
int failCount = 0;
- failCount += test(new FileOutputStream(name), CleanupType.CLEANER);
+ failCount += test(new FileOutputStream(name));
- failCount += test(new StreamOverrides(name), CleanupType.CLEANER);
+ failCount += test(new StreamOverrides(name));
- failCount += test(new StreamOverridesClose(name), CleanupType.CLOSE);
+ failCount += test(new StreamOverridesClose(name));
- failCount += test(new StreamOverridesFinalize(name), CleanupType.CLEANER);
+ failCount += test(new StreamOverridesFinalize(name));
- failCount += test(new StreamOverridesFinalizeClose(name), CleanupType.CLOSE);
+ failCount += test(new StreamOverridesFinalizeClose(name));
if (failCount > 0) {
throw new AssertionError("Failed test count: " + failCount);
@@ -174,7 +167,7 @@
: -1L;
}
- private static int test(FileOutputStream fos, CleanupType cleanType) throws Exception {
+ private static int test(FileOutputStream fos) throws Exception {
try {
System.out.printf("%nTesting %s%n", fos.getClass().getName());
@@ -193,35 +186,18 @@
fdField.setAccessible(true);
int ffd = fdField.getInt(fd);
- Field altFinalizerField = FileOutputStream.class.getDeclaredField("altFinalizer");
- altFinalizerField.setAccessible(true);
- Object altFinalizer = altFinalizerField.get(fos);
- if ((altFinalizer != null) ^ (cleanType == CleanupType.CLOSE)) {
- throw new RuntimeException("Unexpected AltFinalizer: " + altFinalizer
- + ", for " + cleanType);
- }
-
Field cleanupField = FileDescriptor.class.getDeclaredField("cleanup");
cleanupField.setAccessible(true);
Object cleanup = cleanupField.get(fd);
- System.out.printf(" cleanup: %s, alt: %s, ffd: %d, cf: %s%n",
- cleanup, altFinalizer, ffd, cleanupField);
- if ((cleanup != null) ^ (cleanType == CleanupType.CLEANER)) {
- throw new Exception("unexpected cleanup: "
- + cleanup + ", for " + cleanType);
+ System.out.printf(" cleanup: %s, ffd: %d, cf: %s%n", cleanup, ffd, cleanupField);
+ if (cleanup == null) {
+ throw new RuntimeException("cleanup should not be null");
}
- if (cleanup != null) {
- WeakReference<Object> cleanupWeak = new WeakReference<>(cleanup, queue);
- pending.add(cleanupWeak);
- System.out.printf(" fdWeak: %s%n msWeak: %s%n cleanupWeak: %s%n",
- fdWeak, msWeak, cleanupWeak);
- }
- if (altFinalizer != null) {
- WeakReference<Object> altFinalizerWeak = new WeakReference<>(altFinalizer, queue);
- pending.add(altFinalizerWeak);
- System.out.printf(" fdWeak: %s%n msWeak: %s%n altFinalizerWeak: %s%n",
- fdWeak, msWeak, altFinalizerWeak);
- }
+
+ WeakReference<Object> cleanupWeak = new WeakReference<>(cleanup, queue);
+ pending.add(cleanupWeak);
+ System.out.printf(" fdWeak: %s%n msWeak: %s%n cleanupWeak: %s%n",
+ fdWeak, msWeak, cleanupWeak);
AtomicInteger closeCounter = fos instanceof StreamOverrides
? ((StreamOverrides) fos).closeCounter() : null;
@@ -237,28 +213,16 @@
fos = null;
fd = null;
cleanup = null;
- altFinalizer = null;
System.gc(); // attempt to reclaim them
}
}
Reference.reachabilityFence(fd);
Reference.reachabilityFence(fos);
Reference.reachabilityFence(cleanup);
- Reference.reachabilityFence(altFinalizer);
// Confirm the correct number of calls to close depending on the cleanup type
- switch (cleanType) {
- case CLEANER:
- if (closeCounter != null && closeCounter.get() > 0) {
- throw new RuntimeException("Close should not have been called: count: "
- + closeCounter);
- }
- break;
- case CLOSE:
- if (closeCounter == null || closeCounter.get() == 0) {
- throw new RuntimeException("Close should have been called: count: 0");
- }
- break;
+ if (closeCounter != null && closeCounter.get() > 0) {
+ throw new RuntimeException("Close should not have been called: count: " + closeCounter);
}
} catch (Exception ex) {
ex.printStackTrace(System.out);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/Response204.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,109 @@
+/*
+ * Copyright (c) 2018, 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 8211437
+ * @run main/othervm -Djdk.httpclient.HttpClient.log=headers,requests Response204
+ * @summary
+ */
+
+import com.sun.net.httpserver.*;
+
+import java.net.http.HttpClient;
+import java.net.http.HttpRequest;
+import java.net.http.HttpResponse;
+import java.util.*;
+import java.util.concurrent.*;
+import java.util.logging.*;
+import java.io.*;
+import java.net.*;
+
+/**
+ * Verify that a 204 response code with no content-length is handled correctly
+ */
+public class Response204 {
+
+ public static void main (String[] args) throws Exception {
+ Logger logger = Logger.getLogger ("com.sun.net.httpserver");
+ ConsoleHandler c = new ConsoleHandler();
+ c.setLevel (Level.WARNING);
+ logger.addHandler (c);
+ logger.setLevel (Level.WARNING);
+ Handler handler = new Handler();
+ InetSocketAddress addr = new InetSocketAddress (0);
+ HttpServer server = HttpServer.create (addr, 0);
+ HttpContext ctx = server.createContext ("/test", handler);
+ ExecutorService executor = Executors.newCachedThreadPool();
+ server.setExecutor (executor);
+ server.start ();
+
+ URI uri = new URI("http://localhost:"+server.getAddress().getPort()+"/test/foo.html");
+
+ try {
+ HttpClient client = HttpClient.newHttpClient();
+ HttpRequest request = HttpRequest.newBuilder(uri)
+ .GET()
+ .build();
+ HttpResponse<String> response = client.send(request, HttpResponse.BodyHandlers.ofString());
+ if (response.statusCode() != 204)
+ throw new RuntimeException("wrong response code");
+ if (response.body() != null && !response.body().equals(""))
+ throw new RuntimeException("should have received empty response");
+ System.out.println(response.headers().firstValue("content-length").orElse("nichts"));
+ System.out.println ("OK 1");
+ // Send a second time. This time we should get exception because the server
+ // is going to send an invalid 204 with a Content-length
+ try {
+ response = client.send(request, HttpResponse.BodyHandlers.ofString());
+ throw new RuntimeException("send should have thrown exception");
+ } catch (IOException ioe) {
+ System.out.println("OK 2");
+ }
+ } finally {
+ server.stop(2);
+ executor.shutdown();
+ }
+ }
+
+ public static boolean error = false;
+
+ static class Handler implements HttpHandler {
+ volatile int counter = 0;
+
+ public void handle(HttpExchange t)
+ throws IOException {
+ InputStream is = t.getRequestBody();
+ Headers map = t.getRequestHeaders();
+ Headers rmap = t.getResponseHeaders();
+ while (is.read() != -1) ;
+ is.close();
+ if (counter++ == 1) {
+ // pretend there is a body
+ rmap.set("Content-length", "10");
+ }
+ t.sendResponseHeaders(204, -1);
+ t.close();
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/net/httpclient/http2/NoBodyTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,221 @@
+/*
+ * Copyright (c) 2015, 2018, 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 8087112
+ * @library /test/lib server
+ * @build jdk.test.lib.net.SimpleSSLContext
+ * @modules java.base/sun.net.www.http
+ * java.net.http/jdk.internal.net.http.common
+ * java.net.http/jdk.internal.net.http.frame
+ * java.net.http/jdk.internal.net.http.hpack
+ * @run testng/othervm -Djdk.httpclient.HttpClient.log=ssl,requests,responses,errors NoBodyTest
+ */
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.*;
+import javax.net.ssl.*;
+import java.net.http.HttpClient;
+import java.net.http.HttpHeaders;
+import java.net.http.HttpRequest;
+import java.net.http.HttpRequest.BodyPublishers;
+import java.net.http.HttpResponse;
+import java.net.http.HttpResponse.BodyHandlers;
+import java.util.concurrent.*;
+import jdk.test.lib.net.SimpleSSLContext;
+import org.testng.annotations.Test;
+import static java.net.http.HttpClient.Version.HTTP_2;
+
+@Test
+public class NoBodyTest {
+ static int httpPort, httpsPort;
+ static Http2TestServer httpServer, httpsServer;
+ static HttpClient client = null;
+ static ExecutorService clientExec;
+ static ExecutorService serverExec;
+ static SSLContext sslContext;
+ static String TEST_STRING = "The quick brown fox jumps over the lazy dog ";
+
+ static String httpURIString, httpsURIString;
+
+ static void initialize() throws Exception {
+ try {
+ SimpleSSLContext sslct = new SimpleSSLContext();
+ sslContext = sslct.get();
+ client = getClient();
+ httpServer = new Http2TestServer(false, 0, serverExec, sslContext);
+ httpServer.addHandler(new Handler(), "/");
+ httpPort = httpServer.getAddress().getPort();
+
+ httpsServer = new Http2TestServer(true, 0, serverExec, sslContext);
+ httpsServer.addHandler(new Handler(), "/");
+
+ httpsPort = httpsServer.getAddress().getPort();
+ httpURIString = "http://localhost:" + httpPort + "/foo/";
+ httpsURIString = "https://localhost:" + httpsPort + "/bar/";
+
+ httpServer.start();
+ httpsServer.start();
+ } catch (Throwable e) {
+ System.err.println("Throwing now");
+ e.printStackTrace(System.err);
+ throw e;
+ }
+ }
+
+ @Test
+ public static void runtest() throws Exception {
+ try {
+ initialize();
+ warmup(false);
+ warmup(true);
+ test(false);
+ test(true);
+ } catch (Throwable tt) {
+ System.err.println("tt caught");
+ tt.printStackTrace(System.err);
+ throw tt;
+ } finally {
+ httpServer.stop();
+ httpsServer.stop();
+ }
+ }
+
+ static HttpClient getClient() {
+ if (client == null) {
+ serverExec = Executors.newCachedThreadPool();
+ clientExec = Executors.newCachedThreadPool();
+ client = HttpClient.newBuilder()
+ .executor(clientExec)
+ .sslContext(sslContext)
+ .version(HTTP_2)
+ .build();
+ }
+ return client;
+ }
+
+ static URI getURI(boolean secure) {
+ if (secure)
+ return URI.create(httpsURIString);
+ else
+ return URI.create(httpURIString);
+ }
+
+ static void checkStatus(int expected, int found) throws Exception {
+ if (expected != found) {
+ System.err.printf ("Test failed: wrong status code %d/%d\n",
+ expected, found);
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ static void checkStrings(String expected, String found) throws Exception {
+ if (!expected.equals(found)) {
+ System.err.printf ("Test failed: wrong string %s/%s\n",
+ expected, found);
+ throw new RuntimeException("Test failed");
+ }
+ }
+
+ static final int LOOPS = 13;
+
+ static void warmup(boolean secure) throws Exception {
+ URI uri = getURI(secure);
+ String type = secure ? "https" : "http";
+ System.err.println("Request to " + uri);
+
+ // Do a simple warmup request
+
+ HttpClient client = getClient();
+ HttpRequest req = HttpRequest.newBuilder(uri)
+ .POST(BodyPublishers.ofString("Random text"))
+ .build();
+ HttpResponse<String> response = client.send(req, BodyHandlers.ofString());
+ checkStatus(200, response.statusCode());
+ String responseBody = response.body();
+ HttpHeaders h = response.headers();
+ checkStrings(TEST_STRING + type, responseBody);
+ }
+
+ static void test(boolean secure) throws Exception {
+ URI uri = getURI(secure);
+ String type = secure ? "https" : "http";
+ System.err.println("Request to " + uri);
+
+ HttpRequest request = HttpRequest.newBuilder(uri)
+ .POST(BodyPublishers.ofString(TEST_STRING))
+ .build();
+ for (int i = 0; i < LOOPS; i++) {
+ System.out.println("Loop " + i);
+ HttpResponse<String> response = client.send(request, BodyHandlers.ofString());
+ int expectedResponse = (i % 2) == 0 ? 204 : 200;
+ if (response.statusCode() != expectedResponse)
+ throw new RuntimeException("wrong response code " + Integer.toString(response.statusCode()));
+ if (expectedResponse == 200 && !response.body().equals(TEST_STRING + type)) {
+ System.err.printf("response received/expected %s/%s\n", response.body(), TEST_STRING + type);
+ throw new RuntimeException("wrong response body");
+ }
+ }
+ System.err.println("test: DONE");
+ }
+
+ static class Handler implements Http2Handler {
+
+ public Handler() {}
+
+ volatile int invocation = 0;
+
+ @Override
+ public void handle(Http2TestExchange t)
+ throws IOException {
+ try {
+ URI uri = t.getRequestURI();
+ System.err.printf("Handler received request to %s from %s\n",
+ uri, t.getRemoteAddress());
+ String type = uri.getScheme().toLowerCase();
+ InputStream is = t.getRequestBody();
+ while (is.read() != -1);
+ is.close();
+
+ // every second response is 204.
+
+ if ((invocation++ % 2) == 1) {
+ System.err.println("Server sending 204");
+ t.sendResponseHeaders(204, -1);
+ } else {
+ String body = TEST_STRING + type;
+ t.sendResponseHeaders(200, body.length());
+ OutputStream os = t.getResponseBody();
+ os.write(body.getBytes());
+ os.close();
+ }
+ } catch (Throwable e) {
+ e.printStackTrace(System.err);
+ throw new IOException(e);
+ }
+ }
+ }
+}
--- a/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/net/httpclient/http2/server/Http2TestExchangeImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -129,7 +129,7 @@
@Override
public void sendResponseHeaders(int rCode, long responseLength) throws IOException {
this.responseLength = responseLength;
- if (responseLength > 0 || responseLength < 0) {
+ if (responseLength !=0 && rCode != 204) {
long clen = responseLength > 0 ? responseLength : 0;
rspheadersBuilder.setHeader("Content-length", Long.toString(clen));
}
--- a/test/jdk/java/nio/Buffer/genBasic.sh Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/nio/Buffer/genBasic.sh Tue Oct 16 23:21:05 2018 +0530
@@ -1,7 +1,7 @@
#! /bin/sh
#
-# Copyright (c) 2000, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2000, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
# questions.
#
-javac -d . ../../../../make/src/classes/build/tools/spp/Spp.java
+javac -d . ../../../../../make/jdk/src/classes/build/tools/spp/Spp.java
gen() {
java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3 <Basic-X.java.template >Basic$2.java
--- a/test/jdk/java/nio/Buffer/genCopyDirectMemory.sh Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/nio/Buffer/genCopyDirectMemory.sh Tue Oct 16 23:21:05 2018 +0530
@@ -1,7 +1,7 @@
#! /bin/sh
#
-# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
# questions.
#
-javac -d . ../../../../make/src/classes/build/tools/spp/Spp.java > Spp.java
+javac -d . ../../../../../make/jdk/src/classes/build/tools/spp/Spp.java > Spp.java
gen() {
java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3<CopyDirect-X-Memory.java.template >CopyDirect$2Memory.java
--- a/test/jdk/java/nio/Buffer/genOrder.sh Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/nio/Buffer/genOrder.sh Tue Oct 16 23:21:05 2018 +0530
@@ -1,7 +1,7 @@
#! /bin/sh
#
-# Copyright (c) 2002, 2015, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2002, 2018, Oracle and/or its affiliates. All rights reserved.
# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
#
# This code is free software; you can redistribute it and/or modify it
@@ -23,8 +23,7 @@
# questions.
#
-javac -d . ../../../../make/src/classes/build/tools/spp/Spp.java > Spp.java
-
+javac -d . ../../../../../make/jdk/src/classes/build/tools/spp/Spp.java > Spp.java
gen() {
java build.tools.spp.Spp -K$1 -Dtype=$1 -DType=$2 -DFulltype=$3<Order-X.java.template >Order$2.java
}
--- a/test/jdk/java/util/Locale/LocaleCategory.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/Locale/LocaleCategory.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2010, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2010, 2018, 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
@@ -20,13 +20,29 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
+/*
+ * @test
+ * @bug 4700857 6997928 7079486
+ * @summary tests for Locale.getDefault(Locale.Category) and
+ * Locale.setDefault(Locale.Category, Locale)
+ * @library /java/text/testlib
+ * @build TestUtils LocaleCategory
+ * @comment test user.xxx.display user.xxx.format properties
+ * @run main/othervm -Duser.language.display=ja
+ * -Duser.language.format=zh LocaleCategory
+ * @comment test user.xxx properties overriding user.xxx.display/format
+ * @run main/othervm -Duser.language=en
+ * -Duser.language.display=ja
+ * -Duser.language.format=zh LocaleCategory
+ */
+
import java.util.Locale;
public class LocaleCategory {
private static Locale base = null;
private static Locale disp = null;
private static Locale fmt = null;
- private static String enc = null;
public static void main(String[] args) {
Locale reservedLocale = Locale.getDefault();
@@ -37,7 +53,6 @@
try {
Locale.Builder builder = new Locale.Builder();
-
base = builder.setLanguage(System.getProperty("user.language", ""))
.setScript(System.getProperty("user.script", ""))
.setRegion(System.getProperty("user.country", ""))
@@ -68,32 +83,37 @@
}
}
- static void checkDefault() {
+ private static void checkDefault() {
if (!base.equals(Locale.getDefault()) ||
!disp.equals(Locale.getDefault(Locale.Category.DISPLAY)) ||
!fmt.equals(Locale.getDefault(Locale.Category.FORMAT))) {
- throw new RuntimeException("Some of the return values from getDefault() do not agree with the locale derived from \"user.xxxx\" system properties");
+ throw new RuntimeException("Some of the return values from "
+ + "getDefault() do not agree with the locale derived "
+ + "from \"user.xxxx\" system properties");
}
}
- static void testGetSetDefault() {
+ private static void testGetSetDefault() {
try {
Locale.setDefault(null, null);
- throw new RuntimeException("setDefault(null, null) should throw a NullPointerException");
+ throw new RuntimeException("setDefault(null, null) should throw a "
+ + "NullPointerException");
} catch (NullPointerException npe) {}
Locale.setDefault(Locale.CHINA);
if (!Locale.CHINA.equals(Locale.getDefault(Locale.Category.DISPLAY)) ||
!Locale.CHINA.equals(Locale.getDefault(Locale.Category.FORMAT))) {
- throw new RuntimeException("setDefault() should set all default locales for all categories");
+ throw new RuntimeException("setDefault() should set all default "
+ + "locales for all categories");
}
}
- static void testBug7079486() {
+ private static void testBug7079486() {
Locale zh_Hans_CN = Locale.forLanguageTag("zh-Hans-CN");
// make sure JRE has zh_Hans_CN localized string
- if (zh_Hans_CN.getDisplayScript(Locale.US).equals(zh_Hans_CN.getDisplayScript(zh_Hans_CN))) {
+ if (zh_Hans_CN.getDisplayScript(Locale.US)
+ .equals(zh_Hans_CN.getDisplayScript(zh_Hans_CN))) {
return;
}
@@ -104,7 +124,8 @@
String zh_script = zh_Hans_CN.getDisplayScript();
if (en_script.equals(zh_script)) {
- throw new RuntimeException("Locale.getDisplayScript() (no args) does not honor default DISPLAY locale");
+ throw new RuntimeException("Locale.getDisplayScript() (no args) "
+ + "does not honor default DISPLAY locale");
}
}
}
--- a/test/jdk/java/util/Locale/LocaleCategory.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,104 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2011, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 4700857 6997928 7079486
-# @summary tests for Locale.getDefault(Locale.Category) and
-# Locale.setDefault(Locale.Category, Locale)
-# @library /java/text/testlib
-# @build LocaleCategory TestUtils
-# @run shell/timeout=600 LocaleCategory.sh
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "TESTCLASSPATH=${TESTCLASSPATH}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | *BSD | Darwin | AIX )
- PS=":"
- FS="/"
- ;;
- Windows* | CYGWIN* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# test user.xxx.display user.xxx.format properties
-
-# run
-RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
-
-echo ${RUNCMD}
-${RUNCMD}
-result=$?
-
-if [ $result -eq 0 ]
-then
- echo "Execution successful"
-else
- echo "Execution of the test case failed."
-fi
-
-# test user.xxx properties overriding user.xxx.display/format
-
-# run
-RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} -classpath ${TESTCLASSPATH} -Duser.language=en -Duser.language.display=ja -Duser.language.format=zh LocaleCategory"
-
-echo ${RUNCMD}
-${RUNCMD}
-result=$?
-
-if [ $result -eq 0 ]
-then
- echo "Execution successful"
-else
- echo "Execution of the test case failed."
-fi
-
-exit $result
--- a/test/jdk/java/util/Locale/LocaleProviders.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,370 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012, 2016, 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 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577
-# 8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006
-# 8150432
-# @summary tests for "java.locale.providers" system property
-# @modules java.base/sun.util.locale
-# java.base/sun.util.locale.provider
-# @compile LocaleProviders.java
-# @run shell/timeout=600 LocaleProviders.sh
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-if [ "${COMPILEJAVA}" = "" ]
-then
- COMPILEJAVA="${TESTJAVA}"
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | *BSD | Darwin | AIX )
- PS=":"
- FS="/"
- ;;
- Windows* | CYGWIN* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-# create SPI implementations
-mk() {
- d=`dirname $1`
- if [ ! -d $d ]; then mkdir -p $d; fi
- cat - >$1
-}
-
-SPIDIR=${TESTCLASSES}${FS}spi
-rm -rf ${SPIDIR}
-mk ${SPIDIR}${FS}src${FS}tznp.java << EOF
-import java.util.spi.TimeZoneNameProvider;
-import java.util.Locale;
-
-public class tznp extends TimeZoneNameProvider {
- public String getDisplayName(String ID, boolean daylight, int style, Locale locale) {
- return "tznp";
- }
-
- public Locale[] getAvailableLocales() {
- Locale[] locales = {Locale.US};
- return locales;
- }
-}
-EOF
-mk ${SPIDIR}${FS}src${FS}tznp8013086.java << EOF
-import java.util.spi.TimeZoneNameProvider;
-import java.util.Locale;
-import java.util.TimeZone;
-
-public class tznp8013086 extends TimeZoneNameProvider {
- public String getDisplayName(String ID, boolean daylight, int style, Locale locale) {
- if (!daylight && style==TimeZone.LONG) {
- return "tznp8013086";
- } else {
- return null;
- }
- }
-
- public Locale[] getAvailableLocales() {
- Locale[] locales = {Locale.JAPAN};
- return locales;
- }
-}
-EOF
-mk ${SPIDIR}${FS}dest${FS}META-INF${FS}services${FS}java.util.spi.TimeZoneNameProvider << EOF
-tznp
-tznp8013086
-EOF
-
-EXTRAOPTS="--add-exports java.base/sun.util.locale=ALL-UNNAMED \
- --add-exports java.base/sun.util.locale.provider=ALL-UNNAMED"
-
-${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} -d ${SPIDIR}${FS}dest \
- ${SPIDIR}${FS}src${FS}tznp.java \
- ${SPIDIR}${FS}src${FS}tznp8013086.java
-${COMPILEJAVA}${FS}bin${FS}jar ${TESTTOOLVMOPTS} cvf ${SPIDIR}${FS}tznp.jar -C ${SPIDIR}${FS}dest .
-
-# get the platform default locales
-PLATDEF=`${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRAOPTS} -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale display`
-DEFLANG=`echo ${PLATDEF} | sed -e "s/,.*//"`
-DEFCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"`
-echo "DEFLANG=${DEFLANG}"
-echo "DEFCTRY=${DEFCTRY}"
-PLATDEF=`${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRAOPTS} -classpath ${TESTCLASSES} LocaleProviders getPlatformLocale format`
-DEFFMTLANG=`echo ${PLATDEF} | sed -e "s/,.*//"`
-DEFFMTCTRY=`echo ${PLATDEF} | sed -e "s/.*,//"`
-echo "DEFFMTLANG=${DEFFMTLANG}"
-echo "DEFFMTCTRY=${DEFFMTCTRY}"
-
-runTest()
-{
- RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRAOPTS} -classpath ${TESTCLASSES}${PS}${SPICLASSES} -Djava.locale.providers=$PREFLIST LocaleProviders $METHODNAME $PARAM1 $PARAM2 $PARAM3"
- echo ${RUNCMD}
- ${RUNCMD}
- result=$?
- if [ $result -eq 0 ]
- then
- echo "Execution successful"
- else
- echo "Execution of the test case failed."
- exit $result
- fi
-}
-
-# testing HOST is selected for the default locale, if specified on Windows or MacOSX
-METHODNAME=adapterTest
-PREFLIST=HOST,JRE
-case "$OS" in
- Windows_NT* )
- WINVER=`uname -r`
- if [ "${WINVER}" = "5" ]
- then
- PARAM1=JRE
- else
- PARAM1=HOST
- fi
- ;;
- CYGWIN_NT-6* | CYGWIN_NT-10* | Darwin )
- PARAM1=HOST
- ;;
- * )
- PARAM1=JRE
- ;;
-esac
-PARAM2=${DEFLANG}
-PARAM3=${DEFCTRY}
-runTest
-
-# testing HOST is NOT selected for the non-default locale, if specified
-METHODNAME=adapterTest
-PREFLIST=HOST,JRE
-PARAM1=JRE
-# Try to find the locale JRE supports which is not the platform default (HOST supports that one)
-if [ "${DEFLANG}" != "en" ] && [ "${DEFFMTLANG}" != "en" ]; then
- PARAM2=en
- PARAM3=US
-elif [ "${DEFLANG}" != "ja" ] && [ "${DEFFMTLANG}" != "ja" ]; then
- PARAM2=ja
- PARAM3=JP
-else
- PARAM2=zh
- PARAM3=CN
-fi
-SPICLASSES=
-runTest
-
-# testing SPI is NOT selected, as there is none.
-METHODNAME=adapterTest
-PREFLIST=SPI,JRE
-PARAM1=JRE
-PARAM2=en
-PARAM3=US
-SPICLASSES=
-runTest
-PREFLIST=SPI,COMPAT
-runTest
-
-# testing the order, variaton #1. This assumes en_GB DateFormat data are available both in JRE & CLDR
-METHODNAME=adapterTest
-PREFLIST=CLDR,JRE
-PARAM1=CLDR
-PARAM2=en
-PARAM3=GB
-SPICLASSES=
-runTest
-PREFLIST=CLDR,COMPAT
-runTest
-
-# testing the order, variaton #2. This assumes en_GB DateFormat data are available both in JRE & CLDR
-METHODNAME=adapterTest
-PREFLIST=JRE,CLDR
-PARAM1=JRE
-PARAM2=en
-PARAM3=GB
-SPICLASSES=
-runTest
-PREFLIST=COMPAT,CLDR
-runTest
-
-# testing the order, variaton #3 for non-existent locale in JRE assuming "haw" is not in JRE.
-METHODNAME=adapterTest
-PREFLIST=JRE,CLDR
-PARAM1=CLDR
-PARAM2=haw
-PARAM3=
-SPICLASSES=
-runTest
-PREFLIST=COMPAT,CLDR
-runTest
-
-# testing the order, variaton #4 for the bug 7196799. CLDR's "zh" data should be used in "zh_CN"
-METHODNAME=adapterTest
-PREFLIST=CLDR
-PARAM1=CLDR
-PARAM2=zh
-PARAM3=CN
-SPICLASSES=
-runTest
-
-# testing FALLBACK provider. SPI and invalid one cases.
-METHODNAME=adapterTest
-PREFLIST=SPI
-PARAM1=FALLBACK
-PARAM2=en
-PARAM3=US
-SPICLASSES=
-runTest
-PREFLIST=FOO
-PARAM1=CLDR
-PARAM2=en
-PARAM3=US
-SPICLASSES=
-runTest
-PREFLIST=BAR,SPI
-PARAM1=FALLBACK
-PARAM2=en
-PARAM3=US
-SPICLASSES=
-runTest
-
-# testing 7198834 fix. Only works on Windows Vista or upper.
-METHODNAME=bug7198834Test
-PREFLIST=HOST
-PARAM1=
-PARAM2=
-PARAM3=
-SPICLASSES=
-runTest
-
-# testing 8000245 fix.
-METHODNAME=tzNameTest
-PREFLIST=JRE
-PARAM1=Europe/Moscow
-PARAM2=
-PARAM3=
-SPICLASSES=${SPIDIR}
-runTest
-PREFLIST=COMPAT
-runTest
-
-# testing 8000615 fix.
-METHODNAME=tzNameTest
-PREFLIST=JRE
-PARAM1=America/Los_Angeles
-PARAM2=
-PARAM3=
-SPICLASSES=${SPIDIR}
-runTest
-PREFLIST=COMPAT
-runTest
-
-# testing 8001440 fix.
-METHODNAME=bug8001440Test
-PREFLIST=CLDR
-PARAM1=
-PARAM2=
-PARAM3=
-SPICLASSES=
-runTest
-
-# testing 8010666 fix.
-if [ "${DEFLANG}" = "en" ]
-then
- METHODNAME=bug8010666Test
- PREFLIST=HOST
- PARAM1=
- PARAM2=
- PARAM3=
- SPICLASSES=
- runTest
-fi
-
-# testing 8013086 fix.
-METHODNAME=bug8013086Test
-PREFLIST=JRE,SPI
-PARAM1=ja
-PARAM2=JP
-PARAM3=
-SPICLASSES=${SPIDIR}
-runTest
-PREFLIST=COMPAT,SPI
-runTest
-
-# testing 8013903 fix. (Windows only)
-METHODNAME=bug8013903Test
-PREFLIST=HOST,JRE
-PARAM1=
-PARAM2=
-PARAM3=
-SPICLASSES=
-runTest
-PREFLIST=HOST
-runTest
-PREFLIST=HOST,COMPAT
-runTest
-
-# testing 8027289 fix, if the platform format default is zh_CN
-# this assumes Windows' currency symbol for zh_CN is \u00A5, the yen
-# (yuan) sign.
-if [ "${DEFFMTLANG}" = "zh" ] && [ "${DEFFMTCTRY}" = "CN" ]; then
- METHODNAME=bug8027289Test
- PREFLIST=JRE,HOST
- PARAM1=FFE5
- PARAM2=
- PARAM3=
- SPICLASSES=
- runTest
- PREFLIST=COMPAT,HOST
- runTest
- PREFLIST=HOST
- PARAM1=00A5
- runTest
-fi
-
-exit $result
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/Locale/LocaleProvidersRun.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,170 @@
+/*
+ * Copyright (c) 2012, 2018, 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 6336885 7196799 7197573 7198834 8000245 8000615 8001440 8008577
+ * 8010666 8013086 8013233 8013903 8015960 8028771 8054482 8062006
+ * 8150432
+ * @summary tests for "java.locale.providers" system property
+ * @library /test/lib
+ * @build LocaleProviders
+ * providersrc.spi.src.tznp
+ * providersrc.spi.src.tznp8013086
+ * @modules java.base/sun.util.locale
+ * java.base/sun.util.locale.provider
+ * @run main LocaleProvidersRun
+ */
+
+import java.util.Locale;
+
+import jdk.test.lib.JDKToolLauncher;
+import jdk.test.lib.process.ProcessTools;
+import jdk.test.lib.Utils;
+
+public class LocaleProvidersRun {
+ public static void main(String[] args) throws Throwable {
+ //get the platform default locales
+ Locale platDefLoc = Locale.getDefault(Locale.Category.DISPLAY);
+ String defLang = platDefLoc.getLanguage();
+ String defCtry = platDefLoc.getCountry();
+ System.out.println("DEFLANG = " + defLang);
+ System.out.println("DEFCTRY = " + defCtry);
+
+ Locale platDefFormat = Locale.getDefault(Locale.Category.FORMAT);
+ String defFmtLang = platDefFormat.getLanguage();
+ String defFmtCtry = platDefFormat.getCountry();
+ System.out.println("DEFFMTLANG = " + defFmtLang);
+ System.out.println("DEFFMTCTRY = " + defFmtCtry);
+
+ //Run Test
+ //testing HOST is selected for the default locale,
+ // if specified on Windows or MacOSX
+ String osName = System.getProperty("os.name");
+ String param1 = "JRE";
+ if(osName.startsWith("Windows") || osName.startsWith("Mac")) {
+ param1 = "HOST";
+ }
+ testRun("HOST,JRE", "adapterTest", param1, defLang, defCtry);
+
+ //testing HOST is NOT selected for the non-default locale, if specified
+ //Try to find the locale JRE supports which is not the platform default
+ // (HOST supports that one)
+ String param2;
+ String param3;
+ if (!defLang.equals("en") && !defFmtLang.equals("en")){
+ param2 = "en";
+ param3 = "US";
+ } else if(!defLang.equals("ja") && !defFmtLang.equals("ja")){
+ param2 = "ja";
+ param3 = "JP";
+ } else {
+ param2 = "zh";
+ param3 = "CN";
+ }
+ testRun("HOST,JRE", "adapterTest", "JRE", param2, param3);
+
+ //testing SPI is NOT selected, as there is none.
+ testRun("SPI,JRE", "adapterTest", "JRE", "en", "US");
+ testRun("SPI,COMPAT", "adapterTest", "JRE", "en", "US");
+
+ //testing the order, variant #1. This assumes en_GB DateFormat data are
+ // available both in JRE & CLDR
+ testRun("CLDR,JRE", "adapterTest", "CLDR", "en", "GB");
+ testRun("CLDR,COMPAT", "adapterTest", "CLDR", "en", "GB");
+
+ //testing the order, variant #2. This assumes en_GB DateFormat data are
+ // available both in JRE & CLDR
+ testRun("JRE,CLDR", "adapterTest", "JRE", "en", "GB");
+ testRun("COMPAT,CLDR", "adapterTest", "JRE", "en", "GB");
+
+ //testing the order, variant #3 for non-existent locale in JRE
+ // assuming "haw" is not in JRE.
+ testRun("JRE,CLDR", "adapterTest", "CLDR", "haw", "");
+ testRun("COMPAT,CLDR", "adapterTest", "CLDR", "haw", "");
+
+ //testing the order, variant #4 for the bug 7196799. CLDR's "zh" data
+ // should be used in "zh_CN"
+ testRun("CLDR", "adapterTest", "CLDR", "zh", "CN");
+
+ //testing FALLBACK provider. SPI and invalid one cases.
+ testRun("SPI", "adapterTest", "FALLBACK", "en", "US");
+ testRun("FOO", "adapterTest", "CLDR", "en", "US");
+ testRun("BAR,SPI", "adapterTest", "FALLBACK", "en", "US");
+
+ //testing 7198834 fix.
+ testRun("HOST", "bug7198834Test", "", "", "");
+
+ //testing 8000245 fix.
+ testRun("JRE", "tzNameTest", "Europe/Moscow", "", "");
+ testRun("COMPAT", "tzNameTest", "Europe/Moscow", "", "");
+
+ //testing 8000615 fix.
+ testRun("JRE", "tzNameTest", "America/Los_Angeles", "", "");
+ testRun("COMPAT", "tzNameTest", "America/Los_Angeles", "", "");
+
+ //testing 8001440 fix.
+ testRun("CLDR", "bug8001440Test", "", "", "");
+
+ //testing 8010666 fix.
+ if (defLang.equals("en")) {
+ testRun("HOST", "bug8010666Test", "", "", "");
+ }
+
+ //testing 8013086 fix.
+ testRun("JRE,SPI", "bug8013086Test", "ja", "JP", "");
+ testRun("COMPAT,SPI", "bug8013086Test", "ja", "JP", "");
+
+ //testing 8013903 fix. (Windows only)
+ testRun("HOST,JRE", "bug8013903Test", "", "", "");
+ testRun("HOST", "bug8013903Test", "", "", "");
+ testRun("HOST,COMPAT", "bug8013903Test", "", "", "");
+
+ //testing 8027289 fix, if the platform format default is zh_CN
+ // this assumes Windows' currency symbol for zh_CN is \u00A5, the yen
+ // (yuan) sign.
+ if (!defLang.equals("en") && !defCtry.equals("CN")){
+ testRun("JRE,HOST", "bug8027289Test", "FFE5", "", "");
+ testRun("COMPAT,HOST", "bug8027289Test", "FFE5", "", "");
+ testRun("HOST", "bug8027289Test", "00A5", "", "");
+ }
+ }
+
+ private static void testRun(String prefList, String methodName,
+ String param1, String param2, String param3) throws Throwable{
+ JDKToolLauncher launcher = JDKToolLauncher.createUsingTestJDK("java");
+ launcher.addToolArg("-cp")
+ .addToolArg(Utils.TEST_CLASS_PATH)
+ .addToolArg("-Djava.locale.providers=" + prefList)
+ .addToolArg("LocaleProviders")
+ .addToolArg(methodName)
+ .addToolArg(param1)
+ .addToolArg(param2)
+ .addToolArg(param3);
+ int exitCode = ProcessTools.executeCommand(launcher.getCommand())
+ .getExitValue();
+ if (exitCode != 0) {
+ throw new RuntimeException("Unexpected exit code: " + exitCode);
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/Locale/providersrc/spi/dest/META-INF/services/java.util.spi.TimeZoneNameProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,2 @@
+tznp
+tznp8013086
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/Locale/providersrc/spi/src/tznp.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,39 @@
+/*
+ * Copyright (c) 2012, 2018, 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.
+ */
+
+package providersrc.spi.src;
+
+import java.util.spi.TimeZoneNameProvider;
+import java.util.Locale;
+
+public class tznp extends TimeZoneNameProvider {
+ public String getDisplayName(String ID, boolean daylight, int style,
+ Locale locale) {
+ return "tznp";
+ }
+
+ public Locale[] getAvailableLocales() {
+ Locale[] locales = {Locale.US};
+ return locales;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/Locale/providersrc/spi/src/tznp8013086.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,43 @@
+/*
+ * Copyright (c) 2012, 2018, 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.
+ */
+
+package providersrc.spi.src;
+import java.util.spi.TimeZoneNameProvider;
+import java.util.Locale;
+import java.util.TimeZone;
+
+public class tznp8013086 extends TimeZoneNameProvider {
+ public String getDisplayName(String ID, boolean daylight, int style,
+ Locale locale) {
+ if (!daylight && style == TimeZone.LONG) {
+ return "tznp8013086";
+ } else {
+ return null;
+ }
+ }
+
+ public Locale[] getAvailableLocales() {
+ Locale[] locales = {Locale.JAPAN};
+ return locales;
+ }
+}
--- a/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,27 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8062588 8165804 8210406
+ * @summary BreakIteratorProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI BreakIteratorProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
+import java.text.BreakIterator;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.foo.BreakIteratorProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class BreakIteratorProviderTest extends ProviderTest {
- com.foo.BreakIteratorProviderImpl bip = new com.foo.BreakIteratorProviderImpl();
+ BreakIteratorProviderImpl bip = new BreakIteratorProviderImpl();
List<Locale> availloc = Arrays.asList(BreakIterator.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(bip.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getBreakIteratorProvider().getAvailableLocales());
- private static final int CHARACTER_INDEX = 0;
- private static final int WORD_INDEX = 1;
- private static final int LINE_INDEX = 2;
- private static final int SENTENCE_INDEX = 3;
-
public static void main(String[] s) {
new BreakIteratorProviderTest();
}
@@ -98,4 +112,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/BreakIteratorProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2016, 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 4052440 8062588 8165804
-# @summary BreakIteratorProvider tests
-# @run shell ExecTest.sh foo BreakIteratorProviderTest
--- a/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -20,16 +20,22 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 7058207 8000986 8062588 8210406
+ * @summary CalendarDataProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI CalendarDataProviderTest
*/
-import java.text.*;
-import java.util.*;
-import static java.util.Calendar.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
-import com.bar.CalendarDataProviderImpl;
+import java.util.Calendar;
+import java.util.Locale;
+
+import static java.util.Calendar.WEDNESDAY;
/**
* Test case for CalendarDataProvider.
@@ -51,7 +57,6 @@
void test() {
Locale kids = new Locale("ja", "JP", "kids"); // test provider's supported locale
Calendar kcal = Calendar.getInstance(kids);
- Calendar jcal = Calendar.getInstance(Locale.JAPAN);
// check the week parameters
checkResult("firstDayOfWeek", kcal.getFirstDayOfWeek(), WEDNESDAY);
@@ -64,4 +69,4 @@
throw new RuntimeException(s);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/CalendarDataProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 7058207 8000986 8062588
-# @summary CalendarDataProvider tests
-# @run shell ExecTest.sh bar CalendarDataProviderTest
--- a/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2012, 2018, 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
@@ -20,17 +20,37 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 8000986 8062588 8210406
+ * @summary CalendarNameProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI CalendarNameProviderTest
*/
-import java.text.*;
-import java.util.*;
-import static java.util.Calendar.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.util.Calendar;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+
import com.bar.CalendarNameProviderImpl;
+import static java.util.Calendar.ALL_STYLES;
+import static java.util.Calendar.DAY_OF_MONTH;
+import static java.util.Calendar.DAY_OF_WEEK;
+import static java.util.Calendar.DECEMBER;
+import static java.util.Calendar.HOUR_OF_DAY;
+import static java.util.Calendar.JANUARY;
+import static java.util.Calendar.LONG_STANDALONE;
+import static java.util.Calendar.MONTH;
+import static java.util.Calendar.SATURDAY;
+import static java.util.Calendar.SHORT_STANDALONE;
+import static java.util.Calendar.SUNDAY;
+
/**
* Test case for CalendarNameProvider.
*
@@ -101,4 +121,4 @@
throw new RuntimeException(s);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/CalendarNameProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,27 +0,0 @@
-#
-# Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 8000986 8062588
-# @summary CalendarNameProvider tests
-# @run shell ExecTest.sh bar CalendarNameProviderTest
--- a/test/jdk/java/util/PluggableLocale/ClasspathTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/ClasspathTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,13 +20,21 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 6388652 8062588 8210406
+ * @summary Checks whether providers can be loaded from classpath.
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI ClasspathTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.resources.*;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
public class ClasspathTest {
@@ -45,4 +53,4 @@
throw new RuntimeException("LSS providers were NOT loaded from the class path.");
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/ClasspathTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 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 6388652 8062588
-# @summary Checks whether providers can be loaded from classpath.
-# @run shell ExecTest.sh bar ClasspathTest
--- a/test/jdk/java/util/PluggableLocale/CollatorProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/CollatorProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,18 +20,40 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8062588 8210406
+ * @summary CollatorProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI CollatorProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.Collator;
+import java.text.ParseException;
+import java.text.RuleBasedCollator;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.foo.CollatorProviderImpl;
+
+import sun.util.locale.provider.AvailableLanguageTags;
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class CollatorProviderTest extends ProviderTest {
- com.foo.CollatorProviderImpl cp = new com.foo.CollatorProviderImpl();
+ CollatorProviderImpl cp = new CollatorProviderImpl();
List<Locale> availloc = Arrays.asList(Collator.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(cp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -94,4 +116,4 @@
checkValidity(target, jresResult, providersResult, result, jreSupportsLocale);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/CollatorProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 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 4052440 8062588
-# @summary CollatorProvider tests
-# @run shell ExecTest.sh foo CollatorProviderTest
--- a/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,14 +20,36 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 7199750 8000997 8062588 8210406
+ * @summary CurrencyNameProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI CurrencyNameProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.ParseException;
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.Currency;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+import com.bar.CurrencyNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl2;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
+import sun.util.resources.OpenListResourceBundle;
public class CurrencyNameProviderTest extends ProviderTest {
@@ -47,8 +69,8 @@
}
void test1() {
- com.bar.CurrencyNameProviderImpl cnp = new com.bar.CurrencyNameProviderImpl();
- com.bar.CurrencyNameProviderImpl2 cnp2 = new com.bar.CurrencyNameProviderImpl2();
+ CurrencyNameProviderImpl cnp = new CurrencyNameProviderImpl();
+ CurrencyNameProviderImpl2 cnp2 = new CurrencyNameProviderImpl2();
Locale[] availloc = Locale.getAvailableLocales();
Locale[] testloc = availloc.clone();
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getCurrencyNameProvider().getAvailableLocales());
@@ -163,4 +185,4 @@
Locale.setDefault(defloc);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/CurrencyNameProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 4052440 7199750 8000997 8062588
-# @summary CurrencyNameProvider tests
-# @run shell ExecTest.sh bar CurrencyNameProviderTest
--- a/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,18 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 7003643 8062588 8210406
+ * @summary DateFormatProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DateFormat;
+import java.text.Format;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.foo.DateFormatProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class DateFormatProviderTest extends ProviderTest {
- com.foo.DateFormatProviderImpl dfp = new com.foo.DateFormatProviderImpl();
+ DateFormatProviderImpl dfp = new DateFormatProviderImpl();
List<Locale> availloc = Arrays.asList(DateFormat.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -181,4 +204,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/DateFormatProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2010, 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 4052440 7003643 8062588
-# @summary DateFormatProvider tests
-# @run shell ExecTest.sh foo DateFormatProviderTest
--- a/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,18 +20,37 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 7200341 8062588 8210406
+ * @summary DateFormatSymbolsProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DateFormatSymbolsProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DateFormatSymbols;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.ResourceBundle;
+import java.util.Set;
+
+import com.foo.DateFormatSymbolsProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
public class DateFormatSymbolsProviderTest extends ProviderTest {
- com.foo.DateFormatSymbolsProviderImpl dfsp = new com.foo.DateFormatSymbolsProviderImpl();
+ DateFormatSymbolsProviderImpl dfsp = new DateFormatSymbolsProviderImpl();
List<Locale> availloc = Arrays.asList(DateFormatSymbols.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfsp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -137,4 +156,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/DateFormatSymbolsProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 4052440 7200341 8062588
-# @summary DateFormatSymbolsProvider tests
-# @run shell ExecTest.sh foo DateFormatSymbolsProviderTest
--- a/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,18 +20,33 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8062588 8210406
+ * @summary DecimalFormatSymbolsProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI DecimalFormatSymbolsProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DecimalFormatSymbols;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
+
+import com.foo.DecimalFormatSymbolsProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
public class DecimalFormatSymbolsProviderTest extends ProviderTest {
- com.foo.DecimalFormatSymbolsProviderImpl dfsp = new com.foo.DecimalFormatSymbolsProviderImpl();
+ DecimalFormatSymbolsProviderImpl dfsp = new DecimalFormatSymbolsProviderImpl();
List<Locale> availloc = Arrays.asList(DecimalFormatSymbols.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(dfsp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -92,4 +107,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/DecimalFormatSymbolsProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 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 4052440 8062588
-# @summary DecimalFormatSymbolsProvider tests
-# @run shell ExecTest.sh foo DecimalFormatSymbolsProviderTest
--- a/test/jdk/java/util/PluggableLocale/ExecTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,145 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2015, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# 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.
-#
-#
-#
-#
-# This script is the actual launcher of each locale service provider test.
-# fooprovider.jar contains localized object providers and barprovider.jar
-# contains localized name providers. This way, we can test providers that
-# can relate to each other (such as, DateFormatSymbolsProvider and
-# TimeZoneNameProvider) separately.
-#
-# Parameters:
-# providersToTest: [foo|bar|foobar]
-# java class name: <class name>
-# java security policy file: (Optional. Installs security manager if exists)
-
-if [ "${TESTSRC}" = "" ]
-then
- echo "TESTSRC not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTSRC=${TESTSRC}"
-if [ "${TESTJAVA}" = "" ]
-then
- echo "TESTJAVA not set. Test cannot execute. Failed."
- exit 1
-fi
-if [ "${COMPILEJAVA}" = "" ]
-then
- COMPILEJAVA="${TESTJAVA}"
-fi
-echo "TESTJAVA=${TESTJAVA}"
-if [ "${TESTCLASSES}" = "" ]
-then
- echo "TESTCLASSES not set. Test cannot execute. Failed."
- exit 1
-fi
-echo "TESTCLASSES=${TESTCLASSES}"
-echo "CLASSPATH=${CLASSPATH}"
-
-# set platform-dependent variables
-OS=`uname -s`
-case "$OS" in
- SunOS | Linux | Darwin | AIX )
- PS=":"
- FS="/"
- ;;
- Windows* | CYGWIN* )
- PS=";"
- FS="\\"
- ;;
- * )
- echo "Unrecognized system!"
- exit 1;
- ;;
-esac
-
-case "$1" in
- "foo" )
- cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
- CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar"
- ;;
- "bar" )
- cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
- CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
- ;;
- "foobar" )
- cp ${TESTSRC}${FS}fooprovider.jar ${TESTCLASSES}
- cp ${TESTSRC}${FS}barprovider.jar ${TESTCLASSES}
- CLASSPATHARG=".${PS}${TESTSRC}${PS}${TESTSRC}${FS}fooprovider.jar${PS}${TESTSRC}${PS}${TESTSRC}${FS}barprovider.jar"
- ;;
-esac
-
-
-EXTRA_OPTS="--add-exports java.base/sun.util.locale.provider=ALL-UNNAMED \
- --add-exports java.base/sun.util.resources=ALL-UNNAMED"
-
-# compile
-cp ${TESTSRC}${FS}ProviderTest.java .
-cp ${TESTSRC}${FS}$2.java .
-COMPILE="${COMPILEJAVA}${FS}bin${FS}javac ${TESTJAVACOPTS} ${TESTTOOLVMOPTS} ${EXTRA_OPTS} \
- -XDignore.symbol.file -d . -classpath ${CLASSPATHARG} $2.java"
-echo ${COMPILE}
-${COMPILE}
-result=$?
-
-if [ $result -eq 0 ]
-then
- echo "Compilation of the test case was successful."
-else
- echo "Compilation of the test case failed."
- # Cleanup
- rm -f ${TESTCLASSES}${FS}$2*.class
- rm -f ${TESTCLASSES}${FS}fooprovider.jar
- rm -f ${TESTCLASSES}${FS}barprovider.jar
- exit $result
-fi
-
-# security options
-if [ "$3" != "" ]
-then
- SECURITYOPTS="-Djava.security.manager -Djava.security.policy=${TESTSRC}${FS}$3"
-fi
-
-# run
-RUNCMD="${TESTJAVA}${FS}bin${FS}java ${TESTVMOPTS} ${EXTRA_OPTS} ${SECURITYOPTS} -classpath ${CLASSPATHARG} -Djava.locale.providers=JRE,SPI $2 "
-
-echo ${RUNCMD}
-${RUNCMD}
-result=$?
-
-if [ $result -eq 0 ]
-then
- echo "Execution successful"
-else
- echo "Execution of the test case failed."
-fi
-
-# Cleanup
-rm -f ${TESTCLASSES}${FS}$2*.class
-rm -f ${TESTCLASSES}${FS}fooprovider.jar
-rm -f ${TESTCLASSES}${FS}barprovider.jar
-
-exit $result
--- a/test/jdk/java/util/PluggableLocale/GenericTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/GenericTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,30 +20,58 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8062588 8210406
+ * @summary Generic tests for the pluggable locales feature
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI GenericTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
+import java.util.Arrays;
+import java.util.HashSet;
+import java.util.Locale;
+import java.util.Set;
+
+import com.bar.CalendarDataProviderImpl;
+import com.bar.CalendarNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl2;
+import com.bar.GenericTimeZoneNameProviderImpl;
+import com.bar.LocaleNameProviderImpl;
+import com.bar.TimeZoneNameProviderImpl;
+import com.foo.BreakIteratorProviderImpl;
+import com.foo.CollatorProviderImpl;
+import com.foo.DateFormatProviderImpl;
+import com.foo.DateFormatSymbolsProviderImpl;
+import com.foo.DecimalFormatSymbolsProviderImpl;
+import com.foo.NumberFormatProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
public class GenericTest {
// test providers
- com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl();
- com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl();
- com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl();
- com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl();
- com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl();
- com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl();
- com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl();
- com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2();
- com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl();
- com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl();
- com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl();
- com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl();
- com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl();
+ BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl();
+ CollatorProviderImpl collatorP = new CollatorProviderImpl();
+ DateFormatProviderImpl dateFP = new DateFormatProviderImpl();
+ DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl();
+ DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl();
+ NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl();
+ CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl();
+ CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2();
+ LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl();
+ TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl();
+ GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl();
+ CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl();
+ CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl();
public static void main(String[] s) {
new GenericTest();
@@ -108,4 +136,4 @@
s2.addAll(s1);
return s2.toString();
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/GenericTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 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 4052440 8062588
-# @summary Generic tests for the pluggable locales feature
-# @run shell ExecTest.sh foobar GenericTest
--- a/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,14 +20,30 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8000273 8062588 8210406
+ * @summary LocaleNameProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI LocaleNameProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.util.Arrays;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+
+import com.bar.LocaleNameProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
+import sun.util.resources.OpenListResourceBundle;
public class LocaleNameProviderTest extends ProviderTest {
@@ -41,7 +57,7 @@
}
void checkAvailLocValidityTest() {
- com.bar.LocaleNameProviderImpl lnp = new com.bar.LocaleNameProviderImpl();
+ LocaleNameProviderImpl lnp = new LocaleNameProviderImpl();
Locale[] availloc = Locale.getAvailableLocales();
Locale[] testloc = availloc.clone();
List<Locale> jreimplloc = Arrays.asList(LocaleProviderAdapter.forJRE().getLocaleNameProvider().getAvailableLocales());
@@ -121,10 +137,10 @@
if (YY_suffix.getVariant().equals(retVrnt)) {
System.out.println(message);
return;
-}
+ }
message = "variantFallbackTest() failed. Returned variant: "+retVrnt;
}
throw new RuntimeException(message);
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/LocaleNameProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 4052440 8000273 8062588
-# @summary LocaleNameProvider tests
-# @run shell ExecTest.sh bar LocaleNameProviderTest
--- a/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,20 +20,38 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 7003643 8062588 8210406
+ * @summary NumberFormatProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/fooprovider
+ * @modules java.base/sun.util.locale.provider
+ * @build com.foobar.Utils
+ * com.foo.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI NumberFormatProviderTest
*/
-import java.text.*;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.text.DecimalFormat;
+import java.text.DecimalFormatSymbols;
+import java.text.MessageFormat;
+import java.text.NumberFormat;
+import java.util.Arrays;
+import java.util.Currency;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Locale;
+import java.util.Set;
import com.foo.FooNumberFormat;
+import com.foo.NumberFormatProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
public class NumberFormatProviderTest extends ProviderTest {
- com.foo.NumberFormatProviderImpl nfp = new com.foo.NumberFormatProviderImpl();
+ NumberFormatProviderImpl nfp = new NumberFormatProviderImpl();
List<Locale> availloc = Arrays.asList(NumberFormat.getAvailableLocales());
List<Locale> providerloc = Arrays.asList(nfp.getAvailableLocales());
List<Locale> jreloc = Arrays.asList(LocaleProviderAdapter.forJRE().getAvailableLocales());
@@ -201,4 +219,4 @@
}
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/NumberFormatProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2010, 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 4052440 7003643 8062588
-# @summary NumberFormatProvider tests
-# @run shell ExecTest.sh foo NumberFormatProviderTest
--- a/test/jdk/java/util/PluggableLocale/PermissionTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/PermissionTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, 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
@@ -20,25 +20,59 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 8075545 8210406
+ * @summary Check whether RuntimePermission("localeServiceProvider") is
+ * handled correctly.
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * providersrc/fooprovider
+ * @build com.foobar.Utils
+ * com.bar.*
+ * com.foo.*
+ * @run main/othervm PermissionTest
+ * @run main/othervm/fail/java.security.policy=dummy.policy
+ * -Djava.security.manager
+ * -Djava.locale.providers=JRE,SPI
+ * PermissionTest
+ * @run main/othervm/java.security.policy=localeServiceProvider.policy
+ * -Djava.security.manager
+ * -Djava.locale.providers=JRE,SPI
+ * PermissionTest
*/
+
+import com.bar.CalendarDataProviderImpl;
+import com.bar.CalendarNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl;
+import com.bar.CurrencyNameProviderImpl2;
+import com.bar.GenericTimeZoneNameProviderImpl;
+import com.bar.LocaleNameProviderImpl;
+import com.bar.TimeZoneNameProviderImpl;
+import com.foo.BreakIteratorProviderImpl;
+import com.foo.CollatorProviderImpl;
+import com.foo.DateFormatProviderImpl;
+import com.foo.DateFormatSymbolsProviderImpl;
+import com.foo.DecimalFormatSymbolsProviderImpl;
+import com.foo.NumberFormatProviderImpl;
+
public class PermissionTest{
// Make sure provider impls can be instantiated under a security manager.ZZ
- com.foo.BreakIteratorProviderImpl breakIP = new com.foo.BreakIteratorProviderImpl();
- com.foo.CollatorProviderImpl collatorP = new com.foo.CollatorProviderImpl();
- com.foo.DateFormatProviderImpl dateFP = new com.foo.DateFormatProviderImpl();
- com.foo.DateFormatSymbolsProviderImpl dateFSP = new com.foo.DateFormatSymbolsProviderImpl();
- com.foo.DecimalFormatSymbolsProviderImpl decimalFSP = new com.foo.DecimalFormatSymbolsProviderImpl();
- com.foo.NumberFormatProviderImpl numberFP = new com.foo.NumberFormatProviderImpl();
- com.bar.CurrencyNameProviderImpl currencyNP = new com.bar.CurrencyNameProviderImpl();
- com.bar.CurrencyNameProviderImpl2 currencyNP2 = new com.bar.CurrencyNameProviderImpl2();
- com.bar.LocaleNameProviderImpl localeNP = new com.bar.LocaleNameProviderImpl();
- com.bar.TimeZoneNameProviderImpl tzNP = new com.bar.TimeZoneNameProviderImpl();
- com.bar.GenericTimeZoneNameProviderImpl tzGenNP = new com.bar.GenericTimeZoneNameProviderImpl();
- com.bar.CalendarDataProviderImpl calDataP = new com.bar.CalendarDataProviderImpl();
- com.bar.CalendarNameProviderImpl calNameP = new com.bar.CalendarNameProviderImpl();
+ BreakIteratorProviderImpl breakIP = new BreakIteratorProviderImpl();
+ CollatorProviderImpl collatorP = new CollatorProviderImpl();
+ DateFormatProviderImpl dateFP = new DateFormatProviderImpl();
+ DateFormatSymbolsProviderImpl dateFSP = new DateFormatSymbolsProviderImpl();
+ DecimalFormatSymbolsProviderImpl decimalFSP = new DecimalFormatSymbolsProviderImpl();
+ NumberFormatProviderImpl numberFP = new NumberFormatProviderImpl();
+ CurrencyNameProviderImpl currencyNP = new CurrencyNameProviderImpl();
+ CurrencyNameProviderImpl2 currencyNP2 = new CurrencyNameProviderImpl2();
+ LocaleNameProviderImpl localeNP = new LocaleNameProviderImpl();
+ TimeZoneNameProviderImpl tzNP = new TimeZoneNameProviderImpl();
+ GenericTimeZoneNameProviderImpl tzGenNP = new GenericTimeZoneNameProviderImpl();
+ CalendarDataProviderImpl calDataP = new CalendarDataProviderImpl();
+ CalendarNameProviderImpl calNameP = new CalendarNameProviderImpl();
public static void main(String[] s) {
new PermissionTest();
--- a/test/jdk/java/util/PluggableLocale/PermissionTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,31 +0,0 @@
-#!/bin/sh
-#
-# 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 8075545
-# @summary Check whether RuntimePermission("localeServiceProvider") is
-# handled correctly
-# @run shell ExecTest.sh foobar PermissionTest
-# @run shell/fail ExecTest.sh foobar PermissionTest dummy
-# @run shell ExecTest.sh foobar PermissionTest localeServiceProvider.policy
--- a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2007, 2013, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2007, 2018, 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
@@ -20,19 +20,41 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
+
/*
- *
+ * @test
+ * @bug 4052440 8003267 8062588 8210406
+ * @summary TimeZoneNameProvider tests
+ * @library providersrc/foobarutils
+ * providersrc/barprovider
+ * @modules java.base/sun.util.locale.provider
+ * java.base/sun.util.resources
+ * @build com.foobar.Utils
+ * com.bar.*
+ * @run main/othervm -Djava.locale.providers=JRE,SPI TimeZoneNameProviderTest
*/
-import java.text.*;
+import java.text.DateFormatSymbols;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
import java.time.format.TextStyle;
-import java.util.*;
-import sun.util.locale.provider.*;
-import sun.util.resources.*;
+import java.util.Arrays;
+import java.util.Calendar;
+import java.util.Date;
+import java.util.List;
+import java.util.Locale;
+import java.util.MissingResourceException;
+import java.util.TimeZone;
+
+import com.bar.TimeZoneNameProviderImpl;
+
+import sun.util.locale.provider.LocaleProviderAdapter;
+import sun.util.locale.provider.ResourceBundleBasedAdapter;
+import sun.util.resources.OpenListResourceBundle;
public class TimeZoneNameProviderTest extends ProviderTest {
- com.bar.TimeZoneNameProviderImpl tznp = new com.bar.TimeZoneNameProviderImpl();
+ TimeZoneNameProviderImpl tznp = new TimeZoneNameProviderImpl();
public static void main(String[] s) {
new TimeZoneNameProviderTest();
@@ -248,4 +270,4 @@
throw new RuntimeException("Generic name fallback failed. got: "+generic);
}
}
-}
+}
\ No newline at end of file
--- a/test/jdk/java/util/PluggableLocale/TimeZoneNameProviderTest.sh Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#!/bin/sh
-#
-# Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# This code is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 only, as
-# published by the Free Software Foundation.
-#
-# 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 4052440 8003267 8062588
-# @summary TimeZoneNameProvider tests
-# @run shell ExecTest.sh bar TimeZoneNameProviderTest
Binary file test/jdk/java/util/PluggableLocale/barprovider.jar has changed
Binary file test/jdk/java/util/PluggableLocale/fooprovider.jar has changed
--- a/test/jdk/java/util/PluggableLocale/providersrc/BreakIteratorProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,140 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-import com.foobar.Utils;
-
-public class BreakIteratorProviderImpl extends BreakIteratorProvider {
-
- static Locale[] avail = {
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("xx", "YY")};
-
- static String[] dialect = {
- "\u3067\u3059\u3002",
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "-xx-YY"
- };
-
- static enum Type {CHARACTER, LINE, SENTENCE, WORD};
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public BreakIterator getCharacterInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooBreakIterator(Type.CHARACTER, i);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public BreakIterator getLineInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooBreakIterator(Type.LINE, i);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public BreakIterator getSentenceInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooBreakIterator(Type.SENTENCE, i);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public BreakIterator getWordInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooBreakIterator(Type.WORD, i);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- // dummy implementation
- class FooBreakIterator extends BreakIterator {
- public FooBreakIterator(Type t, int index) {
- super();
- }
-
- public int current() {
- return 0;
- }
-
- public int first() {
- return 0;
- }
-
- public int following(int offset) {
- return 0;
- }
-
- public CharacterIterator getText() {
- return null;
- }
-
- public boolean isBoundary(int offset) {
- return true;
- }
-
- public int last() {
- return 0;
- }
-
- public int next() {
- return 0;
- }
-
- public int next(int n) {
- return 0;
- }
-
- public int preceding(int offset) {
- return 0;
- }
-
- public int previous() {
- return 0;
- }
-
- public void setText(CharacterIterator ci) {
- }
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CalendarDataProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,54 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.bar;
-
-import com.foobar.Utils;
-import java.util.Arrays;
-import static java.util.Calendar.*;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.spi.CalendarDataProvider;
-
-public class CalendarDataProviderImpl extends CalendarDataProvider {
- static final char FULLWIDTH_ZERO = '\uff10';
- static final Locale[] avail = {
- new Locale("ja", "JP", "kids"),
- };
-
- @Override
- public int getFirstDayOfWeek(Locale locale) {
- return WEDNESDAY;
- }
-
- @Override
- public int getMinimalDaysInFirstWeek(Locale locale) {
- return 7;
- }
-
- @Override
- public Locale[] getAvailableLocales() {
- return avail.clone();
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CalendarNameProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,102 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.bar;
-
-import com.foobar.Utils;
-import java.util.Arrays;
-import static java.util.Calendar.*;
-import java.util.HashMap;
-import java.util.Locale;
-import java.util.Map;
-import java.util.spi.CalendarNameProvider;
-
-public class CalendarNameProviderImpl extends CalendarNameProvider {
- static final char FULLWIDTH_ZERO = '\uff10';
- static final Locale[] avail = {
- new Locale("ja", "JP", "kids"),
- };
-
- @Override
- public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) {
- if (calendarType == null || locale == null) {
- throw new NullPointerException();
- }
- if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
- throw new IllegalArgumentException("locale is not one of available locales: "+ locale);
- }
- if (field != MONTH) {
- return null;
- }
- return toMonthName(value + 1, style);
- }
-
- @Override
- public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) {
- if (calendarType == null || locale == null) {
- throw new NullPointerException();
- }
- if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
- throw new IllegalArgumentException("locale is not one of available locales: " + locale);
- }
- if (field != MONTH) {
- return null;
- }
- Map<String, Integer> map = new HashMap<>();
- if (style == LONG_STANDALONE) {
- style = LONG;
- } else if (style == SHORT_STANDALONE) {
- style = SHORT;
- }
- for (int month = JANUARY; month <= DECEMBER; month++) {
- if (style == ALL_STYLES || style == LONG) {
- map.put(toMonthName(month + 1, LONG), month);
- }
- if (style == ALL_STYLES || style == SHORT) {
- map.put(toMonthName(month + 1, SHORT), month);
- }
- }
- return map;
- }
-
- @Override
- public Locale[] getAvailableLocales() {
- return avail.clone();
- }
-
- // month is 1-based.
- public static String toMonthName(int month, int style) {
- StringBuilder sb = new StringBuilder();
- if (month >= 10) {
- sb.append((char)(FULLWIDTH_ZERO + 1));
- sb.appendCodePoint((char)(FULLWIDTH_ZERO + (month % 10)));
- } else {
- sb.appendCodePoint((char)(FULLWIDTH_ZERO + month));
- }
- if (style == SHORT || style == SHORT_STANDALONE) {
- return sb.toString(); // full-width digit(s)
- }
- sb.append("\u304c\u3064"); // + "gatsu" in Hiragana
- return sb.toString();
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CollatorProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class CollatorProviderImpl extends CollatorProvider {
-
- static Locale[] avail = {
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("xx", "YY", "ZZZZ")};
-
- static String[] dialect = {
- "\u3067\u3059\u3002",
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "-xx-YY-ZZZZ"
- };
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public Collator getInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- RuleBasedCollator ja = (RuleBasedCollator)Collator.getInstance(Locale.JAPANESE);
- try {
- return new RuleBasedCollator(ja.getRules()+"& Z < "+dialect[i]);
- } catch (ParseException pe) {
-System.err.println(pe+ja.getRules()+"& Z < "+dialect[i]);
- return ja;
- }
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,82 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-/*
- *
- */
-
-package com.bar;
-
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-public class CurrencyNameProviderImpl extends CurrencyNameProvider {
- static Locale[] avail = {new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- Locale.JAPAN,
- new Locale("xx")};
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public String getSymbol(String c, Locale locale) {
- if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- if (c.equals("JPY")) {
- if (Utils.supportsLocale(avail[0], locale)) {
- return "\u5186\u3084\u3002";
- } else if (Utils.supportsLocale(avail[1], locale)) {
- return "\u5186\u3069\u3059\u3002";
- } else if (Utils.supportsLocale(avail[2], locale)) {
- return "\u5186\u3067\u3059\u3002";
- } else if (Utils.supportsLocale(avail[3], locale)) {
- return "\u5186\u3070\u3064\u3070\u3064\u3002";
- }
- }
- return null;
- }
-
- @Override
- public String getDisplayName(String c, Locale locale) {
- if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- if (c.equals("JPY")) {
- if (Utils.supportsLocale(avail[0], locale)) {
- return "\u65e5\u672c\u5186\u3084\u3002";
- } else if (Utils.supportsLocale(avail[1], locale)) {
- return "\u65e5\u672c\u5186\u3069\u3059\u3002";
- } else if (Utils.supportsLocale(avail[2], locale)) {
- return "\u65e5\u672c\u5186\u3067\u3059\u3002";
- } else if (Utils.supportsLocale(avail[3], locale)) {
- return "\u65e5\u672c\u5186\u3070\u3064\u3070\u3064\u3002";
- }
- }
- return null;
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/CurrencyNameProviderImpl2.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,72 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.bar;
-
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
- static Locale[] avail = {new Locale("ja", "JP", "tokyo"),
- new Locale("ja", "JP", "osaka"), };
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- @Override
- public String getSymbol(String c, Locale locale) {
- if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- if (c.equals("JPY")) {
- if (Utils.supportsLocale(avail[0], locale)) {
- return "JPY-tokyo";
- } else if (Utils.supportsLocale(avail[1], locale)) {
- return "JPY-osaka";
- }
- }
- return null;
- }
-
- @Override
- public String getDisplayName(String c, Locale locale) {
- if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- if (c.equals("JPY")) {
- if (Utils.supportsLocale(avail[0], locale)) {
- return "JPY-tokyo";
- } else if (Utils.supportsLocale(avail[1], locale)) {
- return "JPY-osaka";
- }
- }
- return null;
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/DateFormatProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,95 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class DateFormatProviderImpl extends DateFormatProvider {
-
- static Locale[] avail = {
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("yy")};
-
- static String[] datePattern = {
- "yyyy'\u5e74'M'\u6708'd'\u65e5'", // full date pattern
- "yyyy/MMM/dd", // long date pattern
- "yyyy/MM/dd", // medium date pattern
- "yy/MM/dd" // short date pattern
- };
-
- static String[] timePattern = {
- "H'\u6642'mm'\u5206'ss'\u79d2' z", // full time pattern
- "H:mm:ss z", // long time pattern
- "H:mm:ss", // medium time pattern
- "H:mm" // short time pattern
- };
-
- static String[] dialect = {
- "\u3067\u3059\u3002",
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "\u308f\u3044\u308f\u3044"
- };
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public DateFormat getDateInstance(int style, Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooDateFormat(datePattern[style]+dialect[i], locale);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public DateFormat getTimeInstance(int style, Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooDateFormat(timePattern[style]+dialect[i], locale);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- return new FooDateFormat(
- datePattern[dateStyle]+" "+timePattern[timeStyle]+dialect[i], locale);
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/DateFormatSymbolsProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,230 +0,0 @@
-/*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class DateFormatSymbolsProviderImpl extends DateFormatSymbolsProvider {
-
- static Locale[] avail = {
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- Locale.JAPAN,
- new Locale("yy", "ZZ")
- };
- static List<Locale> availList = Arrays.asList(avail);
-
- static String[] dialect = {
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "\u3067\u3059\u3002",
- "-yy-ZZ"
- };
-
- static Map<Locale, FooDateFormatSymbols> symbols = new HashMap<Locale, FooDateFormatSymbols>(4);
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public DateFormatSymbols getInstance(Locale locale) {
- if (!Utils.supportsLocale(availList, locale)) {
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- FooDateFormatSymbols fdfs = symbols.get(locale);
- if (fdfs == null) {
- for (int index = 0; index < avail.length; index ++) {
- if (Utils.supportsLocale(avail[index], locale)) {
- fdfs = new FooDateFormatSymbols(index);
- symbols.put(locale, fdfs);
- break;
- }
- }
- }
- return fdfs;
- }
-
- class FooDateFormatSymbols extends DateFormatSymbols {
- String dialect = "";
-
- String[] eras = null;
- String[] months = null;
- String[] shortMonths = null;
- String[] weekdays = null;
- String[] shortWeekdays = null;
- String[] ampms = null;
-
- public FooDateFormatSymbols(int index) {
- super(DateFormatSymbolsProviderImpl.this.avail[index]);
- dialect = DateFormatSymbolsProviderImpl.this.dialect[index];
- }
-
- public String[] getEras() {
- if (eras == null) {
- eras = super.getEras();
- for (int i = 0; i < eras.length; i++) {
- eras[i] = eras[i]+dialect;
- }
- }
- return eras;
- }
-
- /**
- * Sets era strings. For example: "AD" and "BC".
- * @param newEras the new era strings.
- */
- public void setEras(String[] newEras) {
- eras = newEras;
- }
-
- /**
- * Gets month strings. For example: "January", "February", etc.
- * @return the month strings.
- */
- public String[] getMonths() {
- if (months == null) {
- months = super.getMonths();
- for (int i = 0; i < months.length; i++) {
- months[i] = months[i]+dialect;
- }
- }
- return months;
- }
-
- /**
- * Sets month strings. For example: "January", "February", etc.
- * @param newMonths the new month strings.
- */
- public void setMonths(String[] newMonths) {
- months = newMonths;
- }
-
- /**
- * Gets short month strings. For example: "Jan", "Feb", etc.
- * @return the short month strings.
- */
- public String[] getShortMonths() {
- if (shortMonths == null) {
- shortMonths = super.getShortMonths();
- for (int i = 0; i < shortMonths.length; i++) {
- shortMonths[i] = shortMonths[i]+dialect;
- }
- }
- return shortMonths;
- }
-
- /**
- * Sets short month strings. For example: "Jan", "Feb", etc.
- * @param newShortMonths the new short month strings.
- */
- public void setShortMonths(String[] newShortMonths) {
- shortMonths = newShortMonths;
- }
-
- /**
- * Gets weekday strings. For example: "Sunday", "Monday", etc.
- * @return the weekday strings. Use <code>Calendar.SUNDAY</code>,
- * <code>Calendar.MONDAY</code>, etc. to index the result array.
- */
- public String[] getWeekdays() {
- if (weekdays == null) {
- weekdays = super.getWeekdays();
- for (int i = 0; i < weekdays.length; i++) {
- weekdays[i] = weekdays[i]+dialect;
- }
- }
- return weekdays;
- }
-
- /**
- * Sets weekday strings. For example: "Sunday", "Monday", etc.
- * @param newWeekdays the new weekday strings. The array should
- * be indexed by <code>Calendar.SUNDAY</code>,
- * <code>Calendar.MONDAY</code>, etc.
- */
- public void setWeekdays(String[] newWeekdays) {
- weekdays = newWeekdays;
- }
-
- /**
- * Gets short weekday strings. For example: "Sun", "Mon", etc.
- * @return the short weekday strings. Use <code>Calendar.SUNDAY</code>,
- * <code>Calendar.MONDAY</code>, etc. to index the result array.
- */
- public String[] getShortWeekdays() {
- if (shortWeekdays == null) {
- shortWeekdays = super.getShortWeekdays();
- for (int i = 0; i < shortWeekdays.length; i++) {
- shortWeekdays[i] = shortWeekdays[i]+dialect;
- }
- }
- return shortWeekdays;
- }
-
- /**
- * Sets short weekday strings. For example: "Sun", "Mon", etc.
- * @param newShortWeekdays the new short weekday strings. The array should
- * be indexed by <code>Calendar.SUNDAY</code>,
- * <code>Calendar.MONDAY</code>, etc.
- */
- public void setShortWeekdays(String[] newShortWeekdays) {
- shortWeekdays = newShortWeekdays;
- }
-
- /**
- * Gets ampm strings. For example: "AM" and "PM".
- * @return the ampm strings.
- */
- public String[] getAmPmStrings() {
- if (ampms == null) {
- ampms = super.getAmPmStrings();
- for (int i = 0; i < ampms.length; i++) {
- ampms[i] = ampms[i]+dialect;
- }
- }
- return ampms;
- }
-
- /**
- * Sets ampm strings. For example: "AM" and "PM".
- * @param newAmpms the new ampm strings.
- */
- public void setAmPmStrings(String[] newAmpms) {
- ampms = newAmpms;
- }
-
- @Override
- public String[][] getZoneStrings() {
- return new String[0][0];
- }
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/DecimalFormatSymbolsProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,110 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class DecimalFormatSymbolsProviderImpl extends DecimalFormatSymbolsProvider {
-
- static Locale[] avail = {
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- Locale.JAPAN,
- new Locale("yy", "ZZ", "UUU")
- };
- static List<Locale> availList = Arrays.asList(avail);
-
- static String[] dialect = {
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "\u3067\u3059\u3002",
- "-yy-ZZ-UUU"
- };
-
- static HashMap<Locale, FooDecimalFormatSymbols> symbols = new HashMap<Locale, FooDecimalFormatSymbols>(4);
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public DecimalFormatSymbols getInstance(Locale locale) {
- if (!Utils.supportsLocale(availList, locale)) {
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- FooDecimalFormatSymbols fdfs = symbols.get(locale);
- if (fdfs == null) {
- for (int index = 0; index < avail.length; index ++) {
- if (Utils.supportsLocale(avail[index], locale)) {
- fdfs = new FooDecimalFormatSymbols(index);
- symbols.put(locale, fdfs);
- break;
- }
- }
- }
- return fdfs;
- }
-
- class FooDecimalFormatSymbols extends DecimalFormatSymbols {
- String dialect = "";
-
- String infinity = null;
- String nan = null;
-
- public FooDecimalFormatSymbols(int index) {
- super(DecimalFormatSymbolsProviderImpl.this.avail[index]);
- dialect = DecimalFormatSymbolsProviderImpl.this.dialect[index];
- }
-
- // overrides methods only returns Strings
- public String getInfinity() {
- if (infinity == null) {
- infinity = super.getInfinity() + dialect;
- }
- return infinity;
- }
-
- public void setInfinity(String infinity) {
- this.infinity = infinity;
- }
-
- public String getNaN() {
- if (nan == null) {
- nan = super.getNaN() + dialect;
- }
- return nan;
- }
-
- public void setNaN(String nan) {
- this.nan = nan;
- }
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/FooDateFormat.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,61 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- */
-
-package com.foo;
-
-import java.text.*;
-import java.util.*;
-
-/**
- * FooDateFormat provides SimpleDateFormat methods required for the SPI testing.
- */
-public class FooDateFormat extends DateFormat {
- private SimpleDateFormat sdf;
-
- public FooDateFormat(String pattern, Locale loc) {
- sdf = new SimpleDateFormat(pattern, loc);
- }
-
- @Override
- public StringBuffer format(Date date,
- StringBuffer toAppendTo,
- FieldPosition fieldPosition) {
- return sdf.format(date, toAppendTo, fieldPosition);
- }
-
- @Override
- public Date parse(String source, ParsePosition pos) {
- return sdf.parse(source, pos);
- }
-
- @Override
- public boolean equals(Object other) {
- return other instanceof FooDateFormat
- && sdf.equals(((FooDateFormat)other).sdf);
- }
-
- @Override
- public int hashCode() {
- return sdf.hashCode();
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/FooNumberFormat.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,81 +0,0 @@
-/*
- * Copyright (c) 2010, 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.
- */
-
-package com.foo;
-
-import java.text.*;
-
-/**
- * FooNumberFormat provides DecimalFormat methods required for the SPI testing.
- */
-public class FooNumberFormat extends NumberFormat {
- private DecimalFormat df;
-
- public FooNumberFormat(String pattern, DecimalFormatSymbols dfs) {
- df = new DecimalFormat(pattern, dfs);
- }
-
- @Override
- public StringBuffer format(double number,
- StringBuffer toAppendTo,
- FieldPosition pos) {
- return df.format(number, toAppendTo, pos);
- }
-
- @Override
- public StringBuffer format(long number,
- StringBuffer toAppendTo,
- FieldPosition pos) {
- return df.format(number, toAppendTo, pos);
- }
-
- @Override
- public Number parse(String source, ParsePosition parsePosition) {
- return df.parse(source, parsePosition);
- }
-
- @Override
- public boolean equals(Object other) {
- return other instanceof FooNumberFormat
- && df.equals(((FooNumberFormat)other).df);
- }
-
- @Override
- public int hashCode() {
- return df.hashCode();
- }
-
- // DecimalFormat specific methods required for testing
-
- public String toPattern() {
- return df.toPattern();
- }
-
- public DecimalFormatSymbols getDecimalFormatSymbols() {
- return df.getDecimalFormatSymbols();
- }
-
- public void setDecimalSeparatorAlwaysShown(boolean newValue) {
- df.setDecimalSeparatorAlwaysShown(newValue);
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/GenericTimeZoneNameProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,58 +0,0 @@
-/*
- * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.bar;
-
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-/**
- * Implementation class for getGenericTimeZoneName which returns "Generic "+<standard name in OSAKA>.
- */
-public class GenericTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
- static final Locale jaJPGeneric = new Locale("ja", "JP", "generic");
- static final Locale OSAKA = new Locale("ja", "JP", "osaka");
-
- static Locale[] avail = {
- jaJPGeneric
- };
-
- @Override
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- @Override
- public String getGenericDisplayName(String id, int style, Locale locale) {
- if (!jaJPGeneric.equals(locale)) {
- return null;
- }
- String std = super.getDisplayName(id, false, style, OSAKA);
- return (std != null) ? "Generic " + std : null;
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNameProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,100 +0,0 @@
-/*
- * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * This code is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License version 2 only, as
- * published by the Free Software Foundation.
- *
- * 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.bar;
-
-import java.text.*;
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-public class LocaleNameProviderImpl extends LocaleNameProvider {
- static Locale[] avail = {Locale.JAPANESE,
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("xx"),
- new Locale("yy", "YY", "YYYY")};
- static List<Locale> availList = Arrays.asList(avail);
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- @Override
- public String getDisplayLanguage(String lang, Locale target) {
- return getDisplayString(lang, target);
- }
-
- @Override
- public String getDisplayCountry(String ctry, Locale target) {
- return getDisplayString(ctry, target);
- }
-
- @Override
- public String getDisplayVariant(String vrnt, Locale target) {
- return getDisplayString(vrnt, target);
- }
-
- private String getDisplayString(String key, Locale target) {
- if (!Utils.supportsLocale(availList, target)) {
- throw new IllegalArgumentException("locale is not supported: "+target);
- }
-
- String ret = null;
-
- if (target.getLanguage().equals("yy") &&
- target.getCountry().equals("YY")) {
- String vrnt = target.getVariant();
- if (vrnt.startsWith("YYYY")) {
- switch (key) {
- case "yy":
- case "YY":
- ret = "waiwai";
- break;
-
- case "YYYY":
- if (vrnt.equals("YYYY_suffix")) {
- // for LocaleNameProviderTest.variantFallbackTest()
- throw new RuntimeException(vrnt);
- } else {
- ret = "waiwai";
- }
- break;
- }
- }
- } else {
- // resource bundle based (allows fallback)
- try {
- ResourceBundle rb = ResourceBundle.getBundle("com.bar.LocaleNames", target);
- ret = rb.getString(key);
- } catch (MissingResourceException mre) {
- }
- }
-
- return ret;
- }
- }
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames.properties Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,25 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-osaka=Osaka
-kyoto=Kyoto
-xx=batsubatsu
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja.properties Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,30 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-ja=\u65e5\u672c\u8a9e\u3067\u3059\u3002
-JP=\u65e5\u672c\u3067\u3059\u3002
-#
-# added ones
-#
-osaka=\u5927\u962a\u3067\u3059\u3002
-kyoto=\u4eac\u90fd\u3067\u3059\u3002
-xx=\u3070\u3064\u3070\u3064\u3067\u3059\u3002
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja_JP_kyoto.properties Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-ja=\u65e5\u672c\u8a9e\u3069\u3059\u3002
-JP=\u65e5\u672c\u3069\u3059\u3002
-#
-osaka=\u5927\u962a\u3069\u3059\u3002
-kyoto=\u4eac\u90fd\u3069\u3059\u3002
-xx=\u307a\u3051\u307a\u3051\u3069\u3059\u3002
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_ja_JP_osaka.properties Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,28 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-ja=\u7956\u56fd\u8a9e\u3084\u3002
-JP=\u3084\u307e\u3068\u3084\u3002
-#
-osaka=\u5927\u962a\u3084\u3002
-kyoto=\u4eac\u90fd\u3084\u3002
-xx=\u307a\u3051\u307a\u3051\u3084\u3002
--- a/test/jdk/java/util/PluggableLocale/providersrc/LocaleNames_xx.properties Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,23 +0,0 @@
-#
-# Copyright (c) 2007, 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.
-#
-xx=batsubatsu
--- a/test/jdk/java/util/PluggableLocale/providersrc/Makefile Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,78 +0,0 @@
-#
-#
-#
-
-DESTDIR=..
-FOODIR=foo-contents
-BARDIR=bar-contents
-
-all: $(DESTDIR)/fooprovider.jar $(DESTDIR)/barprovider.jar
-
-FOOSERVICES = \
- java.text.spi.BreakIteratorProvider \
- java.text.spi.CollatorProvider \
- java.text.spi.DateFormatProvider \
- java.text.spi.DateFormatSymbolsProvider \
- java.text.spi.DecimalFormatSymbolsProvider \
- java.text.spi.NumberFormatProvider
-
-BARSERVICES = \
- java.util.spi.CurrencyNameProvider \
- java.util.spi.TimeZoneNameProvider \
- java.util.spi.LocaleNameProvider \
- java.util.spi.CalendarDataProvider \
- java.util.spi.CalendarNameProvider
-
-FOOFILES_JAVA = \
- BreakIteratorProviderImpl.java \
- CollatorProviderImpl.java \
- DateFormatProviderImpl.java \
- DateFormatSymbolsProviderImpl.java \
- DecimalFormatSymbolsProviderImpl.java \
- NumberFormatProviderImpl.java \
- FooDateFormat.java \
- FooNumberFormat.java \
- Utils.java
-
-BARFILES_JAVA = \
- CurrencyNameProviderImpl.java \
- CurrencyNameProviderImpl2.java \
- TimeZoneNameProviderImpl.java \
- GenericTimeZoneNameProviderImpl.java \
- LocaleNameProviderImpl.java \
- CalendarDataProviderImpl.java \
- CalendarNameProviderImpl.java \
- Utils.java
-
-BARFILES_PROPERTIES = \
- LocaleNames.properties \
- LocaleNames_ja.properties \
- LocaleNames_ja_JP_osaka.properties \
- LocaleNames_ja_JP_kyoto.properties \
- LocaleNames_xx.properties
-
-$(DESTDIR)/fooprovider.jar: $(FOOSERVICES) $(FOOFILES_JAVA)
- rm -rf $(FOODIR)
- mkdir -p $(FOODIR)
- mkdir -p $(FOODIR)/META-INF
- mkdir -p $(FOODIR)/META-INF/services
- $(BINDIR)/javac -d $(FOODIR) $(FOOFILES_JAVA)
- cp $(FOOSERVICES) $(FOODIR)/META-INF/services
- rm -f $(DESTDIR)/fooprovider.jar
- $(BINDIR)/jar cvf $(DESTDIR)/fooprovider.jar -C $(FOODIR) .
-
-$(DESTDIR)/barprovider.jar: $(BARSERVICES) $(BARFILES_JAVA) $(BARFILES_PROPERTIES)
- rm -rf $(BARDIR)
- mkdir -p $(BARDIR)
- mkdir -p $(BARDIR)/META-INF
- mkdir -p $(BARDIR)/META-INF/services
- $(BINDIR)/javac -d $(BARDIR) $(BARFILES_JAVA)
- cp $(BARSERVICES) $(BARDIR)/META-INF/services
- cp $(BARFILES_PROPERTIES) $(BARDIR)/com/bar
- rm -f $(DESTDIR)/barprovider.jar
- $(BINDIR)/jar cvf $(DESTDIR)/barprovider.jar -C $(BARDIR) .
-
-clean:
- rm -rf $(BARDIR) $(FOODIR)
-
-.PHONY: all clean
--- a/test/jdk/java/util/PluggableLocale/providersrc/NumberFormatProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,156 +0,0 @@
-/*
- * Copyright (c) 2007, 2010, 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.
- */
-/*
- *
- */
-
-package com.foo;
-
-import java.text.*;
-import java.text.spi.*;
-import java.util.*;
-
-import com.foobar.Utils;
-
-public class NumberFormatProviderImpl extends NumberFormatProvider {
-
- static Locale[] avail = {
- Locale.JAPAN,
- new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("zz")};
-
- static String[] dialect = {
- "\u3067\u3059\u3002",
- "\u3084\u3002",
- "\u3069\u3059\u3002",
- "-zz"
- };
-
- static String[] patterns = {
- "#,##0.###{0};-#,##0.###{1}", // decimal pattern
- "#{0};(#){1}", // integer pattern
- "\u00A4#,##0{0};-\u00A4#,##0{1}", // currency pattern
- "#,##0%{0}" // percent pattern
- };
- // Constants used by factory methods to specify a style of format.
- static final int NUMBERSTYLE = 0;
- static final int INTEGERSTYLE = 1;
- static final int CURRENCYSTYLE = 2;
- static final int PERCENTSTYLE = 3;
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public NumberFormat getCurrencyInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- String pattern =
- MessageFormat.format(patterns[CURRENCYSTYLE],
- dialect[i],
- dialect[i]);
- FooNumberFormat nf = new FooNumberFormat(pattern,
- DecimalFormatSymbols.getInstance(locale));
- adjustForCurrencyDefaultFractionDigits(nf);
- return nf;
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public NumberFormat getIntegerInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- String pattern =
- MessageFormat.format(patterns[INTEGERSTYLE],
- dialect[i],
- dialect[i]);
- FooNumberFormat nf = new FooNumberFormat(pattern,
- DecimalFormatSymbols.getInstance(locale));
- nf.setMaximumFractionDigits(0);
- nf.setDecimalSeparatorAlwaysShown(false);
- nf.setParseIntegerOnly(true);
- return nf;
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public NumberFormat getNumberInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- String pattern =
- MessageFormat.format(patterns[NUMBERSTYLE],
- dialect[i],
- dialect[i]);
- return new FooNumberFormat(pattern,
- DecimalFormatSymbols.getInstance(locale));
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- public NumberFormat getPercentInstance(Locale locale) {
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], locale)) {
- String pattern =
- MessageFormat.format(patterns[PERCENTSTYLE],
- dialect[i]);
- return new FooNumberFormat(pattern,
- DecimalFormatSymbols.getInstance(locale));
- }
- }
- throw new IllegalArgumentException("locale is not supported: "+locale);
- }
-
- /**
- * Adjusts the minimum and maximum fraction digits to values that
- * are reasonable for the currency's default fraction digits.
- */
- void adjustForCurrencyDefaultFractionDigits(FooNumberFormat nf) {
- DecimalFormatSymbols dfs = nf.getDecimalFormatSymbols();
- Currency currency = dfs.getCurrency();
- if (currency == null) {
- try {
- currency = Currency.getInstance(dfs.getInternationalCurrencySymbol());
- } catch (IllegalArgumentException e) {
- }
- }
- if (currency != null) {
- int digits = currency.getDefaultFractionDigits();
- if (digits != -1) {
- int oldMinDigits = nf.getMinimumFractionDigits();
- // Common patterns are "#.##", "#.00", "#".
- // Try to adjust all of them in a reasonable way.
- if (oldMinDigits == nf.getMaximumFractionDigits()) {
- nf.setMinimumFractionDigits(digits);
- nf.setMaximumFractionDigits(digits);
- } else {
- nf.setMinimumFractionDigits(Math.min(digits, oldMinDigits));
- nf.setMaximumFractionDigits(digits);
- }
- }
- }
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/TimeZoneNameProviderImpl.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,150 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-/*
- *
- */
-
-package com.bar;
-
-import java.util.*;
-import java.util.spi.*;
-
-import com.foobar.Utils;
-
-public class TimeZoneNameProviderImpl extends TimeZoneNameProvider {
- static Locale[] avail = {new Locale("ja", "JP", "osaka"),
- new Locale("ja", "JP", "kyoto"),
- new Locale("xx"),
- Locale.JAPAN};
-
- static String[][] zoneOsaka = {
- {"GMT",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "G_M_T_\u3084_\u3002",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "G_M_T_\u3084_\u3002"},
- {"JST",
- "\u3084_\u307e_\u3068_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "J_S_T_\u3084_\u3002",
- "\u3084_\u307e_\u3068_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "J_S_T_\u3084_\u3002"},
- {"America/Los_Angeles",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "P_S_T_\u3084_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
- "P_D_T_\u3084_\u3002"},
- {"SystemV/PST8",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "P_S_T_\u3084_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
- "P_D_T_\u3084_\u3002"},
- {"SystemV/PST8PDT",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "P_S_T_\u3084_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
- "P_D_T_\u3084_\u3002"},
- {"PST8PDT",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
- "P_S_T_\u3084_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
- "P_D_T_\u3084_\u3002"},
- };
-
- static String[][] zoneKyoto = {
- {"GMT",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "G_M_T_\u3069_\u3059_\u3002",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "G_M_T_\u3069_\u3059_\u3002"},
- {"America/Los_Angeles",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "P_S_T_\u3069_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
- "P_D_T_\u3069_\u3059_\u3002"},
- {"SystemV/PST8",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "P_S_T_\u3069_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
- "P_D_T_\u3069_\u3059_\u3002"},
- {"SystemV/PST8PDT",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "P_S_T_\u3069_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
- "P_D_T_\u3069_\u3059_\u3002"},
- {"PST8PDT",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
- "P_S_T_\u3069_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
- "P_D_T_\u3069_\u3059_\u3002"},
- };
-
- static String[][] zoneXX = {
- {"GMT",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642\u3070\u3064\u3070\u3064\u3002",
- "G_M_T_\u3070\u3064\u3070\u3064\u3002",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642\u3070\u3064\u3070\u3064\u3002",
- "G_M_T_\u3070\u3064\u3070\u3064\u3002"},
- {"America/Los_Angeles",
- "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3070\u3064\u3070\u3064\u3002",
- "P_S_T_\u3070\u3064\u3070\u3064\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3070\u3064\u3070\u3064\u3002",
- "P_D_T_\u3070\u3064\u3070\u3064\u3002"}};
-
- static String[][] zoneJaJP = {
- {"GMT",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
- "G_M_T_\u3067_\u3059_\u3002",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
- "G_M_T_\u3067_\u3059_\u3002"},
- {"America/Los_Angeles",
- "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
- "P_S_T_\u3067_\u3059_\u3002",
- "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3067_\u3059_\u3002",
- "P_D_T_\u3067_\u3059_\u3002"}};
-
- static String[][][] names = {zoneOsaka, zoneKyoto, zoneXX, zoneJaJP};
-
- public Locale[] getAvailableLocales() {
- return avail;
- }
-
- public String getDisplayName(String id, boolean dst, int style, Locale language) {
- if (!Utils.supportsLocale(Arrays.asList(avail), language)) {
- throw new IllegalArgumentException("locale is not one of available locales: "+language);
- }
-
- for (int i = 0; i < avail.length; i ++) {
- if (Utils.supportsLocale(avail[i], language)) {
- String[][] namesForALocale = names[i];
- for (int j = 0; j < namesForALocale.length; j++) {
- String[] array = namesForALocale[j];
- if (id.equals(array[0])) {
- String ret = array[(style==TimeZone.LONG?0:1)+(dst?2:0)+1];
- return ret;
- }
- }
- }
- }
- return null;
- }
-}
--- a/test/jdk/java/util/PluggableLocale/providersrc/Utils.java Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,68 +0,0 @@
-/*
- * Copyright (c) 2007, 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.
- */
-/*
- *
- */
-package com.foobar;
-import java.util.*;
-
-public class Utils {
- public static boolean supportsLocale(Locale supported, Locale requested) {
- if (supported.getLanguage() == "") {
- return true;
- } else if (supported.getLanguage() != requested.getLanguage()) {
- return false;
- }
-
- if (supported.getCountry() == "") {
- return true;
- } else if (supported.getCountry() != requested.getCountry()) {
- return false;
- }
-
- String supVar = supported.getVariant();
- String reqVar = requested.getVariant();
-
- if (supVar == "") {
- return true;
- } else {
- int underIndex;
- while ((underIndex = reqVar.lastIndexOf('_')) != (-1)) {
- reqVar = reqVar.substring(0, underIndex);
- if (supVar.equals(reqVar)) {
- return true;
- }
- }
- return supVar.equals(reqVar);
- }
- }
-
- public static boolean supportsLocale(List<Locale> supported, Locale requested) {
- for (Locale l : supported) {
- if (supportsLocale(l, requested)) {
- return true;
- }
- }
- return false;
- }
-}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.CalendarDataProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.CalendarDataProvider
+# implementation class
+#
+com.bar.CalendarDataProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.CalendarNameProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.CalendarNameProvider
+# implementation class
+#
+com.bar.CalendarNameProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.CurrencyNameProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,8 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.LocaleNameProvider
+# implementation class
+#
+com.bar.CurrencyNameProviderImpl
+com.bar.CurrencyNameProviderImpl2
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.LocaleNameProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.LocaleNameProvider
+# implementation class
+#
+com.bar.LocaleNameProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/META-INF/services/java.util.spi.TimeZoneNameProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,8 @@
+#
+#
+#
+# fully-qualified name of the java.util.spi.TimeZoneNameProvider
+# implementation class
+#
+com.bar.TimeZoneNameProviderImpl
+com.bar.GenericTimeZoneNameProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/CalendarDataProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,54 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.bar;
+
+import com.foobar.Utils;
+import java.util.Arrays;
+import static java.util.Calendar.*;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.spi.CalendarDataProvider;
+
+public class CalendarDataProviderImpl extends CalendarDataProvider {
+ static final char FULLWIDTH_ZERO = '\uff10';
+ static final Locale[] avail = {
+ new Locale("ja", "JP", "kids"),
+ };
+
+ @Override
+ public int getFirstDayOfWeek(Locale locale) {
+ return WEDNESDAY;
+ }
+
+ @Override
+ public int getMinimalDaysInFirstWeek(Locale locale) {
+ return 7;
+ }
+
+ @Override
+ public Locale[] getAvailableLocales() {
+ return avail.clone();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/CalendarNameProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,102 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.bar;
+
+import com.foobar.Utils;
+import java.util.Arrays;
+import static java.util.Calendar.*;
+import java.util.HashMap;
+import java.util.Locale;
+import java.util.Map;
+import java.util.spi.CalendarNameProvider;
+
+public class CalendarNameProviderImpl extends CalendarNameProvider {
+ static final char FULLWIDTH_ZERO = '\uff10';
+ static final Locale[] avail = {
+ new Locale("ja", "JP", "kids"),
+ };
+
+ @Override
+ public String getDisplayName(String calendarType, int field, int value, int style, Locale locale) {
+ if (calendarType == null || locale == null) {
+ throw new NullPointerException();
+ }
+ if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
+ throw new IllegalArgumentException("locale is not one of available locales: "+ locale);
+ }
+ if (field != MONTH) {
+ return null;
+ }
+ return toMonthName(value + 1, style);
+ }
+
+ @Override
+ public Map<String, Integer> getDisplayNames(String calendarType, int field, int style, Locale locale) {
+ if (calendarType == null || locale == null) {
+ throw new NullPointerException();
+ }
+ if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
+ throw new IllegalArgumentException("locale is not one of available locales: " + locale);
+ }
+ if (field != MONTH) {
+ return null;
+ }
+ Map<String, Integer> map = new HashMap<>();
+ if (style == LONG_STANDALONE) {
+ style = LONG;
+ } else if (style == SHORT_STANDALONE) {
+ style = SHORT;
+ }
+ for (int month = JANUARY; month <= DECEMBER; month++) {
+ if (style == ALL_STYLES || style == LONG) {
+ map.put(toMonthName(month + 1, LONG), month);
+ }
+ if (style == ALL_STYLES || style == SHORT) {
+ map.put(toMonthName(month + 1, SHORT), month);
+ }
+ }
+ return map;
+ }
+
+ @Override
+ public Locale[] getAvailableLocales() {
+ return avail.clone();
+ }
+
+ // month is 1-based.
+ public static String toMonthName(int month, int style) {
+ StringBuilder sb = new StringBuilder();
+ if (month >= 10) {
+ sb.append((char)(FULLWIDTH_ZERO + 1));
+ sb.appendCodePoint((char)(FULLWIDTH_ZERO + (month % 10)));
+ } else {
+ sb.appendCodePoint((char)(FULLWIDTH_ZERO + month));
+ }
+ if (style == SHORT || style == SHORT_STANDALONE) {
+ return sb.toString(); // full-width digit(s)
+ }
+ sb.append("\u304c\u3064"); // + "gatsu" in Hiragana
+ return sb.toString();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/CurrencyNameProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,82 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+/*
+ *
+ */
+
+package com.bar;
+
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+public class CurrencyNameProviderImpl extends CurrencyNameProvider {
+ static Locale[] avail = {new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ Locale.JAPAN,
+ new Locale("xx")};
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public String getSymbol(String c, Locale locale) {
+ if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ if (c.equals("JPY")) {
+ if (Utils.supportsLocale(avail[0], locale)) {
+ return "\u5186\u3084\u3002";
+ } else if (Utils.supportsLocale(avail[1], locale)) {
+ return "\u5186\u3069\u3059\u3002";
+ } else if (Utils.supportsLocale(avail[2], locale)) {
+ return "\u5186\u3067\u3059\u3002";
+ } else if (Utils.supportsLocale(avail[3], locale)) {
+ return "\u5186\u3070\u3064\u3070\u3064\u3002";
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getDisplayName(String c, Locale locale) {
+ if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ if (c.equals("JPY")) {
+ if (Utils.supportsLocale(avail[0], locale)) {
+ return "\u65e5\u672c\u5186\u3084\u3002";
+ } else if (Utils.supportsLocale(avail[1], locale)) {
+ return "\u65e5\u672c\u5186\u3069\u3059\u3002";
+ } else if (Utils.supportsLocale(avail[2], locale)) {
+ return "\u65e5\u672c\u5186\u3067\u3059\u3002";
+ } else if (Utils.supportsLocale(avail[3], locale)) {
+ return "\u65e5\u672c\u5186\u3070\u3064\u3070\u3064\u3002";
+ }
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/CurrencyNameProviderImpl2.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,72 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.bar;
+
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+public class CurrencyNameProviderImpl2 extends CurrencyNameProvider {
+ static Locale[] avail = {new Locale("ja", "JP", "tokyo"),
+ new Locale("ja", "JP", "osaka"), };
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ @Override
+ public String getSymbol(String c, Locale locale) {
+ if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ if (c.equals("JPY")) {
+ if (Utils.supportsLocale(avail[0], locale)) {
+ return "JPY-tokyo";
+ } else if (Utils.supportsLocale(avail[1], locale)) {
+ return "JPY-osaka";
+ }
+ }
+ return null;
+ }
+
+ @Override
+ public String getDisplayName(String c, Locale locale) {
+ if (!Utils.supportsLocale(Arrays.asList(avail), locale)) {
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ if (c.equals("JPY")) {
+ if (Utils.supportsLocale(avail[0], locale)) {
+ return "JPY-tokyo";
+ } else if (Utils.supportsLocale(avail[1], locale)) {
+ return "JPY-osaka";
+ }
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/GenericTimeZoneNameProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,58 @@
+/*
+ * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.bar;
+
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+/**
+ * Implementation class for getGenericTimeZoneName which returns "Generic "+<standard name in OSAKA>.
+ */
+public class GenericTimeZoneNameProviderImpl extends TimeZoneNameProviderImpl {
+ static final Locale jaJPGeneric = new Locale("ja", "JP", "generic");
+ static final Locale OSAKA = new Locale("ja", "JP", "osaka");
+
+ static Locale[] avail = {
+ jaJPGeneric
+ };
+
+ @Override
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ @Override
+ public String getGenericDisplayName(String id, int style, Locale locale) {
+ if (!jaJPGeneric.equals(locale)) {
+ return null;
+ }
+ String std = super.getDisplayName(id, false, style, OSAKA);
+ return (std != null) ? "Generic " + std : null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNameProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,100 @@
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.bar;
+
+import java.text.*;
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+public class LocaleNameProviderImpl extends LocaleNameProvider {
+ static Locale[] avail = {Locale.JAPANESE,
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("xx"),
+ new Locale("yy", "YY", "YYYY")};
+ static List<Locale> availList = Arrays.asList(avail);
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ @Override
+ public String getDisplayLanguage(String lang, Locale target) {
+ return getDisplayString(lang, target);
+ }
+
+ @Override
+ public String getDisplayCountry(String ctry, Locale target) {
+ return getDisplayString(ctry, target);
+ }
+
+ @Override
+ public String getDisplayVariant(String vrnt, Locale target) {
+ return getDisplayString(vrnt, target);
+ }
+
+ private String getDisplayString(String key, Locale target) {
+ if (!Utils.supportsLocale(availList, target)) {
+ throw new IllegalArgumentException("locale is not supported: "+target);
+ }
+
+ String ret = null;
+
+ if (target.getLanguage().equals("yy") &&
+ target.getCountry().equals("YY")) {
+ String vrnt = target.getVariant();
+ if (vrnt.startsWith("YYYY")) {
+ switch (key) {
+ case "yy":
+ case "YY":
+ ret = "waiwai";
+ break;
+
+ case "YYYY":
+ if (vrnt.equals("YYYY_suffix")) {
+ // for LocaleNameProviderTest.variantFallbackTest()
+ throw new RuntimeException(vrnt);
+ } else {
+ ret = "waiwai";
+ }
+ break;
+ }
+ }
+ } else {
+ // resource bundle based (allows fallback)
+ try {
+ ResourceBundle rb = ResourceBundle.getBundle("com.bar.LocaleNames", target);
+ ret = rb.getString(key);
+ } catch (MissingResourceException mre) {
+ }
+ }
+
+ return ret;
+ }
+ }
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames.properties Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,25 @@
+#
+# Copyright (c) 2007, 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.
+#
+osaka=Osaka
+kyoto=Kyoto
+xx=batsubatsu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames_ja.properties Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,30 @@
+#
+# Copyright (c) 2007, 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.
+#
+ja=\u65e5\u672c\u8a9e\u3067\u3059\u3002
+JP=\u65e5\u672c\u3067\u3059\u3002
+#
+# added ones
+#
+osaka=\u5927\u962a\u3067\u3059\u3002
+kyoto=\u4eac\u90fd\u3067\u3059\u3002
+xx=\u3070\u3064\u3070\u3064\u3067\u3059\u3002
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames_ja_JP_kyoto.properties Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2007, 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.
+#
+ja=\u65e5\u672c\u8a9e\u3069\u3059\u3002
+JP=\u65e5\u672c\u3069\u3059\u3002
+#
+osaka=\u5927\u962a\u3069\u3059\u3002
+kyoto=\u4eac\u90fd\u3069\u3059\u3002
+xx=\u307a\u3051\u307a\u3051\u3069\u3059\u3002
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames_ja_JP_osaka.properties Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,28 @@
+#
+# Copyright (c) 2007, 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.
+#
+ja=\u7956\u56fd\u8a9e\u3084\u3002
+JP=\u3084\u307e\u3068\u3084\u3002
+#
+osaka=\u5927\u962a\u3084\u3002
+kyoto=\u4eac\u90fd\u3084\u3002
+xx=\u307a\u3051\u307a\u3051\u3084\u3002
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/LocaleNames_xx.properties Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,23 @@
+#
+# Copyright (c) 2007, 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.
+#
+xx=batsubatsu
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/barprovider/com/bar/TimeZoneNameProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,150 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+/*
+ *
+ */
+
+package com.bar;
+
+import java.util.*;
+import java.util.spi.*;
+
+import com.foobar.Utils;
+
+public class TimeZoneNameProviderImpl extends TimeZoneNameProvider {
+ static Locale[] avail = {new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("xx"),
+ Locale.JAPAN};
+
+ static String[][] zoneOsaka = {
+ {"GMT",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "G_M_T_\u3084_\u3002",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "G_M_T_\u3084_\u3002"},
+ {"JST",
+ "\u3084_\u307e_\u3068_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "J_S_T_\u3084_\u3002",
+ "\u3084_\u307e_\u3068_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "J_S_T_\u3084_\u3002"},
+ {"America/Los_Angeles",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "P_S_T_\u3084_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
+ "P_D_T_\u3084_\u3002"},
+ {"SystemV/PST8",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "P_S_T_\u3084_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
+ "P_D_T_\u3084_\u3002"},
+ {"SystemV/PST8PDT",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "P_S_T_\u3084_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
+ "P_D_T_\u3084_\u3002"},
+ {"PST8PDT",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3084_\u3002",
+ "P_S_T_\u3084_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3084_\u3002",
+ "P_D_T_\u3084_\u3002"},
+ };
+
+ static String[][] zoneKyoto = {
+ {"GMT",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "G_M_T_\u3069_\u3059_\u3002",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "G_M_T_\u3069_\u3059_\u3002"},
+ {"America/Los_Angeles",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "P_S_T_\u3069_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
+ "P_D_T_\u3069_\u3059_\u3002"},
+ {"SystemV/PST8",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "P_S_T_\u3069_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
+ "P_D_T_\u3069_\u3059_\u3002"},
+ {"SystemV/PST8PDT",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "P_S_T_\u3069_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
+ "P_D_T_\u3069_\u3059_\u3002"},
+ {"PST8PDT",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3069_\u3059_\u3002",
+ "P_S_T_\u3069_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3069_\u3059_\u3002",
+ "P_D_T_\u3069_\u3059_\u3002"},
+ };
+
+ static String[][] zoneXX = {
+ {"GMT",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642\u3070\u3064\u3070\u3064\u3002",
+ "G_M_T_\u3070\u3064\u3070\u3064\u3002",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642\u3070\u3064\u3070\u3064\u3002",
+ "G_M_T_\u3070\u3064\u3070\u3064\u3002"},
+ {"America/Los_Angeles",
+ "\u592a_\u5e73_\u6d0b_\u6a19_\u6e96_\u6642_\u3070\u3064\u3070\u3064\u3002",
+ "P_S_T_\u3070\u3064\u3070\u3064\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3070\u3064\u3070\u3064\u3002",
+ "P_D_T_\u3070\u3064\u3070\u3064\u3002"}};
+
+ static String[][] zoneJaJP = {
+ {"GMT",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
+ "G_M_T_\u3067_\u3059_\u3002",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
+ "G_M_T_\u3067_\u3059_\u3002"},
+ {"America/Los_Angeles",
+ "\u30b0_\u30ea_\u30cb_\u30c3_\u30b8_\u6a19_\u6e96_\u6642_\u3067_\u3059_\u3002",
+ "P_S_T_\u3067_\u3059_\u3002",
+ "\u592a_\u5e73_\u6d0b_\u590f_\u6642_\u9593_\u3067_\u3059_\u3002",
+ "P_D_T_\u3067_\u3059_\u3002"}};
+
+ static String[][][] names = {zoneOsaka, zoneKyoto, zoneXX, zoneJaJP};
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public String getDisplayName(String id, boolean dst, int style, Locale language) {
+ if (!Utils.supportsLocale(Arrays.asList(avail), language)) {
+ throw new IllegalArgumentException("locale is not one of available locales: "+language);
+ }
+
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], language)) {
+ String[][] namesForALocale = names[i];
+ for (int j = 0; j < namesForALocale.length; j++) {
+ String[] array = namesForALocale[j];
+ if (id.equals(array[0])) {
+ String ret = array[(style==TimeZone.LONG?0:1)+(dst?2:0)+1];
+ return ret;
+ }
+ }
+ }
+ }
+ return null;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/foobarutils/com/foobar/Utils.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+/*
+ *
+ */
+package com.foobar;
+import java.util.*;
+
+public class Utils {
+ public static boolean supportsLocale(Locale supported, Locale requested) {
+ if (supported.getLanguage() == "") {
+ return true;
+ } else if (supported.getLanguage() != requested.getLanguage()) {
+ return false;
+ }
+
+ if (supported.getCountry() == "") {
+ return true;
+ } else if (supported.getCountry() != requested.getCountry()) {
+ return false;
+ }
+
+ String supVar = supported.getVariant();
+ String reqVar = requested.getVariant();
+
+ if (supVar == "") {
+ return true;
+ } else {
+ int underIndex;
+ while ((underIndex = reqVar.lastIndexOf('_')) != (-1)) {
+ reqVar = reqVar.substring(0, underIndex);
+ if (supVar.equals(reqVar)) {
+ return true;
+ }
+ }
+ return supVar.equals(reqVar);
+ }
+ }
+
+ public static boolean supportsLocale(List<Locale> supported, Locale requested) {
+ for (Locale l : supported) {
+ if (supportsLocale(l, requested)) {
+ return true;
+ }
+ }
+ return false;
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.BreakIteratorProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.BreakIteratorProvider
+# implementation class
+#
+com.foo.BreakIteratorProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.CollatorProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.CollatorProvider
+# implementation class
+#
+com.foo.CollatorProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.DateFormatProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.DateFormatProvider
+# implementation class
+#
+com.foo.DateFormatProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.DateFormatSymbolsProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.DateFormatProvider
+# implementation class
+#
+com.foo.DateFormatSymbolsProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.DecimalFormatSymbolsProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.DecimalFormatProvider
+# implementation class
+#
+com.foo.DecimalFormatSymbolsProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/META-INF/services/java.text.spi.NumberFormatProvider Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,7 @@
+#
+#
+#
+# fully-qualified name of the java.text.spi.NumberFormatProvider
+# implementation class
+#
+com.foo.NumberFormatProviderImpl
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/BreakIteratorProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,140 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+import com.foobar.Utils;
+
+public class BreakIteratorProviderImpl extends BreakIteratorProvider {
+
+ static Locale[] avail = {
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("xx", "YY")};
+
+ static String[] dialect = {
+ "\u3067\u3059\u3002",
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "-xx-YY"
+ };
+
+ static enum Type {CHARACTER, LINE, SENTENCE, WORD};
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public BreakIterator getCharacterInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooBreakIterator(Type.CHARACTER, i);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public BreakIterator getLineInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooBreakIterator(Type.LINE, i);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public BreakIterator getSentenceInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooBreakIterator(Type.SENTENCE, i);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public BreakIterator getWordInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooBreakIterator(Type.WORD, i);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ // dummy implementation
+ class FooBreakIterator extends BreakIterator {
+ public FooBreakIterator(Type t, int index) {
+ super();
+ }
+
+ public int current() {
+ return 0;
+ }
+
+ public int first() {
+ return 0;
+ }
+
+ public int following(int offset) {
+ return 0;
+ }
+
+ public CharacterIterator getText() {
+ return null;
+ }
+
+ public boolean isBoundary(int offset) {
+ return true;
+ }
+
+ public int last() {
+ return 0;
+ }
+
+ public int next() {
+ return 0;
+ }
+
+ public int next(int n) {
+ return 0;
+ }
+
+ public int preceding(int offset) {
+ return 0;
+ }
+
+ public int previous() {
+ return 0;
+ }
+
+ public void setText(CharacterIterator ci) {
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/CollatorProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,68 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class CollatorProviderImpl extends CollatorProvider {
+
+ static Locale[] avail = {
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("xx", "YY", "ZZZZ")};
+
+ static String[] dialect = {
+ "\u3067\u3059\u3002",
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "-xx-YY-ZZZZ"
+ };
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public Collator getInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ RuleBasedCollator ja = (RuleBasedCollator)Collator.getInstance(Locale.JAPANESE);
+ try {
+ return new RuleBasedCollator(ja.getRules()+"& Z < "+dialect[i]);
+ } catch (ParseException pe) {
+System.err.println(pe+ja.getRules()+"& Z < "+dialect[i]);
+ return ja;
+ }
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/DateFormatProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2007, 2010, 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class DateFormatProviderImpl extends DateFormatProvider {
+
+ static Locale[] avail = {
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("yy")};
+
+ static String[] datePattern = {
+ "yyyy'\u5e74'M'\u6708'd'\u65e5'", // full date pattern
+ "yyyy/MMM/dd", // long date pattern
+ "yyyy/MM/dd", // medium date pattern
+ "yy/MM/dd" // short date pattern
+ };
+
+ static String[] timePattern = {
+ "H'\u6642'mm'\u5206'ss'\u79d2' z", // full time pattern
+ "H:mm:ss z", // long time pattern
+ "H:mm:ss", // medium time pattern
+ "H:mm" // short time pattern
+ };
+
+ static String[] dialect = {
+ "\u3067\u3059\u3002",
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "\u308f\u3044\u308f\u3044"
+ };
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public DateFormat getDateInstance(int style, Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooDateFormat(datePattern[style]+dialect[i], locale);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public DateFormat getTimeInstance(int style, Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooDateFormat(timePattern[style]+dialect[i], locale);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public DateFormat getDateTimeInstance(int dateStyle, int timeStyle, Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ return new FooDateFormat(
+ datePattern[dateStyle]+" "+timePattern[timeStyle]+dialect[i], locale);
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/DateFormatSymbolsProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,230 @@
+/*
+ * Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved.
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * This code is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 only, as
+ * published by the Free Software Foundation.
+ *
+ * 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.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class DateFormatSymbolsProviderImpl extends DateFormatSymbolsProvider {
+
+ static Locale[] avail = {
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ Locale.JAPAN,
+ new Locale("yy", "ZZ")
+ };
+ static List<Locale> availList = Arrays.asList(avail);
+
+ static String[] dialect = {
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "\u3067\u3059\u3002",
+ "-yy-ZZ"
+ };
+
+ static Map<Locale, FooDateFormatSymbols> symbols = new HashMap<Locale, FooDateFormatSymbols>(4);
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public DateFormatSymbols getInstance(Locale locale) {
+ if (!Utils.supportsLocale(availList, locale)) {
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ FooDateFormatSymbols fdfs = symbols.get(locale);
+ if (fdfs == null) {
+ for (int index = 0; index < avail.length; index ++) {
+ if (Utils.supportsLocale(avail[index], locale)) {
+ fdfs = new FooDateFormatSymbols(index);
+ symbols.put(locale, fdfs);
+ break;
+ }
+ }
+ }
+ return fdfs;
+ }
+
+ class FooDateFormatSymbols extends DateFormatSymbols {
+ String dialect = "";
+
+ String[] eras = null;
+ String[] months = null;
+ String[] shortMonths = null;
+ String[] weekdays = null;
+ String[] shortWeekdays = null;
+ String[] ampms = null;
+
+ public FooDateFormatSymbols(int index) {
+ super(DateFormatSymbolsProviderImpl.this.avail[index]);
+ dialect = DateFormatSymbolsProviderImpl.this.dialect[index];
+ }
+
+ public String[] getEras() {
+ if (eras == null) {
+ eras = super.getEras();
+ for (int i = 0; i < eras.length; i++) {
+ eras[i] = eras[i]+dialect;
+ }
+ }
+ return eras;
+ }
+
+ /**
+ * Sets era strings. For example: "AD" and "BC".
+ * @param newEras the new era strings.
+ */
+ public void setEras(String[] newEras) {
+ eras = newEras;
+ }
+
+ /**
+ * Gets month strings. For example: "January", "February", etc.
+ * @return the month strings.
+ */
+ public String[] getMonths() {
+ if (months == null) {
+ months = super.getMonths();
+ for (int i = 0; i < months.length; i++) {
+ months[i] = months[i]+dialect;
+ }
+ }
+ return months;
+ }
+
+ /**
+ * Sets month strings. For example: "January", "February", etc.
+ * @param newMonths the new month strings.
+ */
+ public void setMonths(String[] newMonths) {
+ months = newMonths;
+ }
+
+ /**
+ * Gets short month strings. For example: "Jan", "Feb", etc.
+ * @return the short month strings.
+ */
+ public String[] getShortMonths() {
+ if (shortMonths == null) {
+ shortMonths = super.getShortMonths();
+ for (int i = 0; i < shortMonths.length; i++) {
+ shortMonths[i] = shortMonths[i]+dialect;
+ }
+ }
+ return shortMonths;
+ }
+
+ /**
+ * Sets short month strings. For example: "Jan", "Feb", etc.
+ * @param newShortMonths the new short month strings.
+ */
+ public void setShortMonths(String[] newShortMonths) {
+ shortMonths = newShortMonths;
+ }
+
+ /**
+ * Gets weekday strings. For example: "Sunday", "Monday", etc.
+ * @return the weekday strings. Use <code>Calendar.SUNDAY</code>,
+ * <code>Calendar.MONDAY</code>, etc. to index the result array.
+ */
+ public String[] getWeekdays() {
+ if (weekdays == null) {
+ weekdays = super.getWeekdays();
+ for (int i = 0; i < weekdays.length; i++) {
+ weekdays[i] = weekdays[i]+dialect;
+ }
+ }
+ return weekdays;
+ }
+
+ /**
+ * Sets weekday strings. For example: "Sunday", "Monday", etc.
+ * @param newWeekdays the new weekday strings. The array should
+ * be indexed by <code>Calendar.SUNDAY</code>,
+ * <code>Calendar.MONDAY</code>, etc.
+ */
+ public void setWeekdays(String[] newWeekdays) {
+ weekdays = newWeekdays;
+ }
+
+ /**
+ * Gets short weekday strings. For example: "Sun", "Mon", etc.
+ * @return the short weekday strings. Use <code>Calendar.SUNDAY</code>,
+ * <code>Calendar.MONDAY</code>, etc. to index the result array.
+ */
+ public String[] getShortWeekdays() {
+ if (shortWeekdays == null) {
+ shortWeekdays = super.getShortWeekdays();
+ for (int i = 0; i < shortWeekdays.length; i++) {
+ shortWeekdays[i] = shortWeekdays[i]+dialect;
+ }
+ }
+ return shortWeekdays;
+ }
+
+ /**
+ * Sets short weekday strings. For example: "Sun", "Mon", etc.
+ * @param newShortWeekdays the new short weekday strings. The array should
+ * be indexed by <code>Calendar.SUNDAY</code>,
+ * <code>Calendar.MONDAY</code>, etc.
+ */
+ public void setShortWeekdays(String[] newShortWeekdays) {
+ shortWeekdays = newShortWeekdays;
+ }
+
+ /**
+ * Gets ampm strings. For example: "AM" and "PM".
+ * @return the ampm strings.
+ */
+ public String[] getAmPmStrings() {
+ if (ampms == null) {
+ ampms = super.getAmPmStrings();
+ for (int i = 0; i < ampms.length; i++) {
+ ampms[i] = ampms[i]+dialect;
+ }
+ }
+ return ampms;
+ }
+
+ /**
+ * Sets ampm strings. For example: "AM" and "PM".
+ * @param newAmpms the new ampm strings.
+ */
+ public void setAmPmStrings(String[] newAmpms) {
+ ampms = newAmpms;
+ }
+
+ @Override
+ public String[][] getZoneStrings() {
+ return new String[0][0];
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/DecimalFormatSymbolsProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,110 @@
+/*
+ * Copyright (c) 2007, 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class DecimalFormatSymbolsProviderImpl extends DecimalFormatSymbolsProvider {
+
+ static Locale[] avail = {
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ Locale.JAPAN,
+ new Locale("yy", "ZZ", "UUU")
+ };
+ static List<Locale> availList = Arrays.asList(avail);
+
+ static String[] dialect = {
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "\u3067\u3059\u3002",
+ "-yy-ZZ-UUU"
+ };
+
+ static HashMap<Locale, FooDecimalFormatSymbols> symbols = new HashMap<Locale, FooDecimalFormatSymbols>(4);
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public DecimalFormatSymbols getInstance(Locale locale) {
+ if (!Utils.supportsLocale(availList, locale)) {
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ FooDecimalFormatSymbols fdfs = symbols.get(locale);
+ if (fdfs == null) {
+ for (int index = 0; index < avail.length; index ++) {
+ if (Utils.supportsLocale(avail[index], locale)) {
+ fdfs = new FooDecimalFormatSymbols(index);
+ symbols.put(locale, fdfs);
+ break;
+ }
+ }
+ }
+ return fdfs;
+ }
+
+ class FooDecimalFormatSymbols extends DecimalFormatSymbols {
+ String dialect = "";
+
+ String infinity = null;
+ String nan = null;
+
+ public FooDecimalFormatSymbols(int index) {
+ super(DecimalFormatSymbolsProviderImpl.this.avail[index]);
+ dialect = DecimalFormatSymbolsProviderImpl.this.dialect[index];
+ }
+
+ // overrides methods only returns Strings
+ public String getInfinity() {
+ if (infinity == null) {
+ infinity = super.getInfinity() + dialect;
+ }
+ return infinity;
+ }
+
+ public void setInfinity(String infinity) {
+ this.infinity = infinity;
+ }
+
+ public String getNaN() {
+ if (nan == null) {
+ nan = super.getNaN() + dialect;
+ }
+ return nan;
+ }
+
+ public void setNaN(String nan) {
+ this.nan = nan;
+ }
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/FooDateFormat.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,61 @@
+/*
+ * Copyright (c) 2010, 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.
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.util.*;
+
+/**
+ * FooDateFormat provides SimpleDateFormat methods required for the SPI testing.
+ */
+public class FooDateFormat extends DateFormat {
+ private SimpleDateFormat sdf;
+
+ public FooDateFormat(String pattern, Locale loc) {
+ sdf = new SimpleDateFormat(pattern, loc);
+ }
+
+ @Override
+ public StringBuffer format(Date date,
+ StringBuffer toAppendTo,
+ FieldPosition fieldPosition) {
+ return sdf.format(date, toAppendTo, fieldPosition);
+ }
+
+ @Override
+ public Date parse(String source, ParsePosition pos) {
+ return sdf.parse(source, pos);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof FooDateFormat
+ && sdf.equals(((FooDateFormat)other).sdf);
+ }
+
+ @Override
+ public int hashCode() {
+ return sdf.hashCode();
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/FooNumberFormat.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,81 @@
+/*
+ * Copyright (c) 2010, 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.
+ */
+
+package com.foo;
+
+import java.text.*;
+
+/**
+ * FooNumberFormat provides DecimalFormat methods required for the SPI testing.
+ */
+public class FooNumberFormat extends NumberFormat {
+ private DecimalFormat df;
+
+ public FooNumberFormat(String pattern, DecimalFormatSymbols dfs) {
+ df = new DecimalFormat(pattern, dfs);
+ }
+
+ @Override
+ public StringBuffer format(double number,
+ StringBuffer toAppendTo,
+ FieldPosition pos) {
+ return df.format(number, toAppendTo, pos);
+ }
+
+ @Override
+ public StringBuffer format(long number,
+ StringBuffer toAppendTo,
+ FieldPosition pos) {
+ return df.format(number, toAppendTo, pos);
+ }
+
+ @Override
+ public Number parse(String source, ParsePosition parsePosition) {
+ return df.parse(source, parsePosition);
+ }
+
+ @Override
+ public boolean equals(Object other) {
+ return other instanceof FooNumberFormat
+ && df.equals(((FooNumberFormat)other).df);
+ }
+
+ @Override
+ public int hashCode() {
+ return df.hashCode();
+ }
+
+ // DecimalFormat specific methods required for testing
+
+ public String toPattern() {
+ return df.toPattern();
+ }
+
+ public DecimalFormatSymbols getDecimalFormatSymbols() {
+ return df.getDecimalFormatSymbols();
+ }
+
+ public void setDecimalSeparatorAlwaysShown(boolean newValue) {
+ df.setDecimalSeparatorAlwaysShown(newValue);
+ }
+}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/java/util/PluggableLocale/providersrc/fooprovider/com/foo/NumberFormatProviderImpl.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,156 @@
+/*
+ * Copyright (c) 2007, 2010, 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.
+ */
+/*
+ *
+ */
+
+package com.foo;
+
+import java.text.*;
+import java.text.spi.*;
+import java.util.*;
+
+import com.foobar.Utils;
+
+public class NumberFormatProviderImpl extends NumberFormatProvider {
+
+ static Locale[] avail = {
+ Locale.JAPAN,
+ new Locale("ja", "JP", "osaka"),
+ new Locale("ja", "JP", "kyoto"),
+ new Locale("zz")};
+
+ static String[] dialect = {
+ "\u3067\u3059\u3002",
+ "\u3084\u3002",
+ "\u3069\u3059\u3002",
+ "-zz"
+ };
+
+ static String[] patterns = {
+ "#,##0.###{0};-#,##0.###{1}", // decimal pattern
+ "#{0};(#){1}", // integer pattern
+ "\u00A4#,##0{0};-\u00A4#,##0{1}", // currency pattern
+ "#,##0%{0}" // percent pattern
+ };
+ // Constants used by factory methods to specify a style of format.
+ static final int NUMBERSTYLE = 0;
+ static final int INTEGERSTYLE = 1;
+ static final int CURRENCYSTYLE = 2;
+ static final int PERCENTSTYLE = 3;
+
+ public Locale[] getAvailableLocales() {
+ return avail;
+ }
+
+ public NumberFormat getCurrencyInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ String pattern =
+ MessageFormat.format(patterns[CURRENCYSTYLE],
+ dialect[i],
+ dialect[i]);
+ FooNumberFormat nf = new FooNumberFormat(pattern,
+ DecimalFormatSymbols.getInstance(locale));
+ adjustForCurrencyDefaultFractionDigits(nf);
+ return nf;
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public NumberFormat getIntegerInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ String pattern =
+ MessageFormat.format(patterns[INTEGERSTYLE],
+ dialect[i],
+ dialect[i]);
+ FooNumberFormat nf = new FooNumberFormat(pattern,
+ DecimalFormatSymbols.getInstance(locale));
+ nf.setMaximumFractionDigits(0);
+ nf.setDecimalSeparatorAlwaysShown(false);
+ nf.setParseIntegerOnly(true);
+ return nf;
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public NumberFormat getNumberInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ String pattern =
+ MessageFormat.format(patterns[NUMBERSTYLE],
+ dialect[i],
+ dialect[i]);
+ return new FooNumberFormat(pattern,
+ DecimalFormatSymbols.getInstance(locale));
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ public NumberFormat getPercentInstance(Locale locale) {
+ for (int i = 0; i < avail.length; i ++) {
+ if (Utils.supportsLocale(avail[i], locale)) {
+ String pattern =
+ MessageFormat.format(patterns[PERCENTSTYLE],
+ dialect[i]);
+ return new FooNumberFormat(pattern,
+ DecimalFormatSymbols.getInstance(locale));
+ }
+ }
+ throw new IllegalArgumentException("locale is not supported: "+locale);
+ }
+
+ /**
+ * Adjusts the minimum and maximum fraction digits to values that
+ * are reasonable for the currency's default fraction digits.
+ */
+ void adjustForCurrencyDefaultFractionDigits(FooNumberFormat nf) {
+ DecimalFormatSymbols dfs = nf.getDecimalFormatSymbols();
+ Currency currency = dfs.getCurrency();
+ if (currency == null) {
+ try {
+ currency = Currency.getInstance(dfs.getInternationalCurrencySymbol());
+ } catch (IllegalArgumentException e) {
+ }
+ }
+ if (currency != null) {
+ int digits = currency.getDefaultFractionDigits();
+ if (digits != -1) {
+ int oldMinDigits = nf.getMinimumFractionDigits();
+ // Common patterns are "#.##", "#.00", "#".
+ // Try to adjust all of them in a reasonable way.
+ if (oldMinDigits == nf.getMaximumFractionDigits()) {
+ nf.setMinimumFractionDigits(digits);
+ nf.setMaximumFractionDigits(digits);
+ } else {
+ nf.setMinimumFractionDigits(Math.min(digits, oldMinDigits));
+ nf.setMaximumFractionDigits(digits);
+ }
+ }
+ }
+ }
+}
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.BreakIteratorProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.BreakIteratorProvider
-# implementation class
-#
-com.foo.BreakIteratorProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.CollatorProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.CollatorProvider
-# implementation class
-#
-com.foo.CollatorProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DateFormatProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.DateFormatProvider
-# implementation class
-#
-com.foo.DateFormatProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DateFormatSymbolsProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.DateFormatProvider
-# implementation class
-#
-com.foo.DateFormatSymbolsProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.DecimalFormatSymbolsProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.DecimalFormatProvider
-# implementation class
-#
-com.foo.DecimalFormatSymbolsProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.text.spi.NumberFormatProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.text.spi.NumberFormatProvider
-# implementation class
-#
-com.foo.NumberFormatProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CalendarDataProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.CalendarDataProvider
-# implementation class
-#
-com.bar.CalendarDataProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CalendarNameProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.CalendarNameProvider
-# implementation class
-#
-com.bar.CalendarNameProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.CurrencyNameProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.LocaleNameProvider
-# implementation class
-#
-com.bar.CurrencyNameProviderImpl
-com.bar.CurrencyNameProviderImpl2
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.LocaleNameProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,7 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.LocaleNameProvider
-# implementation class
-#
-com.bar.LocaleNameProviderImpl
--- a/test/jdk/java/util/PluggableLocale/providersrc/java.util.spi.TimeZoneNameProvider Fri Oct 19 11:15:57 2018 -0700
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,8 +0,0 @@
-#
-#
-#
-# fully-qualified name of the java.util.spi.TimeZoneNameProvider
-# implementation class
-#
-com.bar.TimeZoneNameProviderImpl
-com.bar.GenericTimeZoneNameProviderImpl
--- a/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/java/util/jar/JarFile/mrjar/MultiReleaseJarAPI.java Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2015, 2017, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2015, 2018, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -23,7 +23,7 @@
/*
* @test
- * @bug 8132734 8144062 8165723
+ * @bug 8132734 8144062 8165723 8199172
* @summary Test the extended API and the aliasing additions in JarFile that
* support multi-release jar files
* @library /lib/testlibrary/java/util/jar /test/lib
@@ -100,16 +100,30 @@
testCustomMultiReleaseValue("true", true);
testCustomMultiReleaseValue("true\r\nOther: value", true);
testCustomMultiReleaseValue("true\nOther: value", true);
- testCustomMultiReleaseValue("true\rOther: value", true);
+ // JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately
+ // testCustomMultiReleaseValue("true\rOther: value", true);
testCustomMultiReleaseValue("false", false);
testCustomMultiReleaseValue(" true", false);
testCustomMultiReleaseValue("true ", false);
- testCustomMultiReleaseValue("true\n ", false);
- testCustomMultiReleaseValue("true\r ", false);
testCustomMultiReleaseValue("true\n true", false);
+
+ // JDK-8200530: '\r' support in Manifest/Attributes will be addressed separately
+ testCustomMultiReleaseValue("true\r true", false);
testCustomMultiReleaseValue("true\r\n true", false);
+ // "Multi-Release: true/false" not in main attributes
+ testCustomMultiReleaseValue("\r\n\r\nName: test\r\nMulti-Release: true\r\n",
+ false);
+ testCustomMultiReleaseValue("\n\nName: entryname\nMulti-Release: true\n",
+ false);
+ testCustomMultiReleaseValue("EndOfMainAttr: whatever\r\n" +
+ "\r\nName: entryname\r\nMulti-Release: true\r\n",
+ false);
+ testCustomMultiReleaseValue("EndOfMainAttr: whatever\r\n" +
+ "\nName: entryname\nMulti-Release: true\n",
+ false);
+
// generate "random" Strings to use as extra attributes, and
// verify that Multi-Release: true is always properly matched
for (int i = 0; i < 100; i++) {
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/SSLSession/ResumeTLS13withSNI.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,586 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+// SunJSSE does not support dynamic system properties, no way to re-use
+// system properties in samevm/agentvm mode.
+
+/*
+ * @test
+ * @bug 8211806
+ * @summary TLS 1.3 handshake server name indication is missing on a session resume
+ * @run main/othervm ResumeTLS13withSNI
+ */
+
+import javax.net.ssl.*;
+import javax.net.ssl.SSLEngineResult.*;
+import java.io.*;
+import java.security.*;
+import java.nio.*;
+import java.util.List;
+
+public class ResumeTLS13withSNI {
+
+ /*
+ * Enables logging of the SSLEngine operations.
+ */
+ private static final boolean logging = false;
+
+ /*
+ * Enables the JSSE system debugging system property:
+ *
+ * -Djavax.net.debug=ssl:handshake
+ *
+ * This gives a lot of low-level information about operations underway,
+ * including specific handshake messages, and might be best examined
+ * after gaining some familiarity with this application.
+ */
+ private static final boolean debug = true;
+
+ private static final ByteBuffer clientOut =
+ ByteBuffer.wrap("Hi Server, I'm Client".getBytes());
+ private static final ByteBuffer serverOut =
+ ByteBuffer.wrap("Hello Client, I'm Server".getBytes());
+
+ /*
+ * The following is to set up the keystores.
+ */
+ private static final String pathToStores = "../etc";
+ private static final String keyStoreFile = "keystore";
+ private static final String trustStoreFile = "truststore";
+ private static final char[] passphrase = "passphrase".toCharArray();
+
+ private static final String keyFilename =
+ System.getProperty("test.src", ".") + "/" + pathToStores +
+ "/" + keyStoreFile;
+ private static final String trustFilename =
+ System.getProperty("test.src", ".") + "/" + pathToStores +
+ "/" + trustStoreFile;
+
+ private static final String HOST_NAME = "arf.yak.foo";
+ private static final SNIHostName SNI_NAME = new SNIHostName(HOST_NAME);
+ private static final SNIMatcher SNI_MATCHER =
+ SNIHostName.createSNIMatcher("arf\\.yak\\.foo");
+
+ /*
+ * Main entry point for this test.
+ */
+ public static void main(String args[]) throws Exception {
+ if (debug) {
+ System.setProperty("javax.net.debug", "ssl:handshake");
+ }
+
+ KeyManagerFactory kmf = makeKeyManagerFactory(keyFilename,
+ passphrase);
+ TrustManagerFactory tmf = makeTrustManagerFactory(trustFilename,
+ passphrase);
+
+ SSLContext sslCtx = SSLContext.getInstance("TLS");
+ sslCtx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+
+ // Make client and server engines, then customize as needed
+ SSLEngine clientEngine = makeEngine(sslCtx, kmf, tmf, true);
+ SSLParameters cliSSLParams = clientEngine.getSSLParameters();
+ cliSSLParams.setServerNames(List.of(SNI_NAME));
+ clientEngine.setSSLParameters(cliSSLParams);
+ clientEngine.setEnabledProtocols(new String[] { "TLSv1.3" });
+
+ SSLEngine serverEngine = makeEngine(sslCtx, kmf, tmf, false);
+ SSLParameters servSSLParams = serverEngine.getSSLParameters();
+ servSSLParams.setSNIMatchers(List.of(SNI_MATCHER));
+ serverEngine.setSSLParameters(servSSLParams);
+
+ initialHandshake(clientEngine, serverEngine);
+
+ // Create a new client-side engine which can initiate TLS session
+ // resumption
+ SSLEngine newCliEngine = makeEngine(sslCtx, kmf, tmf, true);
+ newCliEngine.setEnabledProtocols(new String[] { "TLSv1.3" });
+ ByteBuffer resCliHello = getResumptionClientHello(newCliEngine);
+
+ dumpBuffer("Resumed ClientHello Data", resCliHello);
+
+ // Parse the client hello message and make sure it is a resumption
+ // hello and has SNI in it.
+ checkResumedClientHelloSNI(resCliHello);
+ }
+
+ /*
+ * Run the test.
+ *
+ * Sit in a tight loop, both engines calling wrap/unwrap regardless
+ * of whether data is available or not. We do this until both engines
+ * report back they are closed.
+ *
+ * The main loop handles all of the I/O phases of the SSLEngine's
+ * lifetime:
+ *
+ * initial handshaking
+ * application data transfer
+ * engine closing
+ *
+ * One could easily separate these phases into separate
+ * sections of code.
+ */
+ private static void initialHandshake(SSLEngine clientEngine,
+ SSLEngine serverEngine) throws Exception {
+ boolean dataDone = false;
+
+ // Create all the buffers
+ SSLSession session = clientEngine.getSession();
+ int appBufferMax = session.getApplicationBufferSize();
+ int netBufferMax = session.getPacketBufferSize();
+ ByteBuffer clientIn = ByteBuffer.allocate(appBufferMax + 50);
+ ByteBuffer serverIn = ByteBuffer.allocate(appBufferMax + 50);
+ ByteBuffer cTOs = ByteBuffer.allocateDirect(netBufferMax);
+ ByteBuffer sTOc = ByteBuffer.allocateDirect(netBufferMax);
+
+ // results from client's last operation
+ SSLEngineResult clientResult;
+
+ // results from server's last operation
+ SSLEngineResult serverResult;
+
+ /*
+ * Examining the SSLEngineResults could be much more involved,
+ * and may alter the overall flow of the application.
+ *
+ * For example, if we received a BUFFER_OVERFLOW when trying
+ * to write to the output pipe, we could reallocate a larger
+ * pipe, but instead we wait for the peer to drain it.
+ */
+ Exception clientException = null;
+ Exception serverException = null;
+
+ while (!dataDone) {
+ log("================");
+
+ try {
+ clientResult = clientEngine.wrap(clientOut, cTOs);
+ log("client wrap: ", clientResult);
+ } catch (Exception e) {
+ clientException = e;
+ System.err.println("Client wrap() threw: " + e.getMessage());
+ }
+ logEngineStatus(clientEngine);
+ runDelegatedTasks(clientEngine);
+
+ log("----");
+
+ try {
+ serverResult = serverEngine.wrap(serverOut, sTOc);
+ log("server wrap: ", serverResult);
+ } catch (Exception e) {
+ serverException = e;
+ System.err.println("Server wrap() threw: " + e.getMessage());
+ }
+ logEngineStatus(serverEngine);
+ runDelegatedTasks(serverEngine);
+
+ cTOs.flip();
+ sTOc.flip();
+
+ log("--------");
+
+ try {
+ clientResult = clientEngine.unwrap(sTOc, clientIn);
+ log("client unwrap: ", clientResult);
+ } catch (Exception e) {
+ clientException = e;
+ System.err.println("Client unwrap() threw: " + e.getMessage());
+ }
+ logEngineStatus(clientEngine);
+ runDelegatedTasks(clientEngine);
+
+ log("----");
+
+ try {
+ serverResult = serverEngine.unwrap(cTOs, serverIn);
+ log("server unwrap: ", serverResult);
+ } catch (Exception e) {
+ serverException = e;
+ System.err.println("Server unwrap() threw: " + e.getMessage());
+ }
+ logEngineStatus(serverEngine);
+ runDelegatedTasks(serverEngine);
+
+ cTOs.compact();
+ sTOc.compact();
+
+ /*
+ * After we've transfered all application data between the client
+ * and server, we close the clientEngine's outbound stream.
+ * This generates a close_notify handshake message, which the
+ * server engine receives and responds by closing itself.
+ */
+ if (!dataDone && (clientOut.limit() == serverIn.position()) &&
+ (serverOut.limit() == clientIn.position())) {
+
+ /*
+ * A sanity check to ensure we got what was sent.
+ */
+ checkTransfer(serverOut, clientIn);
+ checkTransfer(clientOut, serverIn);
+
+ dataDone = true;
+ }
+ }
+ }
+
+ /**
+ * The goal of this function is to start a simple TLS session resumption
+ * and get the client hello message data back so it can be inspected.
+ *
+ * @param clientEngine
+ *
+ * @return a ByteBuffer consisting of the ClientHello TLS record.
+ *
+ * @throws Exception if any processing goes wrong.
+ */
+ private static ByteBuffer getResumptionClientHello(SSLEngine clientEngine)
+ throws Exception {
+ // Create all the buffers
+ SSLSession session = clientEngine.getSession();
+ int appBufferMax = session.getApplicationBufferSize();
+ int netBufferMax = session.getPacketBufferSize();
+ ByteBuffer cTOs = ByteBuffer.allocateDirect(netBufferMax);
+ Exception clientException = null;
+
+ // results from client's last operation
+ SSLEngineResult clientResult;
+
+ // results from server's last operation
+ SSLEngineResult serverResult;
+
+ log("================");
+
+ // Start by having the client create a new ClientHello. It should
+ // contain PSK info that allows it to attempt session resumption.
+ try {
+ clientResult = clientEngine.wrap(clientOut, cTOs);
+ log("client wrap: ", clientResult);
+ } catch (Exception e) {
+ clientException = e;
+ System.err.println("Client wrap() threw: " + e.getMessage());
+ }
+ logEngineStatus(clientEngine);
+ runDelegatedTasks(clientEngine);
+
+ log("----");
+
+ cTOs.flip();
+ return cTOs;
+ }
+
+ /**
+ * This method walks a ClientHello TLS record, looking for a matching
+ * server_name hostname value from the original handshake and a PSK
+ * extension, which indicates (in the context of this test) that this
+ * is a resumed handshake.
+ *
+ * @param resCliHello a ByteBuffer consisting of a complete TLS handshake
+ * record that is a ClientHello message. The position of the buffer
+ * must be at the beginning of the TLS record header.
+ *
+ * @throws Exception if any of the consistency checks for the TLS record,
+ * or handshake message fails. It will also throw an exception if
+ * either the server_name extension doesn't have a matching hostname
+ * field or the pre_shared_key extension is not present.
+ */
+ private static void checkResumedClientHelloSNI(ByteBuffer resCliHello)
+ throws Exception {
+ boolean foundMatchingSNI = false;
+ boolean foundPSK = false;
+
+ // Advance past the following fields:
+ // TLS Record header (5 bytes)
+ resCliHello.position(resCliHello.position() + 5);
+
+ // Get the next byte and make sure it is a Client Hello
+ byte hsMsgType = resCliHello.get();
+ if (hsMsgType != 0x01) {
+ throw new Exception("Message is not a ClientHello, MsgType = " +
+ hsMsgType);
+ }
+
+ // Skip past the length (3 bytes)
+ resCliHello.position(resCliHello.position() + 3);
+
+ // Protocol version should be TLSv1.2 (0x03, 0x03)
+ short chProto = resCliHello.getShort();
+ if (chProto != 0x0303) {
+ throw new Exception(
+ "Client Hello protocol version is not TLSv1.2: Got " +
+ String.format("0x%04X", chProto));
+ }
+
+ // Skip 32-bytes of random data
+ resCliHello.position(resCliHello.position() + 32);
+
+ // Get the legacy session length and skip that many bytes
+ int sessIdLen = Byte.toUnsignedInt(resCliHello.get());
+ resCliHello.position(resCliHello.position() + sessIdLen);
+
+ // Skip over all the cipher suites
+ int csLen = Short.toUnsignedInt(resCliHello.getShort());
+ resCliHello.position(resCliHello.position() + csLen);
+
+ // Skip compression methods
+ int compLen = Byte.toUnsignedInt(resCliHello.get());
+ resCliHello.position(resCliHello.position() + compLen);
+
+ // Parse the extensions. Get length first, then walk the extensions
+ // List and look for the presence of the PSK extension and server_name.
+ // For server_name, make sure it is the same as what was provided
+ // in the original handshake.
+ System.err.println("ClientHello Extensions Check");
+ int extListLen = Short.toUnsignedInt(resCliHello.getShort());
+ while (extListLen > 0) {
+ // Get the Extension type and length
+ int extType = Short.toUnsignedInt(resCliHello.getShort());
+ int extLen = Short.toUnsignedInt(resCliHello.getShort());
+ switch (extType) {
+ case 0: // server_name
+ System.err.println("* Found server_name Extension");
+ int snListLen = Short.toUnsignedInt(resCliHello.getShort());
+ while (snListLen > 0) {
+ int nameType = Byte.toUnsignedInt(resCliHello.get());
+ if (nameType == 0) { // host_name
+ int hostNameLen =
+ Short.toUnsignedInt(resCliHello.getShort());
+ byte[] hostNameData = new byte[hostNameLen];
+ resCliHello.get(hostNameData);
+ String hostNameStr = new String(hostNameData);
+ System.err.println("\tHostname: " + hostNameStr);
+ if (hostNameStr.equals(HOST_NAME)) {
+ foundMatchingSNI = true;
+ }
+ snListLen -= 3 + hostNameLen; // type, len, data
+ } else { // something else
+ // We don't support anything else and cannot
+ // know how to advance. Throw an exception
+ throw new Exception("Unknown server name type: " +
+ nameType);
+ }
+ }
+ break;
+ case 41: // pre_shared_key
+ // We're not going to bother checking the value. The
+ // presence of the extension in the context of this test
+ // is good enough to tell us this is a resumed ClientHello.
+ foundPSK = true;
+ System.err.println("* Found pre_shared_key Extension");
+ resCliHello.position(resCliHello.position() + extLen);
+ break;
+ default:
+ System.err.format("* Found extension %d (%d bytes)\n",
+ extType, extLen);
+ resCliHello.position(resCliHello.position() + extLen);
+ break;
+ }
+ extListLen -= extLen + 4; // Ext type(2), length(2), data(var.)
+ }
+
+ // At the end of all the extension processing, either we've found
+ // both extensions and the server_name matches our expected value
+ // or we throw an exception.
+ if (!foundMatchingSNI) {
+ throw new Exception("Could not find a matching server_name");
+ } else if (!foundPSK) {
+ throw new Exception("Missing PSK extension, not a resumption?");
+ }
+ }
+
+ /**
+ * Create a TrustManagerFactory from a given keystore.
+ *
+ * @param tsPath the path to the trust store file.
+ * @param pass the password for the trust store.
+ *
+ * @return a new TrustManagerFactory built from the trust store provided.
+ *
+ * @throws GeneralSecurityException if any processing errors occur
+ * with the Keystore instantiation or TrustManagerFactory creation.
+ * @throws IOException if any loading error with the trust store occurs.
+ */
+ private static TrustManagerFactory makeTrustManagerFactory(String tsPath,
+ char[] pass) throws GeneralSecurityException, IOException {
+ TrustManagerFactory tmf;
+ KeyStore ts = KeyStore.getInstance("JKS");
+
+ try (FileInputStream fsIn = new FileInputStream(tsPath)) {
+ ts.load(fsIn, pass);
+ tmf = TrustManagerFactory.getInstance("SunX509");
+ tmf.init(ts);
+ }
+ return tmf;
+ }
+
+ /**
+ * Create a KeyManagerFactory from a given keystore.
+ *
+ * @param ksPath the path to the keystore file.
+ * @param pass the password for the keystore.
+ *
+ * @return a new TrustManagerFactory built from the keystore provided.
+ *
+ * @throws GeneralSecurityException if any processing errors occur
+ * with the Keystore instantiation or KeyManagerFactory creation.
+ * @throws IOException if any loading error with the keystore occurs
+ */
+ private static KeyManagerFactory makeKeyManagerFactory(String ksPath,
+ char[] pass) throws GeneralSecurityException, IOException {
+ KeyManagerFactory kmf;
+ KeyStore ks = KeyStore.getInstance("JKS");
+
+ try (FileInputStream fsIn = new FileInputStream(ksPath)) {
+ ks.load(fsIn, pass);
+ kmf = KeyManagerFactory.getInstance("SunX509");
+ kmf.init(ks, pass);
+ }
+ return kmf;
+ }
+
+ /**
+ * Create an SSLEngine instance from a given protocol specifier,
+ * KeyManagerFactory and TrustManagerFactory.
+ *
+ * @param ctx the SSLContext used to create the SSLEngine
+ * @param kmf an initialized KeyManagerFactory. May be null.
+ * @param tmf an initialized TrustManagerFactory. May be null.
+ * @param isClient true if it intended to create a client engine, false
+ * for a server engine.
+ *
+ * @return an SSLEngine instance configured as a server and with client
+ * authentication disabled.
+ *
+ * @throws GeneralSecurityException if any errors occur during the
+ * creation of the SSLEngine.
+ */
+ private static SSLEngine makeEngine(SSLContext ctx,
+ KeyManagerFactory kmf, TrustManagerFactory tmf, boolean isClient)
+ throws GeneralSecurityException {
+ ctx.init(kmf.getKeyManagers(), tmf.getTrustManagers(), null);
+ SSLEngine ssle = ctx.createSSLEngine("localhost", 8443);
+ ssle.setUseClientMode(isClient);
+ ssle.setNeedClientAuth(false);
+ return ssle;
+ }
+
+ private static void logEngineStatus(SSLEngine engine) {
+ log("\tCurrent HS State " + engine.getHandshakeStatus().toString());
+ log("\tisInboundDone(): " + engine.isInboundDone());
+ log("\tisOutboundDone(): " + engine.isOutboundDone());
+ }
+
+ /*
+ * If the result indicates that we have outstanding tasks to do,
+ * go ahead and run them in this thread.
+ */
+ private static void runDelegatedTasks(SSLEngine engine) throws Exception {
+
+ if (engine.getHandshakeStatus() == HandshakeStatus.NEED_TASK) {
+ Runnable runnable;
+ while ((runnable = engine.getDelegatedTask()) != null) {
+ log(" running delegated task...");
+ runnable.run();
+ }
+ HandshakeStatus hsStatus = engine.getHandshakeStatus();
+ if (hsStatus == HandshakeStatus.NEED_TASK) {
+ throw new Exception(
+ "handshake shouldn't need additional tasks");
+ }
+ logEngineStatus(engine);
+ }
+ }
+
+ private static boolean isEngineClosed(SSLEngine engine) {
+ return (engine.isOutboundDone() && engine.isInboundDone());
+ }
+
+ /*
+ * Simple check to make sure everything came across as expected.
+ */
+ private static void checkTransfer(ByteBuffer a, ByteBuffer b)
+ throws Exception {
+ a.flip();
+ b.flip();
+
+ if (!a.equals(b)) {
+ throw new Exception("Data didn't transfer cleanly");
+ } else {
+ log("\tData transferred cleanly");
+ }
+
+ a.position(a.limit());
+ b.position(b.limit());
+ a.limit(a.capacity());
+ b.limit(b.capacity());
+ }
+
+ /*
+ * Logging code
+ */
+ private static boolean resultOnce = true;
+
+ private static void log(String str, SSLEngineResult result) {
+ if (!logging) {
+ return;
+ }
+ if (resultOnce) {
+ resultOnce = false;
+ System.err.println("The format of the SSLEngineResult is: \n" +
+ "\t\"getStatus() / getHandshakeStatus()\" +\n" +
+ "\t\"bytesConsumed() / bytesProduced()\"\n");
+ }
+ HandshakeStatus hsStatus = result.getHandshakeStatus();
+ log(str +
+ result.getStatus() + "/" + hsStatus + ", " +
+ result.bytesConsumed() + "/" + result.bytesProduced() +
+ " bytes");
+ if (hsStatus == HandshakeStatus.FINISHED) {
+ log("\t...ready for application data");
+ }
+ }
+
+ private static void log(String str) {
+ if (logging) {
+ System.err.println(str);
+ }
+ }
+
+ private static void dumpBuffer(String header, ByteBuffer data) {
+ data.mark();
+ System.err.format("========== %s ==========\n", header);
+ int i = 0;
+ while (data.remaining() > 0) {
+ if (i != 0 && i % 16 == 0) {
+ System.err.print("\n");
+ }
+ System.err.format("%02X ", data.get());
+ i++;
+ }
+ System.err.println();
+ data.reset();
+ }
+
+}
--- a/test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/javax/net/ssl/TLSCommon/CipherSuite.java Tue Oct 16 23:21:05 2018 +0530
@@ -21,210 +21,216 @@
* questions.
*/
+/*
+ * SSL/TLS cipher suites.
+ */
public enum CipherSuite {
- TLS_AES_256_GCM_SHA384(
- 0x1302, Protocol.TLSV1_3, Protocol.TLSV1_3),
- TLS_AES_128_GCM_SHA256(
- 0x1301, Protocol.TLSV1_3, Protocol.TLSV1_3),
- TLS_CHACHA20_POLY1305_SHA256(
- 0x1303, Protocol.TLSV1_3, Protocol.TLSV1_3),
TLS_DHE_RSA_WITH_CHACHA20_POLY1305_SHA256(
- 0xCCAA, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xCCAA, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_CHACHA20_POLY1305_SHA256(
- 0xCCA9, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xCCA9, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_CHACHA20_POLY1305_SHA256(
- 0xCCA8, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xCCA8, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_AES_256_GCM_SHA384(
- 0xC032, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC032, KeyExAlgorithm.ECDH_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_AES_128_GCM_SHA256(
- 0xC031, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC031, KeyExAlgorithm.ECDH_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384(
- 0xC030, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC030, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256(
- 0xC02F, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC02F, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_AES_256_GCM_SHA384(
- 0xC02E, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC02E, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_AES_128_GCM_SHA256(
- 0xC02D, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC02D, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_AES_256_GCM_SHA384(
- 0xC02C, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC02C, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_AES_128_GCM_SHA256(
- 0xC02B, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC02B, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA384(
- 0xC02A, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC02A, KeyExAlgorithm.ECDH_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA256(
- 0xC029, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC029, KeyExAlgorithm.ECDH_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384(
- 0xC028, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC028, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256(
- 0xC027, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC027, KeyExAlgorithm.ECDHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA384(
- 0xC026, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC026, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA(
- 0xC025, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC025, KeyExAlgorithm.ECDH_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_AES_128_CBC_SHA256(
- 0xC025, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC025, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA384(
- 0xC024, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC024, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA256(
- 0xC023, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0xC023, KeyExAlgorithm.ECDHE_ECDSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_anon_WITH_AES_256_CBC_SHA(
- 0xC019, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC019, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_anon_WITH_AES_128_CBC_SHA(
- 0xC018, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC018, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_anon_WITH_3DES_EDE_CBC_SHA(
- 0xC017, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC017, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_anon_WITH_RC4_128_SHA(
- 0xC016, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC016, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_anon_WITH_NULL_SHA(
- 0xC015, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC015, KeyExAlgorithm.ECDH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA(
- 0xC014, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC014, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA(
- 0xC013, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC013, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_3DES_EDE_CBC_SHA(
- 0xC012, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC012, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_RC4_128_SHA(
- 0xC011, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC011, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_RSA_WITH_NULL_SHA(
- 0xC010, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC010, KeyExAlgorithm.ECDHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_AES_256_CBC_SHA(
- 0xC00F, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC00F, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_AES_128_CBC_SHA(
- 0xC00E, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC00E, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_3DES_EDE_CBC_SHA(
- 0xC00D, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC00D, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_RC4_128_SHA(
- 0xC00C, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC00C, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_RSA_WITH_NULL_SHA(
- 0xC00B, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC00B, KeyExAlgorithm.ECDH_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_AES_256_CBC_SHA(
- 0xC00A, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC00A, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_AES_128_CBC_SHA(
- 0xC009, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC009, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_3DES_EDE_CBC_SHA(
- 0xC008, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC008, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_RC4_128_SHA(
- 0xC007, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC007, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDHE_ECDSA_WITH_NULL_SHA(
- 0xC006, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC006, KeyExAlgorithm.ECDHE_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_3DES_EDE_CBC_SHA(
- 0xC003, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC003, KeyExAlgorithm.ECDH_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_RC4_128_SHA(
- 0xC002, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC002, KeyExAlgorithm.ECDH_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_NULL_SHA(
- 0xC001, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0xC001, KeyExAlgorithm.ECDH_ECDSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_EMPTY_RENEGOTIATION_INFO_SCSV(
- 0x00FF, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x00FF, KeyExAlgorithm.SCSV, Protocol.SSLV3, Protocol.TLSV1_2),
+ TLS_AES_256_GCM_SHA384(
+ 0x1302, null, Protocol.TLSV1_3, Protocol.TLSV1_3),
+ TLS_AES_128_GCM_SHA256(
+ 0x1301, null, Protocol.TLSV1_3, Protocol.TLSV1_3),
+ TLS_CHACHA20_POLY1305_SHA256(
+ 0x1303, null, Protocol.TLSV1_3, Protocol.TLSV1_3),
TLS_DH_anon_WITH_AES_256_GCM_SHA384(
- 0x00A7, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x00A7, KeyExAlgorithm.DH_ANON, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DH_anon_WITH_AES_128_GCM_SHA256(
- 0x00A6, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x00A6, KeyExAlgorithm.DH_ANON, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DHE_DSS_WITH_AES_256_GCM_SHA384(
- 0x00A3, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x00A3, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DHE_DSS_WITH_AES_128_GCM_SHA256(
- 0x00A2, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x00A2, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DHE_RSA_WITH_AES_256_GCM_SHA384(
- 0x009F, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x009F, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DHE_RSA_WITH_AES_128_GCM_SHA256(
- 0x009E, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x009E, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_RSA_WITH_AES_256_GCM_SHA384(
- 0x009D, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x009D, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_RSA_WITH_AES_128_GCM_SHA256(
- 0x009C, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x009C, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DH_anon_WITH_AES_256_CBC_SHA256(
- 0x006D, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x006D, KeyExAlgorithm.DH_ANON, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DH_anon_WITH_AES_128_CBC_SHA256(
- 0x006C, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x006C, KeyExAlgorithm.DH_ANON, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DHE_RSA_WITH_AES_256_CBC_SHA256(
- 0x006B, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x006B, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DHE_DSS_WITH_AES_256_CBC_SHA256(
- 0x006A, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x006A, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DHE_RSA_WITH_AES_128_CBC_SHA256(
- 0x0067, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x0067, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_ECDH_ECDSA_WITH_AES_256_CBC_SHA(
- 0x004C, Protocol.TLSV1, Protocol.TLSV1_2),
+ 0x004C, KeyExAlgorithm.ECDH_ECDSA, Protocol.TLSV1, Protocol.TLSV1_2),
TLS_DHE_DSS_WITH_AES_128_CBC_SHA256(
- 0x0040, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x0040, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_RSA_WITH_AES_256_CBC_SHA256(
- 0x003D, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x003D, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_RSA_WITH_AES_128_CBC_SHA256(
- 0x003C, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x003C, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_RSA_WITH_NULL_SHA256(
- 0x003B, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x003B, KeyExAlgorithm.RSA, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_DH_anon_WITH_AES_256_CBC_SHA(
- 0x003A, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x003A, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_DHE_RSA_WITH_AES_256_CBC_SHA(
- 0x0039, Protocol.TLSV1, Protocol.TLSV1_2),
+ 0x0039, KeyExAlgorithm.DHE_RSA, Protocol.TLSV1, Protocol.TLSV1_2),
TLS_DHE_DSS_WITH_AES_256_CBC_SHA(
- 0x0038, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x0038, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_RSA_WITH_AES_256_CBC_SHA(
- 0x0035, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0035, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_DH_anon_WITH_AES_128_CBC_SHA(
- 0x0034, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0034, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_DHE_RSA_WITH_AES_128_CBC_SHA(
- 0x0033, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0033, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_DHE_DSS_WITH_AES_128_CBC_SHA(
- 0x0032, Protocol.TLSV1_2, Protocol.TLSV1_2),
+ 0x0032, KeyExAlgorithm.DHE_DSS, Protocol.TLSV1_2, Protocol.TLSV1_2),
TLS_RSA_WITH_AES_128_CBC_SHA(
- 0x002F, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x002F, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_KRB5_WITH_3DES_EDE_CBC_MD5(
- 0x0023, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0023, KeyExAlgorithm.KRB5, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_KRB5_WITH_DES_CBC_MD5(
- 0x0022, Protocol.SSLV3, Protocol.TLSV1_1),
+ 0x0022,KeyExAlgorithm.KRB5, Protocol.SSLV3, Protocol.TLSV1_1),
TLS_KRB5_WITH_3DES_EDE_CBC_SHA(
- 0x001F, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x001F, KeyExAlgorithm.KRB5, Protocol.SSLV3, Protocol.TLSV1_2),
TLS_KRB5_WITH_DES_CBC_SHA(
- 0x001E, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x001E, KeyExAlgorithm.KRB5, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_DH_anon_WITH_3DES_EDE_CBC_SHA(
- 0x001B, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x001B, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_DH_anon_WITH_DES_CBC_SHA(
- 0x001A, Protocol.SSLV3, Protocol.TLSV1_1),
+ 0x001A, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_1),
SSL_DH_anon_EXPORT_WITH_DES40_CBC_SHA(
- 0x0019, Protocol.SSLV3, Protocol.TLSV1),
+ 0x0019, KeyExAlgorithm.DH_ANON_EXPORT, Protocol.SSLV3, Protocol.TLSV1),
SSL_DH_anon_WITH_RC4_128_MD5(
- 0x0018, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0018, KeyExAlgorithm.DH_ANON, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_DH_anon_EXPORT_WITH_RC4_40_MD5(
- 0x0017, Protocol.SSLV3, Protocol.TLSV1),
+ 0x0017, KeyExAlgorithm.DH_ANON_EXPORT, Protocol.SSLV3, Protocol.TLSV1),
SSL_DHE_RSA_WITH_3DES_EDE_CBC_SHA(
- 0x0016, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0016, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_DHE_RSA_WITH_DES_CBC_SHA(
- 0x0015, Protocol.SSLV3, Protocol.TLSV1_1),
+ 0x0015, KeyExAlgorithm.DHE_RSA, Protocol.SSLV3, Protocol.TLSV1_1),
SSL_DHE_RSA_EXPORT_WITH_DES40_CBC_SHA(
- 0x0014, Protocol.SSLV3, Protocol.TLSV1),
+ 0x0014, KeyExAlgorithm.DHE_RSA_EXPORT, Protocol.SSLV3, Protocol.TLSV1),
SSL_DHE_DSS_WITH_3DES_EDE_CBC_SHA(
- 0x0013, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0013, KeyExAlgorithm.DHE_DSS, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_DHE_DSS_WITH_DES_CBC_SHA(
- 0x0012, Protocol.SSLV3, Protocol.TLSV1_1),
+ 0x0012, KeyExAlgorithm.DHE_DSS, Protocol.SSLV3, Protocol.TLSV1_1),
SSL_DHE_DSS_EXPORT_WITH_DES40_CBC_SHA(
- 0x0011, Protocol.SSLV3, Protocol.TLSV1),
+ 0x0011, KeyExAlgorithm.DHE_DSS_EXPORT, Protocol.SSLV3, Protocol.TLSV1),
SSL_RSA_WITH_3DES_EDE_CBC_SHA(
- 0x000A, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x000A, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_RSA_WITH_DES_CBC_SHA(
- 0x0009, Protocol.SSLV3, Protocol.TLSV1_1),
+ 0x0009, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_1),
SSL_RSA_EXPORT_WITH_DES40_CBC_SHA(
- 0x0008, Protocol.SSLV3, Protocol.TLSV1),
+ 0x0008, KeyExAlgorithm.RSA_EXPORT, Protocol.SSLV3, Protocol.TLSV1),
SSL_RSA_WITH_RC4_128_SHA(
- 0x0005, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0005, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_RSA_WITH_RC4_128_MD5(
- 0x0004, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0004, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_RSA_EXPORT_WITH_RC4_40_MD5(
- 0x0003, Protocol.SSLV3, Protocol.TLSV1),
+ 0x0003, KeyExAlgorithm.RSA_EXPORT, Protocol.SSLV3, Protocol.TLSV1),
SSL_RSA_WITH_NULL_SHA(
- 0x0002, Protocol.SSLV3, Protocol.TLSV1_2),
+ 0x0002, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2),
SSL_RSA_WITH_NULL_MD5(
- 0x0001, Protocol.SSLV3, Protocol.TLSV1_2);
+ 0x0001, KeyExAlgorithm.RSA, Protocol.SSLV3, Protocol.TLSV1_2);
public final int id;
+ public final KeyExAlgorithm keyExAlgorithm;
public final Protocol startProtocol;
public final Protocol endProtocol;
private CipherSuite(
int id,
+ KeyExAlgorithm keyExAlgorithm,
Protocol startProtocol,
Protocol endProtocol) {
this.id = id;
+ this.keyExAlgorithm = keyExAlgorithm;
this.startProtocol = startProtocol;
this.endProtocol = endProtocol;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/jdk/javax/net/ssl/TLSCommon/KeyExAlgorithm.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,44 @@
+/*
+ * Copyright (c) 2018, 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.
+ */
+
+/*
+ * Key exchange algorithms.
+ */
+public enum KeyExAlgorithm {
+
+ DH_ANON,
+ DH_ANON_EXPORT,
+ DHE_DSS,
+ DHE_DSS_EXPORT,
+ DHE_RSA,
+ DHE_RSA_EXPORT,
+ ECDH_ANON,
+ ECDH_ECDSA,
+ ECDH_RSA,
+ ECDHE_ECDSA,
+ ECDHE_RSA,
+ KRB5,
+ RSA,
+ RSA_EXPORT,
+ SCSV
+}
--- a/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/lib/testlibrary/java/util/jar/CreateMultiReleaseTestJars.java Tue Oct 16 23:21:05 2018 +0530
@@ -142,6 +142,12 @@
}
public void buildSignedMultiReleaseJar() throws Exception {
+ buildSignedMultiReleaseJar("multi-release.jar", "signed-multi-release.jar");
+ }
+
+ public void buildSignedMultiReleaseJar(String multiReleaseJar,
+ String signedMultiReleaseJar) throws Exception
+ {
String testsrc = System.getProperty("test.src",".");
String testdir = findTestDir(testsrc);
String keystore = testdir + "/sun/security/tools/jarsigner/JarSigning.keystore";
@@ -155,8 +161,8 @@
CertPath cp = CertificateFactory.getInstance("X.509")
.generateCertPath(Arrays.asList(ks.getCertificateChain("b")));
JarSigner js = new JarSigner.Builder(pkb, cp).build();
- try (ZipFile in = new ZipFile("multi-release.jar");
- FileOutputStream os = new FileOutputStream("signed-multi-release.jar"))
+ try (ZipFile in = new ZipFile(multiReleaseJar);
+ FileOutputStream os = new FileOutputStream(signedMultiReleaseJar))
{
js.sign(in, os);
}
--- a/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/sun/management/StackTraceElementCompositeData/CompatibilityTest.java Tue Oct 16 23:21:05 2018 +0530
@@ -36,7 +36,7 @@
/*
* @test
- * @bug 8139587
+ * @bug 8139587 8212197
* @modules java.management/sun.management
* @summary Check backward compatibility of StackTraceElementCompositeData
* @author Jaroslav Bachorik
@@ -154,5 +154,16 @@
assertEquals(ste.isNativeMethod(), false);
assertEquals(ste.getLineNumber(), 123);
}
+
+ @Test
+ public void testCompositeData() throws Exception {
+ StackTraceElement ste = new StackTraceElement("app",
+ "m", "1.0",
+ "p.MyClass", "myMethod",
+ "MyClass.java", 123);
+ CompositeData cd = StackTraceElementCompositeData.toCompositeData(ste);
+ StackTraceElement ste1 = StackTraceElementCompositeData.from(cd);
+ assertEquals(ste, ste1);
+ }
}
--- a/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/jdk/sun/security/lib/cacerts/VerifyCACerts.java Tue Oct 16 23:21:05 2018 +0530
@@ -24,8 +24,8 @@
/**
* @test
- * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779 8209452
- * 8209506 8210432
+ * @bug 8189131 8198240 8191844 8189949 8191031 8196141 8204923 8195774 8199779
+ * 8209452 8209506 8210432 8195793
* @summary Check root CA entries in cacerts file
*/
import java.io.File;
@@ -42,7 +42,7 @@
+ File.separator + "security" + File.separator + "cacerts";
// The numbers of certs now.
- private static final int COUNT = 93;
+ private static final int COUNT = 92;
// map of cert alias to SHA-256 fingerprint
private static final Map<String, String> FINGERPRINT_MAP
@@ -116,8 +116,6 @@
"B4:78:B8:12:25:0D:F8:78:63:5C:2A:A7:EC:7D:15:5E:AA:62:5E:E8:29:16:E2:CD:29:43:61:88:6C:D1:FB:D4");
put("geotrustuniversalca [jdk]",
"A0:45:9B:9F:63:B2:25:59:F5:FA:5D:4C:6D:B3:F9:F7:2F:F1:93:42:03:35:78:F0:73:BF:1D:1B:46:CB:B9:12");
- put("gtecybertrustglobalca [jdk]",
- "A5:31:25:18:8D:21:10:AA:96:4B:02:C7:B7:C6:DA:32:03:17:08:94:E5:FB:71:FF:FB:66:67:D5:E6:81:0A:36");
put("thawteprimaryrootca [jdk]",
"8D:72:2F:81:A9:C1:13:C0:79:1D:F1:36:A2:96:6D:B2:6C:95:0A:97:1D:B4:6B:41:99:F4:EA:54:B7:8B:FB:9F");
put("thawteprimaryrootcag2 [jdk]",
@@ -239,10 +237,7 @@
// Exception list to 90 days expiry policy
// No error will be reported if certificate in this list expires
- private static final HashSet<String> EXPIRY_EXC_ENTRIES
- = new HashSet<String>(Arrays.asList(
- "gtecybertrustglobalca [jdk]"
- ));
+ private static final HashSet<String> EXPIRY_EXC_ENTRIES = new HashSet<>();
// Ninety days in milliseconds
private static final long NINETY_DAYS = 7776000000L;
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/TestOverriddenDeprecatedMethods.java Tue Oct 16 23:21:05 2018 +0530
@@ -0,0 +1,64 @@
+/*
+ * Copyright (c) 2018, 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 8211901
+ * @summary javadoc generates broken links on deprecated items page
+ * @library ../lib
+ * @modules jdk.javadoc/jdk.javadoc.internal.tool
+ * @build JavadocTester
+ * @run main TestOverriddenDeprecatedMethods
+ */
+
+public class TestOverriddenDeprecatedMethods extends JavadocTester {
+
+ public static void main(String args[]) throws Exception {
+ TestOverriddenDeprecatedMethods tester = new TestOverriddenDeprecatedMethods();
+ tester.runTests();
+ }
+
+ @Test
+ void test() {
+ javadoc("-d", "out-deprecated",
+ "-sourcepath", testSrc,
+ "--override-methods","summary",
+ "pkg1");
+
+ checkExit(Exit.OK);
+
+ checkOrder("pkg1/SubClass.html",
+ "Method Summary",
+ "Methods declared in class pkg1.<a href=\"BaseClass.html\" title=\"class in pkg1\">"
+ + "BaseClass</a>",
+ "<a href=\"BaseClass.html#func3()\">func3</a>");
+
+ checkOrder("pkg1/SubClass.html",
+ "Method Detail",
+ "@Deprecated\npublic void func1()",
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>",
+ "@Deprecated\npublic void func2()",
+ "<div class=\"deprecationBlock\"><span class=\"deprecatedLabel\">Deprecated.</span></div>",
+ "<div class=\"block\">deprecated with comments</div>");
+ }
+}
--- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/BaseClass.java Tue Oct 16 23:21:05 2018 +0530
@@ -50,4 +50,22 @@
*/
public void overridenMethodWithDocsToCopy() {}
+ /**
+ * @deprecated func1 deprecated
+ */
+ @Deprecated
+ public void func1() {}
+
+ /**
+ * @deprecated func2 deprecated
+ */
+ @Deprecated
+ public void func2() {}
+
+ /**
+ * @deprecated func3 deprecated
+ */
+ @Deprecated
+ public void func3() {}
+
}
--- a/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/langtools/jdk/javadoc/doclet/testOverriddenMethods/pkg1/SubClass.java Tue Oct 16 23:21:05 2018 +0530
@@ -48,4 +48,22 @@
public void privateMethod() {}
public void overridenMethodWithDocsToCopy() {}
+
+ /**
+ * {@inheritDoc}
+ */
+ @Deprecated
+ public void func1() {}
+
+ /**
+ * deprecated with comments
+ */
+ @Deprecated
+ public void func2() {}
+
+ /**
+ * {@inheritDoc}
+ */
+ public void func3() {}
+
}
--- a/test/lib/jdk/test/lib/util/JarUtils.java Fri Oct 19 11:15:57 2018 -0700
+++ b/test/lib/jdk/test/lib/util/JarUtils.java Tue Oct 16 23:21:05 2018 +0530
@@ -23,6 +23,7 @@
package jdk.test.lib.util;
+import java.io.ByteArrayOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
@@ -271,6 +272,11 @@
changes = new HashMap<>(changes);
System.out.printf("Creating %s from %s...\n", dest, src);
+
+ if (dest.equals(src)) {
+ throw new IOException("src and dest cannot be the same");
+ }
+
try (JarOutputStream jos = new JarOutputStream(
new FileOutputStream(dest))) {
@@ -298,6 +304,22 @@
System.out.println();
}
+ /**
+ * Update the Manifest inside a jar.
+ *
+ * @param src the original jar file name
+ * @param dest the new jar file name
+ * @param man the Manifest
+ *
+ * @throws IOException
+ */
+ public static void updateManifest(String src, String dest, Manifest man)
+ throws IOException {
+ ByteArrayOutputStream bout = new ByteArrayOutputStream();
+ man.write(bout);
+ updateJar(src, dest, Map.of(JarFile.MANIFEST_NAME, bout.toByteArray()));
+ }
+
private static void updateEntry(JarOutputStream jos, String name, Object content)
throws IOException {
if (content instanceof Boolean) {
--- a/test/make/TestMakeBase.gmk Fri Oct 19 11:15:57 2018 -0700
+++ b/test/make/TestMakeBase.gmk Tue Oct 16 23:21:05 2018 +0530
@@ -1,5 +1,5 @@
#
-# Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
+# Copyright (c) 2014, 2018, 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
@@ -93,6 +93,7 @@
EQUALS_VALUE1 := value1$(SPACE)
EQUALS_VALUE2 := value2
+EQUALS_EMPTY :=
ifneq ($(call equals, $(EQUALS_VALUE1), $(EQUALS_VALUE2)), )
$(error The strings >$(EQUALS_VALUE1)< and >$(EQUALS_VALUE2)< are equal)
@@ -102,6 +103,18 @@
$(error The strings >$(EQUALS_VALUE1)< and >$(EQUALS_VALUE1)< are not equal)
endif
+ifeq ($(call equals, $(EQUALS_EMPTY), $(EQUALS_EMPTY)), )
+ $(error The strings >$(EQUALS_EMPTY)< and >$(EQUALS_EMPTY)< are not equal)
+endif
+
+ifneq ($(call equals, $(EQUALS_EMPTY), $(EQUALS_VALUE2)), )
+ $(error The strings >$(EQUALS_EMPTY)< and >$(EQUALS_VALUE2)< are equal)
+endif
+
+ifneq ($(call equals, $(EQUALS_VALUE2), $(EQUALS_EMPTY)), )
+ $(error The strings >$(EQUALS_VALUE2)< and >$(EQUALS_EMPTY)< are equal)
+endif
+
################################################################################
# Test remove-prefixes